GrNewPixmapFromData()

Name

GrNewPixmapFromData() -- Create a new pixmap and initialize it

Synopsis

GR_WINDOW_ID GrNewPixmapFromData ( GR_SIZE width , GR_SIZE height , GR_COLOR foreground , GR_COLOR background , void * bits , int flags );

Description

This function creates a new server side pixmap of the specified width and height. The pixmap is initialized with a monochrome bitmap corresponding to the specified bit array. If specified byte and/or bit reversal will be performed on each short word within the bit array.

Note

A pixmap is basically an offscreen window. You can draw to a pixmap just as you would an on screen window. The return value of this function is a bit misleading, in that it should probably be a GR_DRAW_ID rather than a window ID. From a drawing point of view nano-X does not make much of a difference between window IDs and drawable IDs.

Note

When finished with the pixmap, the application must free the resources allocated to the pixmap by calling the function GrDestroyWindow() with the pixmap ID as the ID of the window to destroy.

Parameters

TypeNameDescription
GR_SIZEwidthThe width in pixels of the pixmap.
GR_SIZEheightThe height in pixels of the pixmap.
GR_COLORforegroundThe color to use as the pixmap foreground.
GR_COLORbackgroundThe color to use as the pixmap background.
void*bitsPinter to the bit array. All set bits in this array are drawn in the specfied foreground color. All clear bits in this array are drawn in the specified background color.
intflagsThis fields hold flags from the table below.

ModeDescription
GR_BMDATA_BYTEREVERSESwap every other byte of the bit array (short word byte swap).
GR_BMDATA_BYTESWAPReverse the bit order of every byte within the bit array.

Returns

The ID of the newly created pixmap.

See Also

GrNewPixmap(), GrDestroyWindow(), GrCopyArea(), GrSetBackgroundPixmap().