Raster Services
Availability LightWave 6.0 | Component Layout, Modeler | Header lwpanel.h
Raster services are a set of functions for manipulating bitmaps (rasters) used as
interface elements in your panels. A raster isn't visible until
you call blitPanel
to draw it on a panel.
Global Call
LWRasterFuncs *rastf; rastf = global( LWRASTERFUNCS_GLOBAL, GFUSE_TRANSIENT );
The global function returns a pointer to an LWRasterFuncs.
typedef struct st_LWRasterFuncs { void (*drawPixel) (LWRasterID, int color, int x, int y); void (*drawRGBPixel)(LWRasterID, int r, int g, int b, int x, int y); void (*drawLine) (LWRasterID, int color, int x, int y, int x2, int y2); void (*drawBox) (LWRasterID, int color, int x, int y, int w, int h); void (*drawRGBBox) (LWRasterID, int r, int g, int b, int x, int y, int w, int h); void (*eraseBox) (LWRasterID, int x, int y, int w, int h); void (*drawBorder) (LWRasterID, int indent, int x, int y, int w, int h); void (*drawText) (LWRasterID, char *, int color, int x, int y); LWRasterID (*create) (int w, int h, int flags); void (*destroy) (LWRasterID); void (*blitPanel) (LWRasterID, int x, int y, LWPanelID, int x, int y, int w, int h); } LWRasterFuncs;
drawPixel( raster, color, x, y )
drawRGBPixel( raster, r, g, b, x, y )- Set the color of a pixel. The color is either one of the predefined colors in lwpanel.h or 8-bit levels of red, green and blue.
drawLine( raster, color, x, y, x2, y2 )
- Draw a line from (
x
,y
) to (x2
,y2
) inclusive. drawBox( raster, color, x, y, w, h )
drawRGBBox( raster, r, g, b, x, y, w, h )
eraseBox( raster, x, y, w, h )- Draw a filled box. The color for
eraseBox
is the panel's background color. drawBorder( raster, indent, x, y, w, h )
- Draw a LightWave-style rectangular border. The
indent
controls the border thickness. drawText( raster, text, color, x, y )
- Draw a line of text. The coordinates specify the upper left corner of the first character cell. You can get information about the pixel dimensions of the text using the LWDisplayMetrics functions returned by the Panels global.
raster = create( w, h, flags )
- Create a raster. No flags are currently defined, so
flags
should be 0. destroy( raster )
- Free a raster.
blitPanel( raster, srcx, srcy, panel, dstx, dsty, w, h )
- Transfer a raster image, or part of one, to the surface of a panel.
srcx
andsrcy
are the upper left corner of the source rectangle, whiledstx
anddsty
are the upper left corner of the destination, relative to the upper left corner of the panel window.
Example
The binview SDK sample makes extensive use of the raster functions to create and display its own fixed-pitch font glyphs. It also uses a raster to display an icon.