清单 5 Native 图形引擎的核心数据结构
typedef struct _screendevice { int xres; /* X screen res (real) */ int yres; /* Y screen res (real) */ int planes; /* # planes*/ int bpp; /* # bits per pixel*/ int linelen; /* line length in bytes for bpp 1,2,4,8, line length in pixels for bpp 16, 24, 32*/ int size; /* size of memory allocated*/ gfx_pixel gr_foreground; /* current foreground color */ gfx_pixel gr_background; /* current background color */ int gr_mode; int flags; /* device flags*/ void * addr; /* address of memory allocated (memdc or fb)*/
PSD (*Open)(PSD psd); void (*Close)(PSD psd); void (*SetPalette)(PSD psd,int first,int count,gfx_color *cmap); void (*GetPalette)(PSD psd,int first,int count,gfx_color *cmap); PSD (*AllocateMemGC)(PSD psd); BOOL (*MapMemGC)(PSD mempsd,int w,int h,int planes,int bpp, int linelen,int size,void *addr); void (*FreeMemGC)(PSD mempsd); void (*FillRect)(PSD psd,int x,int y,int w,int h,gfx_pixel c); void (*DrawPixel)(PSD psd, int x, int y, gfx_pixel c); gfx_pixel (*ReadPixel)(PSD psd, int x, int y); void (*DrawHLine)(PSD psd, int x, int y, int w, gfx_pixel c); void (*PutHLine) (GAL gal, int x, int y, int w, void* buf); void (*GetHLine) (GAL gal, int x, int y, int w, void* buf); void (*DrawVLine)(PSD psd, int x, int y, int w, gfx_pixel c); void (*PutVLine) (GAL gal, int x, int y, int w, void* buf); void (*GetVLine) (GAL gal, int x, int y, int w, void* buf); void (*Blit)(PSD dstpsd, int dstx, int dsty, int w, int h, PSD srcpsd, int srcx, int srcy); void (*PutBox)( GAL gal, int x, int y, int w, int h, void* buf ); void (*GetBox)( GAL gal, int x, int y, int w, int h, void* buf ); void (*PutBoxMask)( GAL gal, int x, int y, int w, int h, void *buf); void (*CopyBox)(PSD psd,int x1, int y1, int w, int h, int x2, int y2); } SCREENDEVICE;
|