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 
05239 #define FONT_CHARSET_GB1988_0       "GB1988-0"      
05240 
05245 #define FONT_CHARSET_GB2312_0       "GB2312-0"      
05246 #define FONT_CHARSET_GBK            "GBK"
05247 
05252 #define FONT_CHARSET_GB18030_0      "GB18030-0"     
05253 #define FONT_CHARSET_BIG5           "BIG5"
05254 
05259 #define FONT_CHARSET_EUCTW          "EUC-TW"        
05260 #define FONT_CHARSET_EUCKR          "EUC-KR"
05261 
05266 #define FONT_CHARSET_KSC5636_0      "KSC5636-0"     
05267 
05272 #define FONT_CHARSET_KSC5601_0      "KSC5601-0"     
05273 #define FONT_CHARSET_EUCJP          "EUC-JP"
05274 
05279 #define FONT_CHARSET_JISX0201_0     "JISX0201-0"    
05280 
05285 #define FONT_CHARSET_JISX0208_0     "JISX0208-0"    
05286 #define FONT_CHARSET_SHIFTJIS       "SHIFT-JIS"
05287 
05292 #define FONT_CHARSET_JISX0201_1     "JISX0201-1"    
05293 
05298 #define FONT_CHARSET_JISX0208_1     "JISX0208-1"    
05299 
05304 #define FONT_CHARSET_ISO_10646_1    "ISO-10646-1"   
05305 
05306 #define FONT_CHARSET_UTF8           "UTF-8"
05307 
05308 #define FONT_MAX_SIZE               256
05309 #define FONT_MIN_SIZE               4
05310 
05311 struct _DEVFONT;
05312 typedef struct _DEVFONT DEVFONT;
05313 
05315 typedef struct _LOGFONT {
05317     char type [LEN_FONT_NAME + 1];
05319     char family [LEN_FONT_NAME + 1];
05321     char charset [LEN_FONT_NAME + 1];
05323     DWORD style;
05325     int size;
05327     int rotation;
05329     unsigned short sbc_scale;
05331     unsigned short mbc_scale;
05333     DEVFONT* sbc_devfont;
05335     DEVFONT* mbc_devfont;
05336 } LOGFONT;
05341 typedef LOGFONT*    PLOGFONT;
05342 
05343 struct _WORDINFO;
05348 typedef struct _WORDINFO WORDINFO;
05349 
05350 #define MAX_LEN_MCHAR               4
05351 
05352 typedef struct _CHARSETOPS
05353 {
05354     int nr_chars;
05355     int bytes_per_char;
05356     int bytes_maxlen_char;
05357     const char* name;
05358     char def_char [MAX_LEN_MCHAR];
05359 
05360     int (*len_first_char) (const unsigned char* mstr, int mstrlen);
05361     unsigned int (*char_offset) (const unsigned char* mchar);
05362 
05363     int (*nr_chars_in_str) (const unsigned char* mstr, int mstrlen);
05364 
05365     int (*is_this_charset) (const unsigned char* charset);
05366 
05367     int (*len_first_substr) (const unsigned char* mstr, int mstrlen);
05368     const unsigned char* (*get_next_word) (const unsigned char* mstr, 
05369                 int strlen, WORDINFO* word_info);
05370 
05371     int (*pos_first_char) (const unsigned char* mstr, int mstrlen);
05372 
05373 #ifdef _UNICODE_SUPPORT
05374     unsigned short (*conv_to_uc16) (const unsigned char* mchar, int len);
05375     int (*conv_from_uc16) (unsigned short wc, unsigned char* mchar);
05376 #endif /* LITE_VERSION */
05377 } CHARSETOPS;
05378 
05379 typedef struct _FONTOPS
05380 {
05381     int (*get_char_width) (LOGFONT* logfont, DEVFONT* devfont, 
05382             const unsigned char* mchar, int len);
05383     int (*get_ave_width) (LOGFONT* logfont, DEVFONT* devfont);
05384     int (*get_max_width) (LOGFONT* logfont, DEVFONT* devfont);
05385     int (*get_font_height) (LOGFONT* logfont, DEVFONT* devfont);
05386     int (*get_font_size) (LOGFONT* logfont, DEVFONT* devfont, int expect);
05387     int (*get_font_ascent) (LOGFONT* logfont, DEVFONT* devfont);
05388     int (*get_font_descent) (LOGFONT* logfont, DEVFONT* devfont);
05389 
05390     const void* (*get_char_bitmap) (LOGFONT* logfont, DEVFONT* devfont, 
05391             const unsigned char* mchar, int len, unsigned short* scale);
05392     
05393     const void* (*get_char_pixmap) (LOGFONT* logfont, DEVFONT* devfont, 
05394             const unsigned char* mchar, int len, 
05395             int* pitch, unsigned short* scale);
05396          /* Can be NULL */
05397 
05398     void (*start_str_output) (LOGFONT* logfont, DEVFONT* devfont);
05399          /* Can be NULL */
05400     int (*get_char_bbox) (LOGFONT* logfont, DEVFONT* devfont,
05401             const unsigned char* mchar, int len,
05402             int* px, int* py, int* pwidth, int* pheight);
05403          /* Can be NULL */
05404     void (*get_char_advance) (LOGFONT* logfont, DEVFONT* devfont,
05405             const unsigned char* mchar, int len, int* px, int* py);
05406          /* Can be NULL */
05407 
05408     DEVFONT* (*new_instance) (LOGFONT* logfont, DEVFONT* devfont, 
05409             BOOL need_sbc_font);
05410          /* Can be NULL */
05411     void (*delete_instance) (DEVFONT* devfont);
05412          /* Can be NULL */
05413 } FONTOPS;
05414 
05415 struct _DEVFONT
05416 {
05417     char             name [LEN_UNIDEVFONT_NAME + 1];
05418     DWORD            style;
05419     FONTOPS*         font_ops;
05420     CHARSETOPS*      charset_ops;
05421     struct _DEVFONT* sbc_next;
05422     struct _DEVFONT* mbc_next;
05423     void*            data;
05424 };
05425 
05426 #define SBC_DEVFONT_INFO(logfont) (logfont.sbc_devfont)
05427 #define MBC_DEVFONT_INFO(logfont) (logfont.mbc_devfont)
05428 
05429 #define SBC_DEVFONT_INFO_P(logfont) (logfont->sbc_devfont)
05430 #define MBC_DEVFONT_INFO_P(logfont) (logfont->mbc_devfont)
05431 
05436 #define INV_LOGFONT     0
05437 
05439 typedef struct _FONTMETRICS
05440 {
05442     int font_height;
05444     int ascent;
05446     int descent;
05447 
05449     int max_width;
05451     int ave_width;
05452 } FONTMETRICS;
05453 
05468 MG_EXPORT void GUIAPI GetFontMetrics (LOGFONT* log_font, 
05469                 FONTMETRICS* font_metrics);
05470 
05472 typedef struct _GLYPHBITMAP
05473 {
05475     int bbox_x, bbox_y, bbox_w, bbox_h;
05477     int advance_x, advance_y;
05478 
05480     size_t bmp_size;
05482     int bmp_pitch;
05484     const unsigned char* bits;
05485 } GLYPHBITMAP;
05486 
05513 MG_EXPORT void GUIAPI GetGlyphBitmap (LOGFONT* log_font, 
05514                 const unsigned char* mchar, int mchar_len, 
05515                 GLYPHBITMAP* glyph_bitmap);
05516 
05517 #ifdef _LITE_VERSION
05518 
05537 MG_EXPORT BOOL GUIAPI InitVectorialFonts (void);
05538 
05551 MG_EXPORT void GUIAPI TermVectorialFonts (void);
05552 
05553 #endif
05554 
05649 MG_EXPORT PLOGFONT GUIAPI CreateLogFont (const char* type, const char* family, 
05650         const char* charset, char weight, char slant, char flip, 
05651         char other, char underline, char struckout, 
05652         int size, int rotation);
05653 
05667 MG_EXPORT PLOGFONT GUIAPI CreateLogFontByName (const char* font_name);
05668 
05680 MG_EXPORT PLOGFONT GUIAPI CreateLogFontIndirect (LOGFONT* logfont);
05681 
05692 MG_EXPORT void GUIAPI DestroyLogFont (PLOGFONT log_font);
05693 
05707 MG_EXPORT void GUIAPI GetLogFontInfo (HDC hdc, LOGFONT* log_font);
05708 
05721 MG_EXPORT PLOGFONT GUIAPI GetCurFont (HDC hdc);
05722 
05741 MG_EXPORT PLOGFONT GUIAPI SelectFont (HDC hdc, PLOGFONT log_font);
05742 
05753 MG_EXPORT const DEVFONT* GUIAPI GetNextDevFont (const DEVFONT* dev_font);
05754 
05773 #define SYSLOGFONT_DEFAULT          0
05774 
05779 #define SYSLOGFONT_WCHAR_DEF        1
05780 
05785 #define SYSLOGFONT_FIXED            2
05786 
05791 #define SYSLOGFONT_CAPTION          3
05792 
05797 #define SYSLOGFONT_MENU             4
05798 
05803 #define SYSLOGFONT_CONTROL          5
05804 
05805 #define NR_SYSLOGFONTS              6
05806 
05807 
05808 extern MG_EXPORT PLOGFONT g_SysLogFont [];
05809 
05833 static inline PLOGFONT GUIAPI GetSystemFont (int font_id)
05834 {
05835     if (font_id >= 0 && font_id < NR_SYSLOGFONTS)
05836         return g_SysLogFont [font_id];
05837     else
05838         return (PLOGFONT)NULL;
05839 }
05840 
05855 MG_EXPORT int GUIAPI GetSysFontMaxWidth (int font_id);
05856 
05871 MG_EXPORT int GUIAPI GetSysFontAveWidth (int font_id);
05872 
05886 MG_EXPORT int GUIAPI GetSysFontHeight (int font_id);
05887 
05902 MG_EXPORT const char* GUIAPI GetSysCharset (BOOL wchar);
05903 
05918 MG_EXPORT int GUIAPI GetSysCharHeight (void);
05919 
05933 MG_EXPORT int GUIAPI GetSysCharWidth (void);
05934 
05946 MG_EXPORT int GUIAPI GetSysCCharWidth (void);
05947 
05961 struct _WORDINFO
05962 {
05964     int len;
05966     unsigned char delimiter;
05968     int nr_delimiters;
05969 };
05970 
05990 MG_EXPORT int GUIAPI GetTextMCharInfo (PLOGFONT log_font, 
05991                 const char* mstr, int len, int* pos_chars);
05992 
06016 MG_EXPORT int GUIAPI GetTextWordInfo (PLOGFONT log_font, const char* mstr, 
06017                 int len, int* pos_words, WORDINFO* info_words);
06018 
06034 MG_EXPORT int GUIAPI GetFirstMCharLen (PLOGFONT log_font, 
06035                 const char* mstr, int len);
06036 
06057 MG_EXPORT int GUIAPI GetFirstWord (PLOGFONT log_font, 
06058                 const char* mstr, int len, WORDINFO* word_info);
06059 
06060 #ifdef _UNICODE_SUPPORT
06061 
06062 #include <stdlib.h>
06063 
06082 MG_EXPORT int GUIAPI MB2WC (PLOGFONT log_font, 
06083                 wchar_t* dest, const unsigned char* mstr, int n);
06084 
06102 MG_EXPORT int GUIAPI WC2MB (PLOGFONT log_font, unsigned char *s, wchar_t wc);
06103 
06130 MG_EXPORT int GUIAPI MBS2WCS (PLOGFONT log_font, wchar_t* dest, 
06131                 const unsigned char* mstr, int mstr_len, int n);
06132 
06158 MG_EXPORT int GUIAPI WCS2MBS (PLOGFONT log_font, unsigned char* dest, 
06159                 const wchar_t *wcs, int wcs_len, int n);
06160 
06161 #endif /* _UNICODE_SUPPORT */
06162 
06194 MG_EXPORT int GUIAPI GetTextExtentPoint (HDC hdc, const char* text, int len, 
06195                 int max_extent, int* fit_chars, int* pos_chars, 
06196                 int* dx_chars, SIZE* size);
06197 
06198 
06199 MG_EXPORT int GUIAPI TextOutOmitted (HDC hdc, int x, int y, 
06200                 const char *mtext, int len, int max_extent);
06201 
06210 MG_EXPORT int GUIAPI GetTabbedTextExtentPoint (HDC hdc, 
06211                 const char* text, int len, int max_extent, 
06212                 int* fit_chars, int* pos_chars, int* dx_chars, SIZE* size);
06213 
06233 MG_EXPORT int GUIAPI GetFontHeight (HDC hdc);
06234 
06248 MG_EXPORT int GUIAPI GetMaxFontWidth (HDC hdc);
06249 
06266 MG_EXPORT void GUIAPI GetTextExtent (HDC hdc, 
06267                 const char* spText, int len, SIZE* pSize);
06268 
06287 MG_EXPORT void GUIAPI GetTabbedTextExtent (HDC hdc, 
06288                 const char* spText, int len, SIZE* pSize);
06289 
06290 #ifdef _USE_NEWGAL
06291 
06302 #define GetTextCharacterExtra(hdc)  (int)GetDCAttr (hdc, DC_ATTR_CHAR_EXTRA)
06303 
06314 #define GetTextAboveLineExtra(hdc)  (int)GetDCAttr (hdc, DC_ATTR_ALINE_EXTRA)
06315 
06326 #define GetTextBellowLineExtra(hdc) (int)GetDCAttr (hdc, DC_ATTR_BLINE_EXTRA)
06327 
06339 #define SetTextCharacterExtra(hdc, extra)       \
06340                 (int)SetDCAttr (hdc, DC_ATTR_CHAR_EXTRA, (DWORD) extra)
06341 
06352 #define SetTextAboveLineExtra(hdc, extra)       \
06353                 (int)SetDCAttr (hdc, DC_ATTR_ALINE_EXTRA, (DWORD) extra)
06354 
06365 #define SetTextBellowLineExtra(hdc, extra)      \
06366                 (int)SetDCAttr (hdc, DC_ATTR_BLINE_EXTRA, (DWORD) extra)
06367 
06368 #else
06369 
06370 MG_EXPORT int GUIAPI GetTextCharacterExtra (HDC hdc);
06371 MG_EXPORT int GUIAPI SetTextCharacterExtra (HDC hdc, int extra);
06372 MG_EXPORT int GUIAPI GetTextAboveLineExtra (HDC hdc);
06373 MG_EXPORT int GUIAPI SetTextAboveLineExtra (HDC hdc, int extra);
06374 MG_EXPORT int GUIAPI GetTextBellowLineExtra (HDC hdc);
06375 MG_EXPORT int GUIAPI SetTextBellowLineExtra (HDC hdc, int extra);
06376 
06377 #endif /* _USE_NEWGAL */
06378 
06397 MG_EXPORT int GUIAPI TextOutLen (HDC hdc, int x, int y, 
06398                 const char* spText, int len);
06399 
06420 MG_EXPORT int GUIAPI TabbedTextOutLen (HDC hdc, int x, int y, 
06421                 const char* spText, int len); 
06422 
06448 MG_EXPORT int GUIAPI TabbedTextOutEx (HDC hdc, int x, int y, 
06449                 const char* spText, int nCount, 
06450                 int nTabPositions, int *pTabPositions, int nTabOrigin);
06451 
06461 MG_EXPORT void GUIAPI GetLastTextOutPos (HDC hdc, POINT* pt);
06462 
06471 #define TextOut(hdc, x, y, text)    TextOutLen (hdc, x, y, text, -1)
06472 
06481 #define TabbedTextOut(hdc, x, y, text)  TabbedTextOutLen (hdc, x, y, text, -1)
06482 
06483 #define DT_TOP              0x00000000
06484 #define DT_LEFT             0x00000000
06485 #define DT_CENTER           0x00000001
06486 #define DT_RIGHT            0x00000002
06487 #define DT_VCENTER          0x00000004
06488 #define DT_BOTTOM           0x00000008
06489 #define DT_WORDBREAK        0x00000010
06490 #define DT_SINGLELINE       0x00000020
06491 #define DT_EXPANDTABS       0x00000040
06492 #define DT_TABSTOP          0x00000080
06493 #define DT_NOCLIP           0x00000100
06494 #define DT_EXTERNALLPADING  0x00000200
06495 #define DT_CALCRECT         0x00000400
06496 #define DT_NOPREFIX         0x00000800
06497 #define DT_INTERNAL         0x00001000
06498 #define DT_CHARBREAK        0x00002000
06499 
06503 typedef struct _DTFIRSTLINE
06504 {   
06506     int nr_chars;
06508     int startx;
06510     int starty;
06512     int width;
06514     int height;
06515 } DTFIRSTLINE;
06516 
06592 MG_EXPORT int GUIAPI DrawTextEx2 (HDC hdc, const char* pText, int nCount, 
06593                 RECT* pRect, int nIndent, UINT nFormat, DTFIRSTLINE *firstline);
06594 
06604 #define DrawText(hdc, text, n, rc, format)          \
06605                 DrawTextEx2 (hdc, text, n, rc, 0, format, NULL)
06606 
06615 #define DrawTextEx(hdc, text, n, rc, indent, format)    \
06616                 DrawTextEx2 (hdc, text, n, rc, indent, format, NULL)
06617 
06651 #define MYBMP_TYPE_NORMAL       0x00000000
06652 #define MYBMP_TYPE_RLE4         0x00000001
06653 #define MYBMP_TYPE_RLE8         0x00000002
06654 #define MYBMP_TYPE_RGB          0x00000003
06655 #define MYBMP_TYPE_BGR          0x00000004
06656 #define MYBMP_TYPE_RGBA         0x00000005
06657 #define MYBMP_TYPE_MASK         0x0000000F
06658 
06659 #define MYBMP_FLOW_DOWN         0x00000010
06660 #define MYBMP_FLOW_UP           0x00000020
06661 #define MYBMP_FLOW_MASK         0x000000F0
06662 
06663 #define MYBMP_TRANSPARENT       0x00000100
06664 #define MYBMP_ALPHACHANNEL      0x00000200
06665 #define MYBMP_ALPHA             0x00000400
06666 
06667 #define MYBMP_RGBSIZE_3         0x00001000
06668 #define MYBMP_RGBSIZE_4         0x00002000
06669 
06670 #define MYBMP_LOAD_GRAYSCALE    0x00010000
06671 #define MYBMP_LOAD_ALLOCATE_ONE 0x00020000
06672 #define MYBMP_LOAD_NONE         0x00000000
06673 
06675 struct _MYBITMAP
06676 {
06706     DWORD flags;
06708     int   frames;
06710     Uint8 depth;
06712     Uint8 alpha;
06713     Uint8 reserved [2];
06715     Uint32 transparent;
06716 
06718     Uint32 w;
06720     Uint32 h;
06722     Uint32 pitch;
06724     Uint32 size;
06725 
06727     BYTE* bits;
06728 };
06729 
06730 #ifdef _USE_NEWGAL
06731 
06732 #define BMP_TYPE_NORMAL         0x00
06733 #define BMP_TYPE_RLE            0x01
06734 #define BMP_TYPE_ALPHA          0x02
06735 #define BMP_TYPE_ALPHACHANNEL   0x04
06736 #define BMP_TYPE_COLORKEY       0x10
06737 #define BMP_TYPE_PRIV_PIXEL     0x20
06738 
06739 #ifdef _FOR_MONOBITMAP
06740   #define BMP_TYPE_MONOKEY      0x40
06741 #endif
06742 
06744 struct _BITMAP
06745 {
06775     Uint8   bmType;
06777     Uint8   bmBitsPerPixel;
06779     Uint8   bmBytesPerPixel;
06781     Uint8   bmAlpha;
06783     Uint32  bmColorKey;
06784 #ifdef _FOR_MONOBITMAP
06785     Uint32  bmColorRep;
06786 #endif
06787 
06789     Uint32  bmWidth;
06791     Uint32  bmHeight;
06793     Uint32  bmPitch;
06795     Uint8*  bmBits;
06796 
06798     void*   bmAlphaPixelFormat;
06799 };
06800 
06801 #else
06802 
06803 #define BMP_TYPE_NORMAL         0x00
06804 #define BMP_TYPE_COLORKEY       0x01
06805 
06806 /* expanded bitmap struct */
06807 struct _BITMAP
06808 {
06809     Uint8   bmType;
06810     Uint8   bmBitsPerPixel;
06811     Uint8   bmBytesPerPixel;
06812     Uint8   bmReserved;
06813 
06814     Uint32  bmColorKey;
06815 
06816     Uint32  bmWidth;
06817     Uint32  bmHeight;
06818     Uint32  bmPitch;
06819 
06820     void*   bmBits;
06821     Uint32  bmReserved1;
06822 };
06823 
06824 #endif /* _USE_NEWGAL */
06825 
06837 #include <stdio.h>
06838 #include "endianrw.h"
06839 
06844 typedef void (* CB_ONE_SCANLINE) (void* context, MYBITMAP* my_bmp, int y);
06845 
06880 MG_EXPORT BOOL GUIAPI RegisterBitmapFileType (const char *ext,
06881             void* (*init) (MG_RWops* fp, MYBITMAP *my_bmp, RGB *pal),
06882             int (*load) (MG_RWops* fp, void* init_info, MYBITMAP *my_bmp, 
06883                     CB_ONE_SCANLINE cb, void* context),
06884             void (*cleanup) (void* init_info),
06885             int (*save) (MG_RWops* fp, MYBITMAP *my_bmp, RGB *pal),
06886             BOOL (*check) (MG_RWops* fp));
06887 
06902 MG_EXPORT const char* GUIAPI CheckBitmapType (MG_RWops* fp);
06903 
06904 #define ERR_BMP_OK              0
06905 #define ERR_BMP_IMAGE_TYPE      -1
06906 #define ERR_BMP_UNKNOWN_TYPE    -2
06907 #define ERR_BMP_CANT_READ       -3
06908 #define ERR_BMP_CANT_SAVE       -4
06909 #define ERR_BMP_NOT_SUPPORTED   -5   
06910 #define ERR_BMP_MEM             -6
06911 #define ERR_BMP_LOAD            -7
06912 #define ERR_BMP_FILEIO          -8
06913 #define ERR_BMP_OTHER           -9
06914 #define ERR_BMP_ERROR_SOURCE    -10
06915 
06943 MG_EXPORT int GUIAPI LoadBitmapEx (HDC hdc, PBITMAP pBitmap, 
06944                 MG_RWops* area, const char* ext);
06945 
06953 MG_EXPORT int GUIAPI LoadBitmapFromFile (HDC hdc, PBITMAP pBitmap, 
06954                 const char* spFileName);
06955 
06962 #define LoadBitmap  LoadBitmapFromFile
06963 
06971 MG_EXPORT int GUIAPI LoadBitmapFromMem (HDC hdc, PBITMAP pBitmap, 
06972                 const void* mem, int size, const char* ext);
06973 
06985 MG_EXPORT void GUIAPI UnloadBitmap (PBITMAP pBitmap);
06986 
07001 MG_EXPORT void GUIAPI ReplaceBitmapColor (HDC hdc, PBITMAP pBitmap, 
07002                 gal_pixel iOColor, gal_pixel iNColor);
07003 
07004 
07005 void GUIAPI HFlipBitmap (BITMAP* bmp, unsigned char* inter_buff);
07006 void GUIAPI VFlipBitmap (BITMAP* bmp, unsigned char* inter_buff);
07007 
07026 MG_EXPORT void* GUIAPI InitMyBitmapSL (MG_RWops* area, 
07027                 const char* ext, MYBITMAP* my_bmp, RGB* pal);
07028 
07047 MG_EXPORT int GUIAPI LoadMyBitmapSL (MG_RWops* area, void* load_info, 
07048                 MYBITMAP* my_bmp, CB_ONE_SCANLINE cb, void* context);
07049 
07064 MG_EXPORT int GUIAPI CleanupMyBitmapSL (MYBITMAP* my_bmp, void* load_info);
07065 
07081 MG_EXPORT int GUIAPI LoadMyBitmapEx (PMYBITMAP my_bmp, RGB* pal, 
07082                 MG_RWops* area, const char* ext);
07083 
07091 MG_EXPORT int GUIAPI LoadMyBitmapFromFile (PMYBITMAP my_bmp, RGB* pal, 
07092                 const char* file_name);
07093 
07100 #define LoadMyBitmap    LoadMyBitmapFromFile
07101 
07117 MG_EXPORT int GUIAPI LoadMyBitmapFromMem (PMYBITMAP my_bmp, RGB* pal, 
07118                 const void* mem, int size, const char* ext);
07119 
07131 MG_EXPORT void GUIAPI UnloadMyBitmap (PMYBITMAP my_bmp);
07132 
07133 #ifdef _SAVE_BITMAP
07134 
07151 MG_EXPORT int GUIAPI SaveMyBitmapToFile (PMYBITMAP my_bmp, RGB* pal, 
07152                 const char* spFileName);
07153 
07169 MG_EXPORT int GUIAPI SaveBitmapToFile (HDC hdc, PBITMAP pBitmap, 
07170                 const char* spFileName);
07171 #define SaveBitmap  SaveBitmapToFile 
07172 #endif
07173 
07195 MG_EXPORT BOOL GUIAPI InitBitmap (HDC hdc, Uint32 w, Uint32 h, Uint32 pitch, 
07196                 BYTE* bits, PBITMAP bmp);
07197 
07198 #ifdef _USE_NEWGAL
07199 
07209 MG_EXPORT HDC GUIAPI InitSlaveScreen (const char* name, const char* mode);
07210 
07218 MG_EXPORT void TerminateSlaveScreen (HDC hdc);
07234 MG_EXPORT BOOL GUIAPI InitBitmapPixelFormat (HDC hdc, PBITMAP bmp);
07235 
07245 MG_EXPORT void GUIAPI DeleteBitmapAlphaPixel (PBITMAP bmp);
07246 
07262 MG_EXPORT int GUIAPI ExpandMyBitmap (HDC hdc, PBITMAP bmp, 
07263                 const MYBITMAP* my_bmp, const RGB* pal, int frame);
07264 
07265 void GUIAPI ExpandMonoBitmap (HDC hdc, BYTE* bits, Uint32 pitch, 
07266                 const BYTE* my_bits, Uint32 my_pitch, 
07267                 Uint32 w, Uint32 h, DWORD flags, Uint32 bg, Uint32 fg);
07268 void GUIAPI Expand16CBitmap (HDC hdc, BYTE* bits, Uint32 pitch, 
07269                 const BYTE* my_bits, Uint32 my_pitch, 
07270                 Uint32 w, Uint32 h, DWORD flags, const RGB* pal);
07271 void GUIAPI Expand256CBitmap (HDC hdc, BYTE* bits, Uint32 pitch, 
07272                 const BYTE* my_bits, Uint32 my_pitch, 
07273                 Uint32 w, Uint32 h, DWORD flags, const RGB* pal);
07274 void GUIAPI CompileRGBABitmap (HDC hdc, BYTE* bits, Uint32 pitch, 
07275                 const BYTE* my_bits, Uint32 my_pitch, 
07276                 Uint32 w, Uint32 h, DWORD flags, void* pixel_format);
07277 
07278 #define CompileRGBBitmap CompileRGBABitmap 
07279 
07308 MG_EXPORT int GUIAPI PaintImageEx (HDC hdc, int x, int y, 
07309                 MG_RWops* area, const char* ext);
07310 
07325 MG_EXPORT int GUIAPI PaintImageFromFile (HDC hdc, int x, int y, 
07326                 const char* spFileName);
07327 
07344 MG_EXPORT int GUIAPI PaintImageFromMem (HDC hdc, int x, int y, 
07345                 const void* mem, int size, const char* ext);
07346 
07378 MG_EXPORT int GUIAPI StretchPaintImageEx (HDC hdc, int x, int y, int w, int h, 
07379                 MG_RWops* area, const char* ext);
07380 
07397 MG_EXPORT int GUIAPI StretchPaintImageFromFile (HDC hdc, int x, int y, 
07398                 int w, int h, const char* spFileName);
07399 
07418 MG_EXPORT int GUIAPI StretchPaintImageFromMem (HDC hdc, int x, int y, 
07419                 int w, int h, const void* mem, int size, const char* ext);
07420 
07421 #ifdef _FIXED_MATH
07422 
07438 MG_EXPORT void GUIAPI RotateBitmap (HDC hdc, const BITMAP *bmp, 
07439                 int lx, int ty, int angle);
07440 
07451 MG_EXPORT void GUIAPI RotateBitmapVFlip (HDC hdc, const BITMAP *bmp, 
07452                 int lx, int ty, int angle);
07453 
07462 MG_EXPORT void GUIAPI RotateBitmapHFlip (HDC hdc, const BITMAP *bmp, 
07463                 int lx, int ty, int angle);
07464 
07473 MG_EXPORT void GUIAPI RotateScaledBitmap (HDC hdc, const BITMAP *bmp, 
07474                 int lx, int ty, int angle, int w, int h);
07475 
07487 MG_EXPORT void GUIAPI RotateScaledBitmapVFlip (HDC hdc, const BITMAP *bmp, 
07488                 int lx, int ty, int angle, int w, int h);
07489 
07501 MG_EXPORT void GUIAPI RotateScaledBitmapHFlip (HDC hdc, const BITMAP *bmp, 
07502                 int lx, int ty, int angle, int w, int h);
07503 
07515 MG_EXPORT void GUIAPI PivotBitmap(HDC hdc, const BITMAP *bmp, 
07516                 int lx, int ty, int cx, int cy, int angle);
07517 
07544 MG_EXPORT void GUIAPI PivotScaledBitmapFlip (HDC hdc, const BITMAP *bmp, 
07545                 fixed x, fixed y, fixed cx, fixed cy, int angle, fixed scale_x, 
07546                 fixed scale_y, BOOL h_flip, BOOL v_flip);
07547 
07548 #endif /*_FIXED_MATH*/
07549 
07550 #else
07551 
07552 MG_EXPORT int GUIAPI ExpandMyBitmap (HDC hdc, const MYBITMAP* pMyBitmap, 
07553                 const RGB* pal, PBITMAP pBitmap);
07554 MG_EXPORT void GUIAPI ExpandMonoBitmap (HDC hdc, int w, int h, 
07555                 const BYTE* my_bits, int my_pitch, int bits_flow, 
07556                 BYTE* bitmap, int pitch, int bg, int fg);
07557 MG_EXPORT void GUIAPI Expand16CBitmap (HDC hdc, int w, int h, 
07558                 const BYTE* my_bits, int my_pitch, int bits_flow,
07559                 BYTE* bitmap, int pitch, const RGB* pal);
07560 MG_EXPORT void GUIAPI Expand256CBitmap (HDC hdc, int w, int h, 
07561                 const BYTE* my_bits, int my_pitch, int bits_flow,
07562                 BYTE* bitmap, int pitch, const RGB* pal);
07563 MG_EXPORT void GUIAPI CompileRGBBitmap (HDC hdc, int w, int h, 
07564                 const BYTE* my_bits, int my_pitch, int bits_flow,
07565                 BYTE* bitmap, int pitch, int rgb_order);
07566 
07567 #endif /* _USE_NEWGAL */
07568 
07575 #ifdef __cplusplus
07576 }
07577 #endif  /* __cplusplus */
07578 
07579 #endif  /* _MGUI_GDI_H */
07580 
07581 

Generated on Mon Jun 26 14:21:34 2006 for MiniGUI V2.0.3 API Reference by  doxygen 1.4.2