Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

gdi.h

Go to the documentation of this file.
00001 
00021 /*
00022  * $Id: gdi.h,v 1.245 2006/06/26 04:00:44 xwyan Exp $
00023  *
00024  *             MiniGUI for Linux/uClinux, eCos, uC/OS-II, VxWorks, 
00025  *                     pSOS, ThreadX, NuCleus, OSE, and Win32.
00026  *
00027  *             Copyright (C) 2002-2006 Feynman Software.
00028  *             Copyright (C) 1998-2002 Wei Yongming.
00029  */
00030 
00031 #ifndef _MGUI_GDI_H
00032     #define _MGUI_GDI_H
00033 
00034 
00035 #ifdef __cplusplus
00036 extern "C" {
00037 #endif  /* __cplusplus */
00038 
00090 extern MG_EXPORT gal_pixel SysPixelIndex [];
00091 
00098 extern const MG_EXPORT RGB SysPixelColor [];
00099 
00105 #define PIXEL_invalid       0
00106 
00112 #define PIXEL_transparent   SysPixelIndex[0]
00113 
00119 #define PIXEL_darkblue      SysPixelIndex[1]
00120 
00126 #define PIXEL_darkgreen     SysPixelIndex[2]
00127 
00133 #define PIXEL_darkcyan      SysPixelIndex[3]
00134 
00140 #define PIXEL_darkred       SysPixelIndex[4] 
00141 
00147 #define PIXEL_darkmagenta   SysPixelIndex[5]
00148 
00154 #define PIXEL_darkyellow    SysPixelIndex[6] 
00155 
00161 #define PIXEL_darkgray      SysPixelIndex[7] 
00162 
00168 #define PIXEL_lightgray     SysPixelIndex[8]
00169 
00175 #define PIXEL_blue          SysPixelIndex[9]
00176 
00182 #define PIXEL_green         SysPixelIndex[10]
00183 
00189 #define PIXEL_cyan          SysPixelIndex[11]
00190 
00196 #define PIXEL_red           SysPixelIndex[12]
00197 
00203 #define PIXEL_magenta       SysPixelIndex[13]
00204 
00210 #define PIXEL_yellow        SysPixelIndex[14]
00211 
00217 #define PIXEL_lightwhite    SysPixelIndex[15]
00218 
00224 #define PIXEL_black         SysPixelIndex[16]
00225 
00226 /* Compatiblity definitions */
00231 #define COLOR_invalid       PIXEL_invalid
00232 
00237 #define COLOR_transparent   PIXEL_transparent
00238 
00243 #define COLOR_darkred       PIXEL_darkred
00244 
00249 #define COLOR_darkgreen     PIXEL_darkgreen
00250 
00255 #define COLOR_darkyellow    PIXEL_darkyellow
00256 
00261 #define COLOR_darkblue      PIXEL_darkblue
00262 
00267 #define COLOR_darkmagenta   PIXEL_darkmagenta
00268 
00273 #define COLOR_darkcyan      PIXEL_darkcyan
00274 
00279 #define COLOR_lightgray     PIXEL_lightgray
00280 
00285 #define COLOR_darkgray      PIXEL_darkgray
00286 
00291 #define COLOR_red           PIXEL_red
00292 
00297 #define COLOR_green         PIXEL_green
00298 
00303 #define COLOR_yellow        PIXEL_yellow
00304 
00309 #define COLOR_blue          PIXEL_blue
00310 
00315 #define COLOR_magenta       PIXEL_magenta
00316 
00321 #define COLOR_cyan          PIXEL_cyan
00322 
00327 #define COLOR_lightwhite    PIXEL_lightwhite
00328 
00333 #define COLOR_black         PIXEL_black
00334 
00339 #define SysColorIndex       SysPixelIndex
00340 
00372 typedef struct _BLOCKHEAP
00373 {
00374 #ifndef _LITE_VERSION
00375     pthread_mutex_t lock;
00376 #endif
00377 
00380     size_t          bd_size;
00384     size_t          heap_size;
00388     int             free;
00392     void*           heap;
00393 } BLOCKHEAP;
00394 
00401 typedef BLOCKHEAP* PBLOCKHEAP;
00402 
00425 MG_EXPORT extern void InitBlockDataHeap (PBLOCKHEAP heap, 
00426                 size_t bd_size, size_t heap_size);
00427 
00443 MG_EXPORT extern void* BlockDataAlloc (PBLOCKHEAP heap);
00444 
00458 MG_EXPORT extern void BlockDataFree (PBLOCKHEAP heap, void* data);
00459 
00468 MG_EXPORT extern void DestroyBlockDataHeap (PBLOCKHEAP heap);
00469 
00479 struct _BITMAP;
00480 
00485 typedef struct _BITMAP BITMAP;
00486 
00492 typedef BITMAP* PBITMAP;
00493 
00494 struct _MYBITMAP;
00495 
00500 typedef struct _MYBITMAP MYBITMAP;
00501 
00507 typedef struct _MYBITMAP* PMYBITMAP;
00508 
00545 typedef struct _CLIPRECT
00546 {
00550     RECT rc;
00554     struct _CLIPRECT* next;
00555 #ifdef _USE_NEWGAL
00556 
00560     struct _CLIPRECT* prev;
00561 #endif
00562 } CLIPRECT;
00563 typedef CLIPRECT* PCLIPRECT;
00564 
00565 /* Clipping Region */
00566 #ifdef _USE_NEWGAL
00567 #define NULLREGION      0x00
00568 #define SIMPLEREGION    0x01
00569 #define COMPLEXREGION   0x02
00570 #endif
00571 
00575 typedef struct _CLIPRGN
00576 {
00577 #ifdef _USE_NEWGAL
00578 
00589     BYTE            type;
00595     BYTE            reserved[3];
00596 #endif
00597 
00600     RECT            rcBound;
00604     PCLIPRECT       head;
00608     PCLIPRECT       tail;
00613     PBLOCKHEAP      heap;
00614 } CLIPRGN;
00615 
00622 typedef CLIPRGN* PCLIPRGN;
00623 
00637 #define InitFreeClipRectList(heap, size)    \
00638                 InitBlockDataHeap (heap, sizeof (CLIPRECT), size)
00639 
00650 #define ClipRectAlloc(heap)     BlockDataAlloc (heap)
00651 
00664 #define FreeClipRect(heap, cr)  BlockDataFree (heap, cr);
00665 
00677 #define DestroyFreeClipRectList(heap)   DestroyBlockDataHeap (heap);
00678 
00699 MG_EXPORT void GUIAPI InitClipRgn (PCLIPRGN pRgn, PBLOCKHEAP pFreeList);
00700 
00711 MG_EXPORT void GUIAPI EmptyClipRgn (PCLIPRGN pRgn);
00712 
00722 MG_EXPORT PCLIPRGN GUIAPI CreateClipRgn (void);
00723 
00734 MG_EXPORT void GUIAPI DestroyClipRgn (PCLIPRGN pRgn);
00735 
00752 MG_EXPORT BOOL GUIAPI ClipRgnCopy (PCLIPRGN pDstRgn, const CLIPRGN* pSrcRgn);
00753 
00774 MG_EXPORT BOOL GUIAPI ClipRgnIntersect (PCLIPRGN pRstRgn,
00775                        const CLIPRGN* pRgn1, const CLIPRGN* pRgn2);
00776 
00789 MG_EXPORT void GUIAPI GetClipRgnBoundRect (PCLIPRGN pRgn, PRECT pRect);
00790 
00807 MG_EXPORT BOOL GUIAPI SetClipRgn (PCLIPRGN pRgn, const RECT* pRect);
00808 
00822 MG_EXPORT BOOL GUIAPI IsEmptyClipRgn (const CLIPRGN* pRgn);
00823 
00837 MG_EXPORT BOOL GUIAPI AddClipRect (PCLIPRGN pRgn, const RECT* pRect);
00838 
00853 MG_EXPORT BOOL GUIAPI IntersectClipRect (PCLIPRGN pRgn, const RECT* pRect);
00854 
00869 MG_EXPORT BOOL GUIAPI SubtractClipRect (PCLIPRGN pRgn, const RECT* pRect);
00870 
00886 MG_EXPORT BOOL GUIAPI PtInRegion (PCLIPRGN region, int x, int y);
00887 
00902 MG_EXPORT BOOL GUIAPI RectInRegion (PCLIPRGN region, const RECT* rect);
00903 
00915 MG_EXPORT void GUIAPI OffsetRegion (PCLIPRGN region, int x, int y);
00916 
00917 #ifdef _USE_NEWGAL
00918 
00937 MG_EXPORT BOOL GUIAPI UnionRegion (PCLIPRGN dst, 
00938                 const CLIPRGN* src1, const CLIPRGN* src2);
00939 
00957 MG_EXPORT BOOL GUIAPI SubtractRegion (CLIPRGN* rgnD, 
00958                 const CLIPRGN* rgnM, const CLIPRGN* rgnS);
00959 
00978 MG_EXPORT BOOL GUIAPI XorRegion (CLIPRGN *dst, 
00979                 const CLIPRGN *src1, const CLIPRGN *src2);
00980 
00986 #define UnionRectWithRegion     AddClipRect
00987 
00993 #define CopyRegion              ClipRgnCopy
00994 
01000 #define IntersectRegion         ClipRgnIntersect
01001 
01017 MG_EXPORT BOOL GUIAPI InitCircleRegion (PCLIPRGN dst, int x, int y, int r);
01018 
01035 MG_EXPORT BOOL GUIAPI InitEllipseRegion (PCLIPRGN dst, 
01036                 int x, int y, int rx, int ry);
01037 
01052 MG_EXPORT BOOL GUIAPI InitPolygonRegion (PCLIPRGN dst, 
01053                 const POINT* pts, int vertices);
01054 
01055 #endif
01056 
01102 #define HDC_SCREEN          0
01103 
01108 #define HDC_INVALID         0
01109 
01110 #define GDCAP_COLORNUM      0
01111 #define GDCAP_HPIXEL        1
01112 #define GDCAP_VPIXEL        2
01113 #define GDCAP_MAXX          3
01114 #define GDCAP_MAXY          4
01115 #define GDCAP_DEPTH         5
01116 #define GDCAP_BPP           6
01117 #define GDCAP_BITSPP        7
01118 #define GDCAP_RMASK         8
01119 #define GDCAP_GMASK         9
01120 #define GDCAP_BMASK         10
01121 
01163 MG_EXPORT unsigned int GUIAPI GetGDCapability (HDC hdc, int iItem);
01164 
01182 MG_EXPORT HDC GUIAPI GetDC (HWND hwnd);
01183 
01201 MG_EXPORT HDC GUIAPI GetClientDC (HWND hwnd);
01202 
01213 MG_EXPORT void GUIAPI ReleaseDC (HDC hdc);
01214 
01233 MG_EXPORT HDC GUIAPI CreatePrivateDC (HWND hwnd);
01234 
01254 MG_EXPORT HDC GUIAPI CreatePrivateClientDC (HWND hwnd);
01255 
01277 MG_EXPORT HDC GUIAPI GetPrivateClientDC (HWND hwnd);
01278 
01288 MG_EXPORT void GUIAPI DeletePrivateDC (HDC hdc);
01289 
01290 #ifdef _USE_NEWGAL
01291 
01292 #define MEMDC_FLAG_NONE         0x00000000  /* None. */
01293 #define MEMDC_FLAG_SWSURFACE    0x00000000  /* DC is in system memory */
01294 #define MEMDC_FLAG_HWSURFACE    0x00000001  /* DC is in video memory */
01295 #define MEMDC_FLAG_SRCCOLORKEY  0x00001000  /* Blit uses a source color key */
01296 #define MEMDC_FLAG_SRCALPHA     0x00010000  /* Blit uses source alpha blending*/
01297 #define MEMDC_FLAG_RLEACCEL     0x00004000  /* Surface is RLE encoded */
01298 
01320 MG_EXPORT HDC GUIAPI CreateCompatibleDCEx (HDC hdc, int width, int height);
01321 
01357 MG_EXPORT HDC GUIAPI CreateMemDC (int width, int height, int depth, DWORD flags,
01358                 Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
01359 
01377 MG_EXPORT HDC GUIAPI CreateMemDCFromBitmap (HDC hdc, BITMAP* bmp);
01378 
01399 MG_EXPORT HDC GUIAPI CreateMemDCFromMyBitmap (const MYBITMAP* my_bmp, RGB* pal);
01400 
01426 MG_EXPORT BOOL GUIAPI ConvertMemDC (HDC mem_dc, HDC ref_dc, DWORD flags);
01427 
01457 MG_EXPORT BOOL GUIAPI SetMemDCAlpha (HDC mem_dc, DWORD flags, Uint8 alpha);
01458 
01480 MG_EXPORT BOOL GUIAPI SetMemDCColorKey (HDC mem_dc, DWORD flags, 
01481                 Uint32 color_key);
01482 
01497 MG_EXPORT void GUIAPI DeleteMemDC (HDC mem_dc);
01498 
01515 #define CreateCompatibleDC(hdc) CreateCompatibleDCEx(hdc, 0, 0);
01516 
01531 #define DeleteCompatibleDC(hdc) DeleteMemDC(hdc)
01532 
01572 MG_EXPORT Uint8* GUIAPI LockDC (HDC hdc, const RECT* rw_rc, 
01573                 int* width, int* height, int* pitch);
01574 
01585 MG_EXPORT void GUIAPI UnlockDC (HDC hdc);
01586 
01601 #define GAL_YV12_OVERLAY  0x32315659    /* Planar mode: Y + V + U  (3 planes) */
01602 #define GAL_IYUV_OVERLAY  0x56555949    /* Planar mode: Y + U + V  (3 planes) */
01603 #define GAL_YUY2_OVERLAY  0x32595559    /* Packed mode: Y0+U0+Y1+V0 (1 plane) */
01604 #define GAL_UYVY_OVERLAY  0x59565955    /* Packed mode: U0+Y0+V0+Y1 (1 plane) */
01605 #define GAL_YVYU_OVERLAY  0x55595659    /* Packed mode: Y0+V0+Y1+U0 (1 plane) */
01606 
01610 typedef struct _GAL_Overlay {
01612     Uint32 format;
01614     int w;
01616     int h;
01618     int planes;
01620     Uint16 *pitches;
01622     Uint8 **pixels;
01623 
01625     struct private_yuvhwfuncs *hwfuncs;
01627     struct private_yuvhwdata *hwdata;
01628 
01630     Uint32 hw_overlay :1;
01631     Uint32 UnusedBits :31;
01632 } GAL_Overlay;
01633 
01669 MG_EXPORT GAL_Overlay* GUIAPI CreateYUVOverlay (int width, int height,
01670                 Uint32 format, HDC hdc);
01671 
01680 int GAL_LockYUVOverlay (GAL_Overlay *overlay);
01681 
01690 void GAL_UnlockYUVOverlay (GAL_Overlay *overlay);
01691 
01697 #define LockYUVOverlay GAL_LockYUVOverlay
01698 
01704 #define UnlockYUVOverlay GAL_UnlockYUVOverlay
01705 
01718 void GAL_FreeYUVOverlay (GAL_Overlay *overlay);
01719 
01725 #define FreeYUVOverlay GAL_FreeYUVOverlay
01726 
01745 MG_EXPORT void GUIAPI DisplayYUVOverlay (GAL_Overlay* overlay, 
01746                 const RECT* dstrect);
01747 
01773 int GAL_SetGamma (float red, float green, float blue);
01774 
01780 #define SetGamma GAL_SetGamma
01781 
01807 int GAL_SetGammaRamp (Uint16 *red, Uint16 *green, Uint16 *blue);
01808 
01814 #define SetGammaRamp GAL_SetGammaRamp
01815 
01839 int GAL_GetGammaRamp (Uint16 *red, Uint16 *green, Uint16 *blue);
01840 
01846 #define GetGammaRamp GAL_GetGammaRamp
01847 
01850 #else
01851 
01852 MG_EXPORT HDC GUIAPI CreateCompatibleDC (HDC hdc);
01853 MG_EXPORT void GUIAPI DeleteCompatibleDC (HDC hdc);
01854 
01855 #endif /* _USE_NEWGAL */
01856 
01864 #define BM_TRANSPARENT          1
01865 #define BM_OPAQUE               0
01866 
01867 #ifdef _USE_NEWGAL
01868 
01869 #define DC_ATTR_BK_COLOR        0
01870 #define DC_ATTR_BK_MODE         1
01871 #define DC_ATTR_PEN_COLOR       2
01872 #define DC_ATTR_BRUSH_COLOR     3
01873 #define DC_ATTR_TEXT_COLOR      4
01874 #define DC_ATTR_TAB_STOP        5
01875 
01876 #define DC_ATTR_CHAR_EXTRA      6
01877 #define DC_ATTR_ALINE_EXTRA     7
01878 #define DC_ATTR_BLINE_EXTRA     8
01879 
01880 #define DC_ATTR_MAP_MODE        9
01881 
01882 #ifdef _ADV_2DAPI
01883 
01884 #define DC_ATTR_PEN_TYPE        10
01885 #define DC_ATTR_PEN_CAP_STYLE   11
01886 #define DC_ATTR_PEN_JOIN_STYLE  12
01887 #define DC_ATTR_PEN_WIDTH       13
01888 
01889 #define DC_ATTR_BRUSH_TYPE      14
01890 
01891 #define NR_DC_ATTRS             15
01892 
01893 #else
01894 
01895 #define NR_DC_ATTRS             10
01896 
01897 #endif
01898 
01899 
01936 MG_EXPORT Uint32 GUIAPI GetDCAttr (HDC hdc, int attr);
01937 
01953 MG_EXPORT Uint32 GUIAPI SetDCAttr (HDC hdc, int attr, Uint32 value);
01954 
01968 #define GetBkColor(hdc)     (gal_pixel) GetDCAttr (hdc, DC_ATTR_BK_COLOR)
01969 
01989 #define GetBkMode(hdc)      (int)       GetDCAttr (hdc, DC_ATTR_BK_MODE)
01990 
02004 #define GetPenColor(hdc)    (gal_pixel) GetDCAttr (hdc, DC_ATTR_PEN_COLOR)
02005 
02019 #define GetBrushColor(hdc)  (gal_pixel) GetDCAttr (hdc, DC_ATTR_BRUSH_COLOR)
02020 
02034 #define GetTextColor(hdc)   (gal_pixel) GetDCAttr (hdc, DC_ATTR_TEXT_COLOR)
02035 
02049 #define GetTabStop(hdc)     (int) GetDCAttr (hdc, DC_ATTR_TAB_STOP)
02050 
02065 #define SetBkColor(hdc, color)  \
02066                 (gal_pixel) SetDCAttr (hdc, DC_ATTR_BK_COLOR, (DWORD) color)
02067 
02089 #define SetBkMode(hdc, mode)    \
02090                 (int) SetDCAttr (hdc, DC_ATTR_BK_MODE, (DWORD) mode)
02091 
02106 #define SetPenColor(hdc, color) \
02107                 (gal_pixel) SetDCAttr (hdc, DC_ATTR_PEN_COLOR, (DWORD) color)
02108 
02123 #define SetBrushColor(hdc, color)   \
02124                 (gal_pixel) SetDCAttr (hdc, DC_ATTR_BRUSH_COLOR, (DWORD) color)
02125 
02140 #define SetTextColor(hdc, color)    \
02141                 (gal_pixel) SetDCAttr (hdc, DC_ATTR_TEXT_COLOR, (DWORD) color)
02142 
02157 #define SetTabStop(hdc, value)  \
02158                 (int) SetDCAttr (hdc, DC_ATTR_TAB_STOP, (DWORD) value)
02159 
02160 #define ROP_SET         0
02161 #define ROP_AND         1
02162 #define ROP_OR          2
02163 #define ROP_XOR         3
02164 
02187 MG_EXPORT int GUIAPI GetRasterOperation (HDC hdc);
02188 
02214 MG_EXPORT int GUIAPI SetRasterOperation (HDC hdc, int rop);
02215 
02216 #else
02217 
02218 MG_EXPORT gal_pixel GUIAPI GetBkColor (HDC hdc);
02219 MG_EXPORT int GUIAPI GetBkMode (HDC hdc);
02220 MG_EXPORT gal_pixel GUIAPI GetTextColor (HDC hdc);
02221 MG_EXPORT gal_pixel GUIAPI SetBkColor (HDC hdc, gal_pixel color);
02222 MG_EXPORT int GUIAPI SetBkMode (HDC hdc, int bkmode);
02223 MG_EXPORT gal_pixel GUIAPI SetTextColor (HDC hdc, gal_pixel color);
02224 
02225 MG_EXPORT int GUIAPI GetTabStop (HDC hdc);
02226 MG_EXPORT int GUIAPI SetTabStop (HDC hdc, int new_value);
02227 
02228 /* Pen and brush support */
02229 MG_EXPORT gal_pixel GUIAPI GetPenColor (HDC hdc);
02230 MG_EXPORT gal_pixel GUIAPI GetBrushColor (HDC hdc);
02231 MG_EXPORT gal_pixel GUIAPI SetPenColor (HDC hdc, gal_pixel color);
02232 MG_EXPORT gal_pixel GUIAPI SetBrushColor (HDC hdc, gal_pixel color);
02233 
02234 #endif /* _USE_NEWGAL */
02235 
02243 #ifdef _USE_NEWGAL
02244 
02260 MG_EXPORT BOOL GUIAPI GetPalette (HDC hdc, int start, int len, GAL_Color* cmap);
02261 
02276 MG_EXPORT BOOL GUIAPI SetPalette (HDC hdc, int start, int len, GAL_Color* cmap);
02277 
02289 MG_EXPORT BOOL GUIAPI SetColorfulPalette (HDC hdc);
02290 
02304 MG_EXPORT HPALETTE GUIAPI CreatePalette (GAL_Palette* pal);
02305 
02314 MG_EXPORT HPALETTE GUIAPI GetDefaultPalette (void);
02315 
02332 int GUIAPI GetPaletteEntries (HPALETTE hpal, 
02333                 int start, int len, GAL_Color* cmap);
02334 
02335 #else
02336 
02337 MG_EXPORT int GUIAPI GetPalette (HDC hdc, int start, int len, GAL_Color* cmap);
02338 MG_EXPORT int GUIAPI SetPalette (HDC hdc, int start, int len, GAL_Color* cmap);
02339 MG_EXPORT int GUIAPI SetColorfulPalette (HDC hdc);
02340 
02341 #endif /* _USE_NEWGAL */
02342 
02350 #ifdef _USE_NEWGAL
02351 
02368 MG_EXPORT void GUIAPI SetPixel (HDC hdc, int x, int y, gal_pixel pixel);
02369 
02388 MG_EXPORT gal_pixel GUIAPI SetPixelRGB (HDC hdc, int x, int y, 
02389                 Uint8 r, Uint8 g, Uint8 b);
02390 
02413 MG_EXPORT gal_pixel GUIAPI SetPixelRGBA (HDC hdc, int x, int y, 
02414                 Uint8 r, Uint8 g, Uint8 b, Uint8 a);
02415 
02431 MG_EXPORT gal_pixel GUIAPI GetPixel (HDC hdc, int x, int y);
02432 
02454 MG_EXPORT gal_pixel GUIAPI GetPixelRGB (HDC hdc, int x, int y, 
02455                 Uint8* r, Uint8* g, Uint8* b);
02456 
02482 MG_EXPORT gal_pixel GUIAPI GetPixelRGBA (HDC hdc, int x, int y, 
02483                 Uint8* r, Uint8* g, Uint8* b, Uint8* a);
02484 
02503 MG_EXPORT gal_pixel GUIAPI RGBA2Pixel (HDC hdc, 
02504                 Uint8 r, Uint8 g, Uint8 b, Uint8 a);
02505 
02521 MG_EXPORT gal_pixel GUIAPI RGB2Pixel (HDC hdc, Uint8 r, Uint8 g, Uint8 b);
02522 
02544 MG_EXPORT void GUIAPI Pixel2RGB (HDC hdc, gal_pixel pixel, 
02545                 Uint8* r, Uint8* g, Uint8* b);
02546 
02570 MG_EXPORT void GUIAPI Pixel2RGBA (HDC hdc, gal_pixel pixel, 
02571                 Uint8* r, Uint8* g, Uint8* b, Uint8* a);
02572 
02573 #else
02574 
02575 MG_EXPORT void GUIAPI SetPixel (HDC hdc, int x, int y, gal_pixel c);
02576 MG_EXPORT void GUIAPI SetPixelRGB (HDC hdc, int x, int y, int r, int g, int b);
02577 MG_EXPORT gal_pixel GUIAPI GetPixel (HDC hdc, int x, int y);
02578 MG_EXPORT void GUIAPI GetPixelRGB (HDC hdc, int x, int y, int* r, int* g, int* b);
02579 MG_EXPORT gal_pixel GUIAPI RGB2Pixel (HDC hdc, int r, int g, int b);
02580 
02581 #endif /* USE_NEWGAL */
02582 
02600 MG_EXPORT void GUIAPI FocusRect (HDC hdc, int x0, int y0, int x1, int y1);
02601 
02619 MG_EXPORT void GUIAPI DrawHVDotLine (HDC hdc, int x, int y, int w_h, BOOL H_V);
02620 
02637 #define DrawHDotLine(hdc, x, y, w) DrawHVDotLine (hdc, x, y, w, TRUE);
02638 
02655 #define DrawVDotLine(hdc, x, y, h) DrawHVDotLine (hdc, x, y, h, FALSE);
02656 
02657 #ifdef _USE_NEWGAL
02658 
02690 MG_EXPORT BOOL GUIAPI LineClipper (const RECT* cliprc, 
02691                 int *_x0, int *_y0, int *_x1, int *_y1);
02692 
02697 typedef void (* CB_LINE) (void* context, int stepx, int stepy);
02698 
02723 MG_EXPORT void GUIAPI LineGenerator (void* context, 
02724                 int x1, int y1, int x2, int y2, CB_LINE cb);
02725 
02730 typedef void (* CB_CIRCLE) (void* context, int x1, int x2, int y);
02731 
02761 MG_EXPORT void GUIAPI CircleGenerator (void* context, 
02762                 int sx, int sy, int r, CB_CIRCLE cb);
02763 
02768 typedef void (* CB_ELLIPSE) (void* context, int x1, int x2, int y);
02769 
02796 MG_EXPORT void GUIAPI EllipseGenerator (void* context, 
02797                 int sx, int sy, int rx, int ry, CB_ELLIPSE cb);
02798 
02803 typedef void (* CB_ARC) (void* context, int x, int y);
02804 
02830 MG_EXPORT void GUIAPI CircleArcGenerator (void* context, 
02831                 int sx, int sy, int r, int ang1, int ang2, CB_ARC cb);
02832 
02837 typedef void (* CB_POLYGON) (void* context, int x1, int x2, int y);
02838 
02879 MG_EXPORT BOOL GUIAPI MonotoneVerticalPolygonGenerator (void* context, 
02880                 const POINT* pts, int vertices, CB_POLYGON cb);
02881 
02898 MG_EXPORT BOOL GUIAPI PolygonIsMonotoneVertical (const POINT* pts, 
02899                 int vertices);
02900 
02928 MG_EXPORT BOOL GUIAPI PolygonGenerator (void* context, 
02929                 const POINT* pts, int vertices, CB_POLYGON cb);
02930 
02935 typedef BOOL (* CB_EQUAL_PIXEL) (void* context, int x, int y);
02936 
02941 typedef void (* CB_FLOOD_FILL) (void* context, int x1, int x2, int y);
02942 
02965 MG_EXPORT BOOL GUIAPI FloodFillGenerator (void* context, 
02966                 const RECT* src_rc, int x, int y, 
02967                 CB_EQUAL_PIXEL cb_equal_pixel, CB_FLOOD_FILL cb_flood_fill);
02968 
02973 typedef void* (* CB_GET_LINE_BUFF) (void* context, int y);
02974 
02979 typedef void (* CB_LINE_SCALED) (void* context, const void* line, int y);
02980 
03006 MG_EXPORT BOOL GUIAPI BitmapDDAScaler (void* context, 
03007                 const BITMAP* src_bmp, int dst_w, int dst_h, 
03008                 CB_GET_LINE_BUFF cb_get_line_buff, 
03009                 CB_LINE_SCALED cb_line_scaled);
03010 
03035 MG_EXPORT BOOL GUIAPI BitmapDDAScaler2 (void* context, 
03036                 const BITMAP* src_bmp, int dst_w, int dst_h, 
03037                 CB_GET_LINE_BUFF cb_get_line_buff, 
03038                 CB_LINE_SCALED cb_line_scaled);
03039 
03053 MG_EXPORT void GUIAPI MoveTo (HDC hdc, int x, int y);
03054 
03069 MG_EXPORT void GUIAPI LineTo (HDC hdc, int x, int y);
03070 
03086 MG_EXPORT void GUIAPI Rectangle (HDC hdc, int x0, int y0, int x1, int y1);
03087 
03102 MG_EXPORT void GUIAPI PolyLineTo (HDC hdc, const POINT* pts, int vertices);
03103 
03120 MG_EXPORT void GUIAPI SplineTo (HDC hdc, const POINT* pts);
03121 
03136 MG_EXPORT void GUIAPI Circle (HDC hdc, int sx, int sy, int r);
03137 
03156 MG_EXPORT void GUIAPI Ellipse (HDC hdc, int sx, int sy, int rx, int ry);
03157 
03181 MG_EXPORT void GUIAPI CircleArc (HDC hdc, int sx, int sy, int r, 
03182                 int ang1, int ang2);
03183 
03198 MG_EXPORT void GUIAPI FillBox (HDC hdc, int x, int y, int w, int h);
03199 
03215 MG_EXPORT void GUIAPI FillCircle (HDC hdc, int sx, int sy, int r);
03216 
03235 MG_EXPORT void GUIAPI FillEllipse (HDC hdc, int sx, int sy, int rx, int ry);
03236 
03252 MG_EXPORT BOOL GUIAPI FillPolygon (HDC hdc, const POINT* pts, int vertices);
03253 
03269 MG_EXPORT BOOL GUIAPI FloodFill (HDC hdc, int x, int y);
03270 
03271 #ifdef _ADV_2DAPI
03272 
03281 typedef enum
03282 {
03287   PT_SOLID,
03292   PT_ON_OFF_DASH,
03299   PT_DOUBLE_DASH,
03300 } PenType;
03301 
03313 #define GetPenType(hdc)                 \
03314                 (PenType) GetDCAttr (hdc, DC_ATTR_PEN_TYPE)
03315 
03328 #define SetPenType(hdc, type)           \
03329                 (PenType) SetDCAttr (hdc, DC_ATTR_PEN_TYPE, (DWORD) type)
03330 
03350 MG_EXPORT void GUIAPI SetPenDashes (HDC hdc, int dash_offset, 
03351                 const unsigned char* dash_list, int n);
03352 
03356 typedef enum
03357 {
03362   PT_CAP_BUTT,
03367   PT_CAP_ROUND,
03372   PT_CAP_PROJECTING
03373 } PTCapStyle;
03374 
03386 #define GetPenCapStyle(hdc)                 \
03387                 (PTCapStyle) GetDCAttr (hdc, DC_ATTR_PEN_CAP_STYLE)
03388 
03401 #define SetPenCapStyle(hdc, style)          \
03402             (PTCapStyle) SetDCAttr (hdc, DC_ATTR_PEN_CAP_STYLE, (DWORD) style)
03403 
03407 typedef enum
03408 {
03412   PT_JOIN_MITER,
03416   PT_JOIN_ROUND,
03421   PT_JOIN_BEVEL
03422 } PTJoinStyle;
03423 
03435 #define GetPenJoinStyle(hdc)           (PTJoinStyle) GetDCAttr (hdc, DC_ATTR_PEN_JOIN_STYLE)
03436 
03449 #define SetPenJoinStyle(hdc, style)         \
03450             (PTJoinStyle) SetDCAttr (hdc, DC_ATTR_PEN_JOIN_STYLE, (DWORD) style)
03451 
03463 #define GetPenWidth(hdc)                    \
03464                 (unsigned int) GetDCAttr (hdc, DC_ATTR_PEN_WIDTH)
03465 
03478 #define SetPenWidth(hdc, width)             \
03479                 (unsigned int) SetDCAttr (hdc, DC_ATTR_PEN_WIDTH, (DWORD) width)
03480 
03488 typedef enum
03489 {
03493   BT_SOLID,
03497   BT_TILED,
03504   BT_STIPPLED,
03511   BT_OPAQUE_STIPPLED
03512 } BrushType;
03513 
03525 #define GetBrushType(hdc)               \
03526                 (BrushType) GetDCAttr (hdc, DC_ATTR_BRUSH_TYPE)
03527 
03540 #define SetBrushType(hdc, type)         \
03541                 (BrushType) SetDCAttr (hdc, DC_ATTR_BRUSH_TYPE, (DWORD) type)
03542 
03544 typedef struct _STIPPLE
03545 {
03547     int width;
03549     int height;
03550 
03552     int pitch;
03553 
03555     size_t size;
03556 
03558     const unsigned char* bits;
03559 } STIPPLE;
03560 
03572 MG_EXPORT void GUIAPI SetBrushInfo (HDC hdc, 
03573                 const BITMAP* tile, const STIPPLE* stipple);
03574 
03589 MG_EXPORT void GUIAPI SetBrushOrigin (HDC hdc, int x, int y);
03590 
03610 MG_EXPORT void GUIAPI LineEx (HDC hdc, int x1, int y1, int x2, int y2);
03611 
03637 MG_EXPORT void GUIAPI ArcEx (HDC hdc, int x, int y, int width, int height, 
03638                 int ang1, int ang2);
03639 
03663 MG_EXPORT void GUIAPI FillArcEx (HDC hdc, int x, int y, int width, int height, 
03664                 int ang1, int ang2);
03665 
03678 MG_EXPORT void GUIAPI PolyLineEx (HDC hdc, const POINT* pts, int nr_pts);
03679 
03683 typedef struct _ARC
03684 {
03686     int x;
03688     int y;
03689 
03691     int width;
03693     int height;
03694 
03699     int angle1;
03703     int angle2;
03704 } ARC;
03705 
03718 MG_EXPORT void GUIAPI PolyArcEx (HDC hdc, const ARC* arcs, int nr_arcs);
03719 
03732 MG_EXPORT void GUIAPI PolyFillArcEx (HDC hdc, const ARC* arcs, int nr_arcs);
03733 
03752 MG_EXPORT BOOL GUIAPI RoundRect (HDC hdc, int x0, int y0, int x1, int y1, int cw, int ch);
03753 
03757 #endif
03758 
03759 #else
03760 
03761 /* Old GDI drawing functions */
03762 MG_EXPORT void GUIAPI MoveTo (HDC hdc, int x, int y);
03763 MG_EXPORT void GUIAPI LineTo (HDC hdc, int x, int y);
03764 MG_EXPORT void GUIAPI Rectangle (HDC hdc, int x0, int y0, int x1, int y1);
03765 MG_EXPORT void GUIAPI PolyLineTo (HDC hdc, const POINT* pts, int vertices);
03766 MG_EXPORT void GUIAPI Circle (HDC hdc, int sx, int sy, int r);
03767 MG_EXPORT void GUIAPI FillBox (HDC hdc, int x, int y, int w, int h);
03768 
03769 #endif
03770 
03816 #define MM_TEXT               0
03817 #define MM_ANISOTROPIC        1
03818 
03819 #ifdef _USE_NEWGAL
03820 
03840 #define GetMapMode(hdc)         (int)GetDCAttr (hdc, DC_ATTR_MAP_MODE)
03841 
03861 #define SetMapMode(hdc, mapmode)        \
03862                 (int)SetDCAttr (hdc, DC_ATTR_MAP_MODE, (DWORD)mapmode)
03863 
03864 #else
03865 
03866 MG_EXPORT int GUIAPI GetMapMode (HDC hdc);
03867 MG_EXPORT void GUIAPI SetMapMode (HDC hdc, int mapmode);
03868 
03869 #endif /* _USE_NEWGAL */
03870 
03871 #ifdef _USE_NEWGAL
03872 
03899 MG_EXPORT void GUIAPI GetDCLCS (HDC hdc, int which, POINT* pt);
03900 
03927 MG_EXPORT void GUIAPI SetDCLCS (HDC hdc, int which, const POINT* pt);
03928 
03929 #define DC_LCS_VORG     0
03930 #define DC_LCS_VEXT     1
03931 #define DC_LCS_WORG     2
03932 #define DC_LCS_WEXT     3
03933 #define NR_DC_LCS_PTS   4
03934 
03952 #define GetViewportOrg(hdc, pPt)    GetDCLCS(hdc, DC_LCS_VORG, pPt)
03953 
03971 #define GetViewportExt(hdc, pPt)    GetDCLCS(hdc, DC_LCS_VEXT, pPt)
03972 
03990 #define GetWindowOrg(hdc, pPt)      GetDCLCS(hdc, DC_LCS_WORG, pPt)
03991 
04009 #define GetWindowExt(hdc, pPt)      GetDCLCS(hdc, DC_LCS_WEXT, pPt)
04010 
04028 #define SetViewportOrg(hdc, pPt)    SetDCLCS(hdc, DC_LCS_VORG, pPt)
04029 
04047 #define SetViewportExt(hdc, pPt)    SetDCLCS(hdc, DC_LCS_VEXT, pPt)
04048 
04066 #define SetWindowOrg(hdc, pPt)      SetDCLCS(hdc, DC_LCS_WORG, pPt)
04067 
04085 #define SetWindowExt(hdc, pPt)      SetDCLCS(hdc, DC_LCS_WEXT, pPt)
04086 
04087 #else
04088 
04089 MG_EXPORT void GUIAPI GetViewportExt (HDC hdc, POINT* pPt);
04090 MG_EXPORT void GUIAPI GetViewportOrg (HDC hdc, POINT* pPt);
04091 MG_EXPORT void GUIAPI GetWindowExt (HDC hdc, POINT* pPt);
04092 MG_EXPORT void GUIAPI GetWindowOrg (HDC hdc, POINT* pPt);
04093 MG_EXPORT void GUIAPI SetViewportExt (HDC hdc, POINT* pPt);
04094 MG_EXPORT void GUIAPI SetViewportOrg (HDC hdc, POINT* pPt);
04095 MG_EXPORT void GUIAPI SetWindowExt (HDC hdc, POINT* pPt);
04096 MG_EXPORT void GUIAPI SetWindowOrg (HDC hdc, POINT* pPt);
04097 
04098 #endif /* _USE_NEWGAL */
04099 
04118 MG_EXPORT void GUIAPI DPtoLP (HDC hdc, POINT* pPt);
04119 
04138 MG_EXPORT void GUIAPI LPtoDP (HDC hdc, POINT* pPt);
04139 
04160 MG_EXPORT void GUIAPI ExcludeClipRect (HDC hdc, const RECT* prc);
04161 
04175 MG_EXPORT void GUIAPI IncludeClipRect (HDC hdc, const RECT* prc);
04176 
04192 MG_EXPORT BOOL GUIAPI PtVisible (HDC hdc, int x, int y);
04193 
04206 MG_EXPORT void GUIAPI ClipRectIntersect (HDC hdc, const RECT* prc);
04207 
04220 MG_EXPORT void GUIAPI SelectClipRect (HDC hdc, const RECT* prc);
04221 
04234 MG_EXPORT void GUIAPI SelectClipRegion (HDC hdc, const CLIPRGN* pRgn);
04235 
04248 MG_EXPORT void GUIAPI GetBoundsRect (HDC hdc, RECT* pRect);
04249 
04267 MG_EXPORT BOOL GUIAPI RectVisible (HDC hdc, const RECT* pRect);
04268 
04281 #ifdef _USE_NEWGAL
04282 
04309 MG_EXPORT BOOL GUIAPI GetBitmapFromDC (HDC hdc, 
04310                 int x, int y, int w, int h, BITMAP* bmp);
04311 
04312 #else
04313 
04314 MG_EXPORT void GUIAPI SaveScreenBox (int x, int y, int w, int h, void* vbuf);
04315 MG_EXPORT void* GUIAPI SaveCoveredScreenBox (int x, int y, int w, int h);
04316 MG_EXPORT void GUIAPI PutSavedBoxOnScreen (int x, int y, int w, int h, void* vbuf);
04317 MG_EXPORT void GUIAPI PutSavedBoxOnDC (HDC hdc, int x, int y, int w, int h, void* vbuf);
04318 
04319 MG_EXPORT void GUIAPI ScreenCopy (int sx, int sy, HDC hdc, int dx, int dy);
04320 
04321 #endif /* _USE_NEWGAL */
04322 
04361 MG_EXPORT BOOL GUIAPI FillBoxWithBitmap (HDC hdc, int x, int y, int w, int h,
04362                 const BITMAP *bmp);
04363 
04411 MG_EXPORT BOOL GUIAPI FillBoxWithBitmapPart (HDC hdc, 
04412                 int x, int y, int w, int h,
04413                 int bw, int bh, const BITMAP* bmp, int xo, int yo);
04414 
04449 MG_EXPORT void GUIAPI BitBlt (HDC hsdc, int sx, int sy, int sw, int sh, 
04450                 HDC hddc, int dx, int dy, DWORD dwRop);
04451 
04488 MG_EXPORT void GUIAPI StretchBlt (HDC hsdc, int sx, int sy, int sw, int sh, 
04489                 HDC hddc, int dx, int dy, int dw, int dh, DWORD dwRop);
04490 
04508 MG_EXPORT BOOL GUIAPI ScaleBitmap (BITMAP* dst, const BITMAP* src);
04509 
04529 MG_EXPORT gal_pixel GUIAPI GetPixelInBitmap (const BITMAP* bmp, int x, int y);
04530 
04553 MG_EXPORT BOOL GUIAPI SetPixelInBitmap (const BITMAP* bmp, 
04554                 int x, int y, gal_pixel pixel);
04555 
04556 #ifdef _MISC_SAVESCREEN
04557 
04576 MG_EXPORT BOOL GUIAPI SaveScreenRectContent (const RECT* rcWin, 
04577                 const char* filename);
04578 
04596 MG_EXPORT BOOL GUIAPI SaveMainWindowContent (HWND hWnd, const char* filename);
04597 #endif
04598 
04623 MG_EXPORT HICON GUIAPI LoadIconFromFile (HDC hdc, const char* filename, 
04624                 int which);
04625 
04644 MG_EXPORT HICON GUIAPI LoadIconFromMem (HDC hdc, const void* area, int which);
04645 
04670 MG_EXPORT HICON GUIAPI CreateIconEx (HDC hdc, int w, int h, 
04671                 const BYTE* AndBits, const BYTE* XorBits, int colornum, 
04672                 const RGB* pal);
04677 #define CreateIcon(hdc, w, h, AndBits, XorBits, colornum) \
04678         CreateIconEx(hdc, w, h, AndBits, XorBits, colornum, NULL)
04679 
04680 
04692 MG_EXPORT BOOL GUIAPI DestroyIcon (HICON hicon);
04693 
04707 MG_EXPORT BOOL GUIAPI GetIconSize (HICON hicon, int* w, int* h);
04708 
04726 MG_EXPORT void GUIAPI DrawIcon (HDC hdc, 
04727                 int x, int y, int w, int h, HICON hicon);
04728 
04736 #ifdef _USE_NEWGAL
04737 
04754 static inline void SetRect (RECT* prc, int left, int top, int right, int bottom)
04755 {
04756     (prc)->left = left; (prc)->top = top; 
04757     (prc)->right = right; (prc)->bottom = bottom;
04758 }
04759 
04775 static inline void SetRectEmpty (RECT* prc)
04776 {
04777     (prc)->left = (prc)->top = (prc)->right = (prc)->bottom = 0;
04778 }
04779 
04794 static inline void CopyRect (RECT* pdrc, const RECT* psrc)
04795 {
04796     (pdrc)->left = (psrc)->left; (pdrc)->top = (psrc)->top;
04797     (pdrc)->right = (psrc)->right; (pdrc)->bottom = (psrc)->bottom;
04798 }
04799 
04817 static inline void OffsetRect (RECT* prc, int x, int y)
04818 {
04819     (prc)->left += x; (prc)->top += y; (prc)->right += x; (prc)->bottom += y;
04820 }
04821 
04840 static inline void InflateRect (RECT* prc, int cx, int cy)
04841 {
04842     (prc)->left -= cx; (prc)->top -= cy; 
04843     (prc)->right += cx; (prc)->bottom += cy;
04844 }
04845 
04861 static inline void InflateRectToPt (RECT* prc, int x, int y)
04862 {
04863     if ((x) < (prc)->left) (prc)->left = (x); 
04864     if ((y) < (prc)->top) (prc)->top = (y);
04865     if ((x) > (prc)->right) (prc)->right = (x);
04866     if ((y) > (prc)->bottom) (prc)->bottom = (y);
04867 }
04868 
04886 static inline BOOL PtInRect(const RECT* prc, int x, int y)
04887 {
04888     if (x >= prc->left && x < prc->right && y >= prc->top && y < prc->bottom)
04889         return TRUE;
04890     return FALSE;
04891 }
04892 
04893 #else
04894 
04895 MG_EXPORT void GUIAPI SetRect (RECT* prc, int left, int top, 
04896                 int right, int bottom);
04897 MG_EXPORT void GUIAPI SetRectEmpty (RECT* prc);
04898 MG_EXPORT void GUIAPI CopyRect (RECT* pdrc, const RECT* psrc);
04899 MG_EXPORT void GUIAPI OffsetRect (RECT* prc, int x, int y);
04900 MG_EXPORT void GUIAPI InflateRect (RECT* prc, int cx, int cy);
04901 MG_EXPORT void GUIAPI InflateRectToPt (RECT* prc, int x, int y);
04902 MG_EXPORT BOOL GUIAPI PtInRect (const RECT* prc, int x, int y);
04903 
04904 #endif
04905 
04918 MG_EXPORT BOOL GUIAPI IsRectEmpty (const RECT* prc);
04919 
04932 MG_EXPORT BOOL GUIAPI EqualRect (const RECT* prc1, const RECT* prc2);
04933 
04943 MG_EXPORT void GUIAPI NormalizeRect (RECT* pRect);
04944 
04965 MG_EXPORT BOOL GUIAPI IntersectRect (RECT* pdrc, 
04966                 const RECT* psrc1, const RECT* psrc2);
04967 
04983 MG_EXPORT BOOL GUIAPI IsCovered (const RECT* prc1, const RECT* prc2);
04984 
04998 MG_EXPORT BOOL GUIAPI DoesIntersect (const RECT* psrc1, const RECT* psrc2);
04999 
05017 MG_EXPORT BOOL GUIAPI UnionRect (RECT* pdrc, 
05018                 const RECT* psrc1, const RECT* psrc2);
05019 
05035 MG_EXPORT void GUIAPI GetBoundRect (PRECT pdrc, 
05036                 const RECT* psrc1, const RECT* psrc2);
05037 
05054 MG_EXPORT int GUIAPI SubtractRect (RECT* rc, const RECT* psrc1, const RECT* psrc2);
05055 
05060 #define RECTWP(prc)  (prc->right - prc->left)
05061 
05065 #define RECTHP(prc)  (prc->bottom - prc->top)
05066 
05070 #define RECTW(rc)    (rc.right - rc.left)
05071 
05075 #define RECTH(rc)    (rc.bottom - rc.top)
05076 
05090 /* Font-related structures */
05091 #define LEN_FONT_NAME               15
05092 #define LEN_DEVFONT_NAME            79
05093 #define LEN_UNIDEVFONT_NAME         127
05094 
05095 #define FONT_WEIGHT_NIL             '\0'
05096 #define FONT_WEIGHT_ALL             '*'
05097 #define FONT_WEIGHT_BLACK           'c'
05098 #define FONT_WEIGHT_BOLD            'b'
05099 #define FONT_WEIGHT_BOOK            'k'
05100 #define FONT_WEIGHT_DEMIBOLD        'd'
05101 #define FONT_WEIGHT_LIGHT           'l'
05102 #define FONT_WEIGHT_MEDIUM          'm'
05103 #define FONT_WEIGHT_REGULAR         'r'
05104 
05105 #define FS_WEIGHT_MASK              0x000000FF
05106 #define FS_WEIGHT_BLACK             0x00000001
05107 #define FS_WEIGHT_BOLD              0x00000002
05108 #define FS_WEIGHT_BOOK              0x00000004
05109 #define FS_WEIGHT_DEMIBOLD          0x00000006 /* BOOK | BOLD */
05110 #define FS_WEIGHT_LIGHT             0x00000010
05111 #define FS_WEIGHT_MEDIUM            0x00000020
05112 #define FS_WEIGHT_REGULAR           0x00000000
05113 
05114 #define FONT_SLANT_NIL              '\0'
05115 #define FONT_SLANT_ALL              '*'
05116 #define FONT_SLANT_ITALIC           'i'
05117 #define FONT_SLANT_OBLIQUE          'o'
05118 #define FONT_SLANT_ROMAN            'r'
05119 
05120 #define FS_SLANT_MASK               0x00000F00
05121 #define FS_SLANT_ITALIC             0x00000100
05122 #define FS_SLANT_OBLIQUE            0x00000200
05123 #define FS_SLANT_ROMAN              0x00000000
05124 
05125 #define FONT_FLIP_NIL               '\0'
05126 #define FONT_FLIP_HORZ              'H'
05127 #define FONT_FLIP_VERT              'V'
05128 #define FONT_FLIP_HORZVERT          'T'
05129 
05130 #define FS_FLIP_MASK                0x0000F000
05131 #define FS_FLIP_HORZ                0x00001000
05132 #define FS_FLIP_VERT                0x00002000
05133 #define FS_FLIP_HORZVERT            0x00003000 /* HORZ | VERT */
05134 
05135 #define FONT_OTHER_NIL              '\0'
05136 #define FONT_OTHER_AUTOSCALE        'S'
05137 #define FONT_OTHER_TTFNOCACHE       'N'
05138 #define FONT_OTHER_TTFKERN          'K'
05139 #define FONT_OTHER_TTFNOCACHEKERN   'R'
05140 
05141 #define FS_OTHER_MASK               0x000F0000
05142 #define FS_OTHER_AUTOSCALE          0x00010000
05143 #define FS_OTHER_TTFNOCACHE         0x00020000
05144 #define FS_OTHER_TTFKERN            0x00040000
05145 #define FS_OTHER_TTFNOCACHEKERN     0x00060000 /* KERN | NOCACHE */
05146 
05147 /* 
05148  * Backward compatiblilty definitions. 
05149  * All FONT_SETWIDTH_* and FONT_SPACING_* types will 
05150  * be treated as FONT_FLIP_NIL and FONT_OTHER_NIL respectively. 
05151  */
05152 #define FONT_SETWIDTH_NIL           '\0'
05153 #define FONT_SETWIDTH_ALL           '*'
05154 #define FONT_SETWIDTH_BOLD          'b'
05155 #define FONT_SETWIDTH_CONDENSED     'c'
05156 #define FONT_SETWIDTH_SEMICONDENSED 's'
05157 #define FONT_SETWIDTH_NORMAL        'n'
05158 #define FONT_SETWIDTH_TTFNOCACHE    'w'
05159 
05160 /*
05161 #define FS_SETWIDTH_MASK            0x0000F000
05162 #define FS_SETWIDTH_BOLD            0x00001000
05163 #define FS_SETWIDTH_CONDENSED       0x00002000
05164 #define FS_SETWIDTH_SEMICONDENSED   0x00004000
05165 #define FS_SETWIDTH_TTFNOCACHE      0x00008000
05166 #define FS_SETWIDTH_NORMAL          0x00000000
05167 */
05168 
05169 #define FONT_SPACING_NIL            '\0'
05170 #define FONT_SPACING_ALL            '*'
05171 #define FONT_SPACING_MONOSPACING    'm'
05172 #define FONT_SPACING_PROPORTIONAL   'p'
05173 #define FONT_SPACING_CHARCELL       'c'
05174 
05175 /*
05176 #define FS_SPACING_MASK             0x000F0000
05177 #define FS_SPACING_MONOSPACING      0x00010000
05178 #define FS_SPACING_PROPORTIONAL     0x00020000
05179 #define FS_SPACING_CHARCELL         0x00000000
05180 */
05181 
05182 #define FONT_UNDERLINE_NIL          '\0'
05183 #define FONT_UNDERLINE_ALL          '*'
05184 #define FONT_UNDERLINE_LINE         'u'
05185 #define FONT_UNDERLINE_NONE         'n'
05186 
05187 #define FS_UNDERLINE_MASK           0x00F00000
05188 #define FS_UNDERLINE_LINE           0x00100000
05189 #define FS_UNDERLINE_NONE           0x00000000
05190 
05191 #define FONT_STRUCKOUT_NIL          '\0'
05192 #define FONT_STRUCKOUT_ALL          '*'
05193 #define FONT_STRUCKOUT_LINE         's'
05194 #define FONT_STRUCKOUT_NONE         'n'
05195 
05196 #define FS_STRUCKOUT_MASK           0x0F000000
05197 #define FS_STRUCKOUT_LINE           0x01000000
05198 #define FS_STRUCKOUT_NONE           0x00000000
05199 
05200 #define FONT_TYPE_NAME_BITMAP_RAW   "rbf"
05201 #define FONT_TYPE_NAME_BITMAP_VAR   "vbf"
05202 #define FONT_TYPE_NAME_BITMAP_QPF   "qpf"
05203 #define FONT_TYPE_NAME_SCALE_TTF    "ttf"
05204 #define FONT_TYPE_NAME_SCALE_T1F    "t1f"
05205 #define FONT_TYPE_NAME_ALL          "*"
05206 
05207 #define FONT_TYPE_BITMAP_RAW        0x0001  /* "rbf" */
05208 #define FONT_TYPE_BITMAP_VAR        0x0002  /* "vbf" */
05209 #define FONT_TYPE_BITMAP_QPF        0x0003  /* "qpf" */
05210 #define FONT_TYPE_SCALE_TTF         0x0010  /* "ttf" */
05211 #define FONT_TYPE_SCALE_T1F         0x0011  /* "t1f" */
05212 #define FONT_TYPE_ALL               0xFFFF  /* "all" */
05213 
05214 #define FONT_CHARSET_US_ASCII       "US-ASCII"
05215 
05216 #define FONT_CHARSET_ISO8859_1      "ISO8859-1"
05217 #define FONT_CHARSET_ISO8859_2      "ISO8859-2"
05218 #define FONT_CHARSET_ISO8859_3      "ISO8859-3"
05219 #define FONT_CHARSET_ISO8859_4      "ISO8859-4"
05220 #define FONT_CHARSET_ISO8859_5      "ISO8859-5"
05221 #define FONT_CHARSET_ISO8859_6      "ISO8859-6"
05222 #define FONT_CHARSET_ISO8859_7      "ISO8859-7"
05223 #define FONT_CHARSET_ISO8859_8      "ISO8859-8"
05224 #define FONT_CHARSET_ISO8859_9      "ISO8859-9"
05225 #define FONT_CHARSET_ISO8859_10     "ISO8859-10"
05226 #define FONT_CHARSET_ISO8859_11     "ISO8859-11"
05227 #define FONT_CHARSET_ISO8859_12     "ISO8859-12"
05228 #define FONT_CHARSET_ISO8859_13     "ISO8859-13"
05229 #define FONT_CHARSET_ISO8859_14     "ISO8859-14"
05230 #define FONT_CHARSET_ISO8859_15     "ISO8859-15"
05231 #define FONT_CHARSET_ISO8859_16     "ISO8859-16"
05232 
05233 #define FONT_CHARSET_EUC_CN         "EUC-CN"
05234