📄 guigal.h
字号:
Graphic abstract layer
***********************************************************************/
T_EXTERN T_GUI_PIXEL taGDI_SysPixelIndex [];
T_EXTERN T_CONST T_GUI_Rgb taGDI_SysPixelColor [];
typedef struct T_GAL_Output
{
/* Physical graphics context */
T_GAL_pGC phy_pgc;
T_WORD bytes_per_phypixel;
T_WORD bits_per_phypixel;
T_WORD width_phygc;
T_WORD height_phygc;
T_WORD colors_phygc;
T_BOOL grayscale_screen;
/* GC properties */
T_WORD (*BytesPerPixel) (T_GAL_pGC pGC);
T_WORD (*BitsPerPixel) (T_GAL_pGC pGC);
T_WORD (*width) (T_GAL_pGC pGC);
T_WORD (*height) (T_GAL_pGC pGC);
T_WORD (*colors) (T_GAL_pGC pGC);
/* Allocation and release of graphics context */
T_WORD (*AllocateGc) (
T_GAL_pGC pGC,
T_WORD width,
T_WORD height,
T_WORD depth,
T_GAL_pGC *NewpGC
);
T_VOID (*FreeGc) (T_GAL_pGC pGC);
T_VOID (*SetGc) (T_GAL_pGC pGC);
/* Clipping of graphics context */
T_VOID (*EnableClipping) (T_GAL_pGC pGC);
T_VOID (*DisableClipping) (T_GAL_pGC pGC);
T_WORD (*SetClipping) (T_GAL_pGC pGC, T_WORD x1, T_WORD y1, T_WORD x2, T_WORD y2);
T_WORD (*GetClipping) (
T_GAL_pGC pGC,
T_WORD* x1,
T_WORD* y1,
T_WORD* x2,
T_WORD* y2
);
/* Background and foreground colors */
T_WORD (*GetBgColor) (T_GAL_pGC pGC, T_GUI_PIXEL* color);
T_WORD (*SetBgColor) (T_GAL_pGC pGC, T_GUI_PIXEL color);
T_WORD (*GetFgColor) (T_GAL_pGC pGC, T_GUI_PIXEL* color);
T_WORD (*SetFgColor) (T_GAL_pGC pGC, T_GUI_PIXEL color);
/* Convertion between T_GUI_COLOR and T_GUI_PIXEL */
T_GUI_PIXEL(*MapColor) (T_GAL_pGC pGC, T_GUI_COLOR *color);
T_WORD (*UnmapPixel) (T_GAL_pGC pGC, T_GUI_PIXEL pixel, T_GUI_COLOR* color);
T_WORD (*PackColors) (T_GAL_pGC pGC, T_VOID* buf, T_GUI_COLOR* colors, T_WORD len);
T_WORD (*UnpackPixels) (
T_GAL_pGC pGC,
T_VOID* buf,
T_GUI_COLOR* colors,
T_WORD len
);
/* Palette operations */
T_WORD (*GetPalette) (T_GAL_pGC pGC, T_WORD s, T_WORD len, T_GUI_COLOR* cmap);
T_WORD (*SetPalette) (T_GAL_pGC pGC, T_WORD s, T_WORD len, T_GUI_COLOR* cmap);
T_WORD (*SetColorFulPalette) (T_GAL_pGC pGC);
/* Box operations */
T_GUI_SIZE (*BoxSize) (T_GAL_pGC pGC, T_WORD w, T_WORD h);
T_WORD (*FillBox) (
T_GAL_pGC pGC,
T_WORD x,
T_WORD y,
T_WORD w,
T_WORD h,
T_GUI_PIXEL pixel
);
T_WORD (*PutBox) (T_GAL_pGC pGC, T_WORD x, T_WORD y, T_WORD w, T_WORD h, T_VOID* buf);
T_WORD (*GetBox) (T_GAL_pGC pGC, T_WORD x, T_WORD y, T_WORD w, T_WORD h, T_VOID* buf);
T_WORD (*PutBoxMask) (
T_GAL_pGC pGC,
T_WORD x,
T_WORD y,
T_WORD w,
T_WORD h,
T_VOID* buf,
T_GUI_PIXEL cxx
);
T_WORD (*ScaleBox) (
T_GAL_pGC pGC,
T_WORD sw,
T_WORD sh,
T_VOID* srcbuf,
T_WORD dw,
T_WORD dh,
T_VOID* dstbuf
);
T_WORD (*CopyBox) (
T_GAL_pGC pGC,
T_WORD x,
T_WORD y,
T_WORD w,
T_WORD h,
T_WORD nx,
T_WORD ny
);
T_WORD (*CrossBlit) (
T_GAL_pGC src,
T_WORD sx,
T_WORD sy,
T_WORD sw,
T_WORD sh,
T_GAL_pGC dst,
T_WORD dx,
T_WORD dy
);
/* Horizontal line operaions */
T_WORD (*DrawHLine) (T_GAL_pGC pGC, T_WORD x, T_WORD y, T_WORD w, T_GUI_PIXEL pixel);
T_WORD (*PutHLine) (T_GAL_pGC pGC, T_WORD x, T_WORD y, T_WORD w, T_VOID* buf);
T_WORD (*GetHLine) (T_GAL_pGC pGC, T_WORD x, T_WORD y, T_WORD w, T_VOID* buf);
/* Vertical line operations */
T_WORD (*DrawVLine) (T_GAL_pGC pGC, T_WORD x, T_WORD y, T_WORD h, T_GUI_PIXEL pixel);
T_WORD (*PutVLine) (T_GAL_pGC pGC, T_WORD x, T_WORD y, T_WORD h, T_VOID* buf);
T_WORD (*GetVLine) (T_GAL_pGC pGC, T_WORD x, T_WORD y, T_WORD h, T_VOID* buf);
/* Pixel operations */
T_WORD (*DrawPixel) (T_GAL_pGC pGC, T_WORD x, T_WORD y, T_GUI_PIXEL pixel);
T_WORD (*GetPixel) (T_GAL_pGC pGC, T_WORD x, T_WORD y, T_GUI_PIXEL* color);
/* Other drawing */
T_WORD (*circle) (T_GAL_pGC pGC, T_WORD x, T_WORD y, T_WORD r, T_GUI_PIXEL pixel);
T_WORD (*line) (
T_GAL_pGC pGC,
T_WORD x1,
T_WORD y1,
T_WORD x2,
T_WORD y2,
T_GUI_PIXEL pixel
);
T_WORD (*rectangle) (
T_GAL_pGC pGC,
T_WORD l,
T_WORD t,
T_WORD r,
T_WORD b,
T_GUI_PIXEL pixel
);
/*************************************************************************
* Horse done!
* Ellipse,Arc
**************************************************************************/
T_WORD (*ellipse) (
T_GAL_pGC pGC,
T_WORD x,
T_WORD y,
T_WORD rx,
T_WORD ry,
T_GUI_PIXEL pixel
);
T_WORD (*ellipsearc) (
T_GAL_pGC pGC,
T_WORD x,
T_WORD y,
T_WORD rx,
T_WORD ry,
T_WORD startX,
T_WORD startY,
T_WORD endX,
T_WORD endY,
T_GUI_PIXEL pixel
);
T_WORD (*fillellipsearc) (
T_GAL_pGC pGC,
T_WORD x,
T_WORD y,
T_WORD rx,
T_WORD ry,
T_WORD startX,
T_WORD startY,
T_WORD endX,
T_WORD endY,
T_GUI_PIXEL pixel
);
#if 0
T_WORD (*arc) (
T_GAL_pGC pGC,
T_WORD x,
T_WORD y,
T_DWORD ang1,
T_DWORD ang2,
T_WORD r,
T_GUI_PIXEL pixel
);
#else
T_WORD (*arc) (
T_GAL_pGC pGC,
T_WORD x,
T_WORD y,
T_WORD ang1,
T_WORD ang2,
T_WORD r,
T_GUI_PIXEL pixel
);
#endif
}T_GAL_Output;
T_EXTERN T_GAL_Output* tpGAL_Output;
/* API for Graphic operation */
#define pGAL_PhyPgc (tpGAL_Output->phy_pgc)
#define wGAL_BytesPerPhyPixel (tpGAL_Output->bytes_per_phypixel)
#define wGAL_BitsPerPhyPixel (tpGAL_Output->bits_per_phypixel)
#define wGAL_WidthPhyGc (tpGAL_Output->width_phygc)
#define wGAL_HeightPhyGc (tpGAL_Output->height_phygc)
#define wGAL_ColorsPhyGc (tpGAL_Output->colors_phygc)
#define oGAL_GrayscaleScreen (tpGAL_Output->grayscale_screen)
#define fnGAL_BytesPerPixel (*tpGAL_Output->BytesPerPixel)
#define fnGAL_BitsPerPixel (*tpGAL_Output->BitsPerPixel)
#define fnGAL_Width (*tpGAL_Output->width)
#define fnGAL_Height (*tpGAL_Output->height)
#define fnGAL_Colors (*tpGAL_Output->colors)
#define fnGAL_AllocateGC (*tpGAL_Output->AllocateGc)
#define fnGAL_FreeGC (*tpGAL_Output->FreeGc)
#define fnGAL_SetGC(pgc) \
if (tpGAL_Output->SetGc) (*tpGAL_Output->SetGc) (pgc)
#define fnGAL_EnableClipping (*tpGAL_Output->EnableClipping)
#define fnGAL_DisableClipping (*tpGAL_Output->DisableClipping)
#define fnGAL_SetClipping (*tpGAL_Output->SetClipping)
#define fnGAL_GetClipping (*tpGAL_Output->GetClipping)
#define fnGAL_GetBgColor (*tpGAL_Output->GetBgColor)
#define fnGAL_GetFgColor (*tpGAL_Output->GetFgColor)
#define fnGAL_SetBgColor(pgc, pixel) \
if (tpGAL_Output->SetBgColor) (*tpGAL_Output->SetBgColor) (pgc, pixel)
#define fnGAL_SetFgColor(pgc, pixel) \
if (tpGAL_Output->SetFgColor) (*tpGAL_Output->SetFgColor) (pgc, pixel)
#define fnGAL_MapColor (*tpGAL_Output->MapColor)
#define fnGAL_UnmapPixel (*tpGAL_Output->UnmapPixel)
#define fnGAL_PackColors (*tpGAL_Output->PackColors)
#define fnGAL_UnpackPixels (*tpGAL_Output->UnpackPixels)
#define fnGAL_GetPalette (*tpGAL_Output->GetPalette)
#define fnGAL_SetPalette (*tpGAL_Output->SetPalette)
#define fnGAL_SetColorfulePalette (*tpGAL_Output->SetColorFulPalette)
#define fnGAL_BoxSize (*tpGAL_Output->BoxSize)
#define fnGAL_FillBox (*tpGAL_Output->FillBox)
#define fnGAL_PutBox (*tpGAL_Output->PutBox)
#define fnGAL_GetBox (*tpGAL_Output->GetBox)
#define fnGAL_PutBoxMask (*tpGAL_Output->PutBoxMask)
#define fnGAL_ScaleBox (*tpGAL_Output->ScaleBox)
#define fnGAL_CopyBox (*tpGAL_Output->CopyBox)
#define fnGAL_CrossBlit (*tpGAL_Output->CrossBlit)
#define fnGAL_DrawHLine (*tpGAL_Output->DrawHLine)
#define fnGAL_PutHLine (*tpGAL_Output->PutHLine)
#define fnGAL_GetHLine (*tpGAL_Output->GetHLine)
#define fnGAL_DrawVLine (*tpGAL_Output->DrawVLine)
#define fnGAL_PutVLine (*tpGAL_Output->PutVLine)
#define fnGAL_GetVLine (*tpGAL_Output->GetVLine)
#define fnGAL_DrawPixel (*tpGAL_Output->DrawPixel)
#define fnGAL_GetPixel (*tpGAL_Output->GetPixel)
#define fnGAL_Circle (*tpGAL_Output->circle)
#define fnGAL_Line (*tpGAL_Output->line)
#define fnGAL_Rectangle (*tpGAL_Output->rectangle)
/*************************************************************************
* Horse done!
* Ellipse,Arc
**************************************************************************/
#define fnGAL_Ellipse (*tpGAL_Output->ellipse)
#define fnGAL_EllipseArc (*tpGAL_Output->ellipsearc)
#define fnGAL_FillEllipseArc (*tpGAL_Output->fillellipsearc)
#define fnGAL_Arc (*tpGAL_Output->arc)
T_WORD fnGAL_InitOutput(T_VOID);
#ifdef __cplusplus
}
#endif
#endif /* _GUIGAL_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -