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 
00020 /*
00021  * $Id: gdi.h,v 1.213.2.24 2006/06/26 05:38:23 xwyan Exp $
00022  *
00023  *             MiniGUI for Linux/uClinux, eCos, uC/OS-II, VxWorks, 
00024  *                     pSOS, ThreadX, NuCleus, OSE, and Win32 version 1.6.x
00025  *
00026  *             Copyright (C) 2002-2006 Feynman Software.
00027  *             Copyright (C) 1998-2002 Wei Yongming.
00028  */
00029 
00030 #ifndef _MGUI_GDI_H
00031     #define _MGUI_GDI_H
00032 
00033 
00034 #ifdef __cplusplus
00035 extern "C" {
00036 #endif  /* __cplusplus */
00037 
00089 extern MG_EXPORT gal_pixel SysPixelIndex [];
00090 
00097 extern const MG_EXPORT RGB SysPixelColor [];
00098 
00104 #define PIXEL_invalid       0
00105 
00111 #define PIXEL_transparent   SysPixelIndex[0]
00112 
00118 #define PIXEL_darkblue      SysPixelIndex[1]
00119 
00125 #define PIXEL_darkgreen     SysPixelIndex[2]
00126 
00132 #define PIXEL_darkcyan      SysPixelIndex[3]
00133 
00139 #define PIXEL_darkred       SysPixelIndex[4] 
00140 
00146 #define PIXEL_darkmagenta   SysPixelIndex[5]
00147 
00153 #define PIXEL_darkyellow    SysPixelIndex[6] 
00154 
00160 #define PIXEL_darkgray      SysPixelIndex[7] 
00161 
00167 #define PIXEL_lightgray     SysPixelIndex[8]
00168 
00174 #define PIXEL_blue          SysPixelIndex[9]
00175 
00181 #define PIXEL_green         SysPixelIndex[10]
00182 
00188 #define PIXEL_cyan          SysPixelIndex[11]
00189 
00195 #define PIXEL_red           SysPixelIndex[12]
00196 
00202 #define PIXEL_magenta       SysPixelIndex[13]
00203 
00209 #define PIXEL_yellow        SysPixelIndex[14]
00210 
00216 #define PIXEL_lightwhite    SysPixelIndex[15]
00217 
00223 #define PIXEL_black         SysPixelIndex[16]
00224 
00225 /* Compatiblity definitions */
00230 #define COLOR_invalid       PIXEL_invalid
00231 
00236 #define COLOR_transparent   PIXEL_transparent
00237 
00242 #define COLOR_darkred       PIXEL_darkred
00243 
00248 #define COLOR_darkgreen     PIXEL_darkgreen
00249 
00254 #define COLOR_darkyellow    PIXEL_darkyellow
00255 
00260 #define COLOR_darkblue      PIXEL_darkblue
00261 
00266 #define COLOR_darkmagenta   PIXEL_darkmagenta
00267 
00272 #define COLOR_darkcyan      PIXEL_darkcyan
00273 
00278 #define COLOR_lightgray     PIXEL_lightgray
00279 
00284 #define COLOR_darkgray      PIXEL_darkgray
00285 
00290 #define COLOR_red           PIXEL_red
00291 
00296 #define COLOR_green         PIXEL_green
00297 
00302 #define COLOR_yellow        PIXEL_yellow
00303 
00308 #define COLOR_blue          PIXEL_blue
00309 
00314 #define COLOR_magenta       PIXEL_magenta
00315 
00320 #define COLOR_cyan          PIXEL_cyan
00321 
00326 #define COLOR_lightwhite    PIXEL_lightwhite
00327 
00332 #define COLOR_black         PIXEL_black
00333 
00338 #define SysColorIndex       SysPixelIndex
00339 
00371 typedef struct _BLOCKHEAP
00372 {
00373 #ifndef _LITE_VERSION
00374     pthread_mutex_t lock;
00375 #endif
00376 
00379     size_t          bd_size;
00383     size_t          heap_size;
00387     int             free;
00391     void*           heap;
00392 } BLOCKHEAP;
00393 
00400 typedef BLOCKHEAP* PBLOCKHEAP;
00401 
00424 MG_EXPORT extern void InitBlockDataHeap (PBLOCKHEAP heap, 
00425                 size_t bd_size, size_t heap_size);
00426 
00442 MG_EXPORT extern void* BlockDataAlloc (PBLOCKHEAP heap);
00443 
00457 MG_EXPORT extern void BlockDataFree (PBLOCKHEAP heap, void* data);
00458 
00467 MG_EXPORT extern void DestroyBlockDataHeap (PBLOCKHEAP heap);
00468 
00478 struct _BITMAP;
00479 
00484 typedef struct _BITMAP BITMAP;
00485 
00491 typedef BITMAP* PBITMAP;
00492 
00493 struct _MYBITMAP;
00494 
00499 typedef struct _MYBITMAP MYBITMAP;
00500 
00506 typedef struct _MYBITMAP* PMYBITMAP;
00507 
00544 typedef struct _CLIPRECT
00545 {
00549     RECT rc;
00553     struct _CLIPRECT* next;
00554 #ifdef _USE_NEWGAL
00555 
00559     struct _CLIPRECT* prev;
00560 #endif
00561 } CLIPRECT;
00562 typedef CLIPRECT* PCLIPRECT;
00563 
00564 /* Clipping Region */
00565 #ifdef _USE_NEWGAL
00566 #define NULLREGION      0x00
00567 #define SIMPLEREGION    0x01
00568 #define COMPLEXREGION   0x02
00569 #endif
00570 
00574 typedef struct _CLIPRGN
00575 {
00576 #ifdef _USE_NEWGAL
00577 
00588     BYTE            type;
00594     BYTE            reserved[3];
00595 #endif
00596 
00599     RECT            rcBound;
00603     PCLIPRECT       head;
00607     PCLIPRECT       tail;
00612     PBLOCKHEAP      heap;
00613 } CLIPRGN;
00614 
00621 typedef CLIPRGN* PCLIPRGN;
00622 
00636 #define InitFreeClipRectList(heap, size)    \
00637                 InitBlockDataHeap (heap, sizeof (CLIPRECT), size)
00638 
00649 #define ClipRectAlloc(heap)     BlockDataAlloc (heap)
00650 
00663 #define FreeClipRect(heap, cr)  BlockDataFree (heap, cr);
00664 
00676 #define DestroyFreeClipRectList(heap)   DestroyBlockDataHeap (heap);
00677 
00698 MG_EXPORT void GUIAPI InitClipRgn (PCLIPRGN pRgn, PBLOCKHEAP pFreeList);
00699 
00710 MG_EXPORT void GUIAPI EmptyClipRgn (PCLIPRGN pRgn);
00711 
00721 MG_EXPORT PCLIPRGN GUIAPI CreateClipRgn (void);
00722 
00733 MG_EXPORT void GUIAPI DestroyClipRgn (PCLIPRGN pRgn);
00734 
00751 MG_EXPORT BOOL GUIAPI ClipRgnCopy (PCLIPRGN pDstRgn, const CLIPRGN* pSrcRgn);
00752 
00773 MG_EXPORT BOOL GUIAPI ClipRgnIntersect (PCLIPRGN pRstRgn,
00774                        const CLIPRGN* pRgn1, const CLIPRGN* pRgn2);
00775 
00788 MG_EXPORT void GUIAPI GetClipRgnBoundRect (PCLIPRGN pRgn, PRECT pRect);
00789 
00806 MG_EXPORT BOOL GUIAPI SetClipRgn (PCLIPRGN pRgn, const RECT* pRect);
00807 
00821 MG_EXPORT BOOL GUIAPI IsEmptyClipRgn (const CLIPRGN* pRgn);
00822 
00836 MG_EXPORT BOOL GUIAPI AddClipRect (PCLIPRGN pRgn, const RECT* pRect);
00837 
00852 MG_EXPORT BOOL GUIAPI IntersectClipRect (PCLIPRGN pRgn, const RECT* pRect);
00853 
00868 MG_EXPORT BOOL GUIAPI SubtractClipRect (PCLIPRGN pRgn, const RECT* pRect);
00869 
00885 MG_EXPORT BOOL GUIAPI PtInRegion (PCLIPRGN region, int x, int y);
00886 
00901 MG_EXPORT BOOL GUIAPI RectInRegion (PCLIPRGN region, const RECT* rect);
00902 
00914 MG_EXPORT void GUIAPI OffsetRegion (PCLIPRGN region, int x, int y);
00915 
00916 #ifdef _USE_NEWGAL
00917 
00936 MG_EXPORT BOOL GUIAPI UnionRegion (PCLIPRGN dst, 
00937                 const CLIPRGN* src1, const CLIPRGN* src2);
00938 
00956 MG_EXPORT BOOL GUIAPI SubtractRegion (CLIPRGN* rgnD, 
00957                 const CLIPRGN* rgnM, const CLIPRGN* rgnS);
00958 
00977 MG_EXPORT BOOL GUIAPI XorRegion (CLIPRGN *dst, 
00978                 const CLIPRGN *src1, const CLIPRGN *src2);
00979 
00985 #define UnionRectWithRegion     AddClipRect
00986 
00992 #define CopyRegion              ClipRgnCopy
00993 
00999 #define IntersectRegion         ClipRgnIntersect
01000 
01016 MG_EXPORT BOOL GUIAPI InitCircleRegion (PCLIPRGN dst, int x, int y, int r);
01017 
01034 MG_EXPORT BOOL GUIAPI InitEllipseRegion (PCLIPRGN dst, 
01035                 int x, int y, int rx, int ry);
01036 
01051 MG_EXPORT BOOL GUIAPI InitPolygonRegion (PCLIPRGN dst, 
01052                 const POINT* pts, int vertices);
01053 
01054 #endif
01055 
01101 #define HDC_SCREEN          0
01102 
01107 #define HDC_INVALID         0
01108 
01109 #define GDCAP_COLORNUM      0
01110 #define GDCAP_HPIXEL        1
01111 #define GDCAP_VPIXEL        2
01112 #define GDCAP_MAXX          3
01113 #define GDCAP_MAXY          4
01114 #define GDCAP_DEPTH         5
01115 #define GDCAP_BPP           6
01116 #define GDCAP_BITSPP        7
01117 #define GDCAP_RMASK         8
01118 #define GDCAP_GMASK         9
01119 #define GDCAP_BMASK         10
01120 
01162 MG_EXPORT unsigned int GUIAPI GetGDCapability (HDC hdc, int iItem);
01163 
01181 MG_EXPORT HDC GUIAPI GetDC (HWND hwnd);
01182 
01200 MG_EXPORT HDC GUIAPI GetClientDC (HWND hwnd);
01201 
01212 MG_EXPORT void GUIAPI ReleaseDC (HDC hdc);
01213 
01232 MG_EXPORT HDC GUIAPI CreatePrivateDC (HWND hwnd);
01233 
01253 MG_EXPORT HDC GUIAPI CreatePrivateClientDC (HWND hwnd);
01254 
01276 MG_EXPORT HDC GUIAPI GetPrivateClientDC (HWND hwnd);
01277 
01287 MG_EXPORT void GUIAPI DeletePrivateDC (HDC hdc);
01288 
01289 #ifdef _USE_NEWGAL
01290 
01291 #define MEMDC_FLAG_NONE         0x00000000  /* None. */
01292 #define MEMDC_FLAG_SWSURFACE    0x00000000  /* DC is in system memory */
01293 #define MEMDC_FLAG_HWSURFACE    0x00000001  /* DC is in video memory */
01294 #define MEMDC_FLAG_SRCCOLORKEY  0x00001000  /* Blit uses a source color key */
01295 #define MEMDC_FLAG_SRCALPHA     0x00010000  /* Blit uses source alpha blending*/
01296 #define MEMDC_FLAG_RLEACCEL     0x00004000  /* Surface is RLE encoded */
01297 
01319 MG_EXPORT HDC GUIAPI CreateCompatibleDCEx (HDC hdc, int width, int height);
01320 
01356 MG_EXPORT HDC GUIAPI CreateMemDC (int width, int height, int depth, DWORD flags,
01357                 Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
01358 
01376 MG_EXPORT HDC GUIAPI CreateMemDCFromBitmap (HDC hdc, BITMAP* bmp);
01377 
01398 MG_EXPORT HDC GUIAPI CreateMemDCFromMyBitmap (const MYBITMAP* my_bmp, RGB* pal);
01399 
01425 MG_EXPORT BOOL GUIAPI ConvertMemDC (HDC mem_dc, HDC ref_dc, DWORD flags);
01426 
01456 MG_EXPORT BOOL GUIAPI SetMemDCAlpha (HDC mem_dc, DWORD flags, Uint8 alpha);
01457 
01479 MG_EXPORT BOOL GUIAPI SetMemDCColorKey (HDC mem_dc, DWORD flags, 
01480                 Uint32 color_key);
01481 
01496 MG_EXPORT void GUIAPI DeleteMemDC (HDC mem_dc);
01497 
01514 #define CreateCompatibleDC(hdc) CreateCompatibleDCEx(hdc, 0, 0);
01515 
01530 #define DeleteCompatibleDC(hdc) DeleteMemDC(hdc)
01531 
01571 MG_EXPORT Uint8* GUIAPI LockDC (HDC hdc, const RECT* rw_rc, 
01572                 int* width, int* height, int* pitch);
01573 
01584 MG_EXPORT void GUIAPI UnlockDC (HDC hdc);
01585 
01600 #define GAL_YV12_OVERLAY  0x32315659    /* Planar mode: Y + V + U  (3 planes) */
01601 #define GAL_IYUV_OVERLAY  0x56555949    /* Planar mode: Y + U + V  (3 planes) */
01602 #define GAL_YUY2_OVERLAY  0x32595559    /* Packed mode: Y0+U0+Y1+V0 (1 plane) */
01603 #define GAL_UYVY_OVERLAY  0x59565955    /* Packed mode: U0+Y0+V0+Y1 (1 plane) */
01604 #define GAL_YVYU_OVERLAY  0x55595659    /* Packed mode: Y0+V0+Y1+U0 (1 plane) */
01605 
01609 typedef struct _GAL_Overlay {
01611     Uint32 format;
01613     int w;
01615     int h;
01617     int planes;
01619     Uint16 *pitches;
01621     Uint8 **pixels;
01622 
01624     struct private_yuvhwfuncs *hwfuncs;
01626     struct private_yuvhwdata *hwdata;
01627 
01629     Uint32 hw_overlay :1;
01630     Uint32 UnusedBits :31;
01631 } GAL_Overlay;
01632 
01668 MG_EXPORT GAL_Overlay* GUIAPI CreateYUVOverlay (int width, int height,
01669                 Uint32 format, HDC hdc);
01670 
01679 int GAL_LockYUVOverlay (GAL_Overlay *overlay);
01680 
01689 void GAL_UnlockYUVOverlay (GAL_Overlay *overlay);
01690 
01696 #define LockYUVOverlay GAL_LockYUVOverlay
01697 
01703 #define UnlockYUVOverlay GAL_UnlockYUVOverlay
01704 
01717 void GAL_FreeYUVOverlay (GAL_Overlay *overlay);
01718 
01724 #define FreeYUVOverlay GAL_FreeYUVOverlay
01725 
01744 MG_EXPORT void GUIAPI DisplayYUVOverlay (GAL_Overlay* overlay, 
01745                 const RECT* dstrect);
01746 
01772 int GAL_SetGamma (float red, float green, float blue);
01773 
01779 #define SetGamma GAL_SetGamma
01780 
01806 int GAL_SetGammaRamp (Uint16 *red, Uint16 *green, Uint16 *blue);
01807 
01813 #define SetGammaRamp GAL_SetGammaRamp
01814 
01838 int GAL_GetGammaRamp (Uint16 *red, Uint16 *green, Uint16 *blue);
01839 
01845 #define GetGammaRamp GAL_GetGammaRamp
01846 
01849 #else
01850 
01851 MG_EXPORT HDC GUIAPI CreateCompatibleDC (HDC hdc);
01852 MG_EXPORT void GUIAPI DeleteCompatibleDC (HDC hdc);
01853 
01854 #endif /* _USE_NEWGAL */
01855 
01863 #define BM_TRANSPARENT          1
01864 #define BM_OPAQUE               0
01865 
01866 #ifdef _USE_NEWGAL
01867 
01868 #define DC_ATTR_BK_COLOR        0
01869 #define DC_ATTR_BK_MODE         1
01870 #define DC_ATTR_PEN_COLOR       2
01871 #define DC_ATTR_BRUSH_COLOR     3
01872 #define DC_ATTR_TEXT_COLOR      4
01873 #define DC_ATTR_TAB_STOP        5
01874 
01875 #define DC_ATTR_CHAR_EXTRA      6
01876 #define DC_ATTR_ALINE_EXTRA     7
01877 #define DC_ATTR_BLINE_EXTRA     8
01878 
01879 #define DC_ATTR_MAP_MODE        9
01880 
01881 #ifdef _ADV_2DAPI
01882 
01883 #define DC_ATTR_PEN_TYPE        10
01884 #define DC_ATTR_PEN_CAP_STYLE   11
01885 #define DC_ATTR_PEN_JOIN_STYLE  12
01886 #define DC_ATTR_PEN_WIDTH       13
01887 
01888 #define DC_ATTR_BRUSH_TYPE      14
01889 
01890 #define NR_DC_ATTRS             15
01891 
01892 #else
01893 
01894 #define NR_DC_ATTRS             10
01895 
01896 #endif
01897 
01898 
01935 MG_EXPORT Uint32 GUIAPI GetDCAttr (HDC hdc, int attr);
01936 
01952 MG_EXPORT Uint32 GUIAPI SetDCAttr (HDC hdc, int attr, Uint32 value);
01953 
01967 #define GetBkColor(hdc)     (gal_pixel) GetDCAttr (hdc, DC_ATTR_BK_COLOR)
01968 
01988 #define GetBkMode(hdc)      (int)       GetDCAttr (hdc, DC_ATTR_BK_MODE)
01989 
02003 #define GetPenColor(hdc)    (gal_pixel) GetDCAttr (hdc, DC_ATTR_PEN_COLOR)
02004 
02018 #define GetBrushColor(hdc)  (gal_pixel) GetDCAttr (hdc, DC_ATTR_BRUSH_COLOR)
02019 
02033 #define GetTextColor(hdc)   (gal_pixel) GetDCAttr (hdc, DC_ATTR_TEXT_COLOR)
02034 
02048 #define GetTabStop(hdc)     (int) GetDCAttr (hdc, DC_ATTR_TAB_STOP)
02049 
02064 #define SetBkColor(hdc, color)  \
02065                 (gal_pixel) SetDCAttr (hdc, DC_ATTR_BK_COLOR, (DWORD) color)
02066 
02088 #define SetBkMode(hdc, mode)    \
02089                 (int) SetDCAttr (hdc, DC_ATTR_BK_MODE, (DWORD) mode)
02090 
02105 #define SetPenColor(hdc, color) \
02106                 (gal_pixel) SetDCAttr (hdc, DC_ATTR_PEN_COLOR, (DWORD) color)
02107 
02122 #define SetBrushColor(hdc, color)   \
02123                 (gal_pixel) SetDCAttr (hdc, DC_ATTR_BRUSH_COLOR, (DWORD) color)
02124 
02139 #define SetTextColor(hdc, color)    \
02140                 (gal_pixel) SetDCAttr (hdc, DC_ATTR_TEXT_COLOR, (DWORD) color)
02141 
02156 #define SetTabStop(hdc, value)  \
02157                 (int) SetDCAttr (hdc, DC_ATTR_TAB_STOP, (DWORD) value)
02158 
02159 #define ROP_SET         0
02160 #define ROP_AND         1
02161 #define ROP_OR          2
02162 #define ROP_XOR         3
02163 
02186 MG_EXPORT int GUIAPI GetRasterOperation (HDC hdc);
02187 
02213 MG_EXPORT int GUIAPI SetRasterOperation (HDC hdc, int rop);
02214 
02215 #else
02216 
02217 MG_EXPORT gal_pixel GUIAPI GetBkColor (HDC hdc);
02218 MG_EXPORT int GUIAPI GetBkMode (HDC hdc);
02219 MG_EXPORT gal_pixel GUIAPI GetTextColor (HDC hdc);
02220 MG_EXPORT gal_pixel GUIAPI SetBkColor (HDC hdc, gal_pixel color);
02221 MG_EXPORT int GUIAPI SetBkMode (HDC hdc, int bkmode);
02222 MG_EXPORT gal_pixel GUIAPI SetTextColor (HDC hdc, gal_pixel color);
02223 
02224 MG_EXPORT int GUIAPI GetTabStop (HDC hdc);
02225 MG_EXPORT int GUIAPI SetTabStop (HDC hdc, int new_value);
02226 
02227 /* Pen and brush support */
02228 MG_EXPORT gal_pixel GUIAPI GetPenColor (HDC hdc);
02229 MG_EXPORT gal_pixel GUIAPI GetBrushColor (HDC hdc);
02230 MG_EXPORT gal_pixel GUIAPI SetPenColor (HDC hdc, gal_pixel color);
02231 MG_EXPORT gal_pixel GUIAPI SetBrushColor (HDC hdc, gal_pixel color);
02232 
02233 #endif /* _USE_NEWGAL */
02234 
02242 #ifdef _USE_NEWGAL
02243 
02259 MG_EXPORT BOOL GUIAPI GetPalette (HDC hdc, int start, int len, GAL_Color* cmap);
02260 
02275 MG_EXPORT BOOL GUIAPI SetPalette (HDC hdc, int start, int len, GAL_Color* cmap);
02276 
02288 MG_EXPORT BOOL GUIAPI SetColorfulPalette (HDC hdc);
02289 
02303 MG_EXPORT HPALETTE GUIAPI CreatePalette (GAL_Palette* pal);
02304 
02313 MG_EXPORT HPALETTE GUIAPI GetDefaultPalette (void);
02314 
02331 int GUIAPI GetPaletteEntries (HPALETTE hpal, 
02332                 int start, int len, GAL_Color* cmap);
02333 
02334 #else
02335 
02336 MG_EXPORT int GUIAPI GetPalette (HDC hdc, int start, int len, GAL_Color* cmap);
02337 MG_EXPORT int GUIAPI SetPalette (HDC hdc, int start, int len, GAL_Color* cmap);
02338 MG_EXPORT int GUIAPI SetColorfulPalette (HDC hdc);
02339 
02340 #endif /* _USE_NEWGAL */
02341 
02349 #ifdef _USE_NEWGAL
02350 
02367 MG_EXPORT void GUIAPI SetPixel (HDC hdc, int x, int y, gal_pixel pixel);
02368 
02387 MG_EXPORT gal_pixel GUIAPI SetPixelRGB (HDC hdc, int x, int y, 
02388                 Uint8 r, Uint8 g, Uint8 b);
02389 
02412 MG_EXPORT gal_pixel GUIAPI SetPixelRGBA (HDC hdc, int x, int y, 
02413                 Uint8 r, Uint8 g, Uint8 b, Uint8 a);
02414 
02430 MG_EXPORT gal_pixel GUIAPI GetPixel (HDC hdc, int x, int y);
02431 
02453 MG_EXPORT gal_pixel GUIAPI GetPixelRGB (HDC hdc, int x, int y, 
02454                 Uint8* r, Uint8* g, Uint8* b);
02455 
02481 MG_EXPORT gal_pixel GUIAPI GetPixelRGBA (HDC hdc, int x, int y, 
02482                 Uint8* r, Uint8* g, Uint8* b, Uint8* a);
02483 
02502 MG_EXPORT gal_pixel GUIAPI RGBA2Pixel (HDC hdc, 
02503                 Uint8 r, Uint8 g, Uint8 b, Uint8 a);
02504 
02520 MG_EXPORT gal_pixel GUIAPI RGB2Pixel (HDC hdc, Uint8 r, Uint8 g, Uint8 b);
02521 
02543 MG_EXPORT void GUIAPI Pixel2RGB (HDC hdc, gal_pixel pixel, 
02544                 Uint8* r, Uint8* g, Uint8* b);
02545 
02569 MG_EXPORT void GUIAPI Pixel2RGBA (HDC hdc, gal_pixel pixel, 
02570                 Uint8* r, Uint8* g, Uint8* b, Uint8* a);
02571 
02572 #else
02573 
02574 MG_EXPORT void GUIAPI SetPixel (HDC hdc, int x, int y, gal_pixel c);
02575 MG_EXPORT void GUIAPI SetPixelRGB (HDC hdc, int x, int y, int r, int g, int b);
02576 MG_EXPORT gal_pixel GUIAPI GetPixel (HDC hdc, int x, int y);
02577 MG_EXPORT void GUIAPI GetPixelRGB (HDC hdc, int x, int y, int* r, int* g, int* b);
02578 MG_EXPORT gal_pixel GUIAPI RGB2Pixel (HDC hdc, int r, int g, int b);
02579 
02580 #endif /* USE_NEWGAL */
02581 
02599 MG_EXPORT void GUIAPI FocusRect (HDC hdc, int x0, int y0, int x1, int y1);
02600 
02618 MG_EXPORT void GUIAPI DrawHVDotLine (HDC hdc, int x, int y, int w_h, BOOL H_V);
02619 
02636 #define DrawHDotLine(hdc, x, y, w) DrawHVDotLine (hdc, x, y, w, TRUE);
02637 
02654 #define DrawVDotLine(hdc, x, y, h) DrawHVDotLine (hdc, x, y, h, FALSE);
02655 
02656 #ifdef _USE_NEWGAL
02657 
02689 MG_EXPORT BOOL GUIAPI LineClipper (const RECT* cliprc, 
02690                 int *_x0, int *_y0, int *_x1, int *_y1);
02691 
02696 typedef void (* CB_LINE) (void* context, int stepx, int stepy);
02697 
02722 MG_EXPORT void GUIAPI LineGenerator (void* context, 
02723                 int x1, int y1, int x2, int y2, CB_LINE cb);
02724 
02729 typedef void (* CB_CIRCLE) (void* context, int x1, int x2, int y);
02730 
02760 MG_EXPORT void GUIAPI CircleGenerator (void* context, 
02761                 int sx, int sy, int r, CB_CIRCLE cb);
02762 
02767 typedef void (* CB_ELLIPSE) (void* context, int x1, int x2, int y);
02768 
02795 MG_EXPORT void GUIAPI EllipseGenerator (void* context, 
02796                 int sx, int sy, int rx, int ry, CB_ELLIPSE cb);
02797 
02802 typedef void (* CB_ARC) (void* context, int x, int y);
02803 
02829 MG_EXPORT void GUIAPI CircleArcGenerator (void* context, 
02830                 int sx, int sy, int r, int ang1, int ang2, CB_ARC cb);
02831 
02836 typedef void (* CB_POLYGON) (void* context, int x1, int x2, int y);
02837 
02878 MG_EXPORT BOOL GUIAPI MonotoneVerticalPolygonGenerator (void* context, 
02879                 const POINT* pts, int vertices, CB_POLYGON cb);
02880 
02897 MG_EXPORT BOOL GUIAPI PolygonIsMonotoneVertical (const POINT* pts, 
02898                 int vertices);
02899 
02927 MG_EXPORT BOOL GUIAPI PolygonGenerator (void* context, 
02928                 const POINT* pts, int vertices, CB_POLYGON cb);
02929 
02934 typedef BOOL (* CB_EQUAL_PIXEL) (void* context, int x, int y);
02935 
02940 typedef void (* CB_FLOOD_FILL) (void* context, int x1, int x2, int y);
02941 
02964 MG_EXPORT BOOL GUIAPI FloodFillGenerator (void* context, 
02965                 const RECT* src_rc, int x, int y, 
02966                 CB_EQUAL_PIXEL cb_equal_pixel, CB_FLOOD_FILL cb_flood_fill);
02967 
02972 typedef void* (* CB_GET_LINE_BUFF) (void* context, int y);
02973 
02978 typedef void (* CB_LINE_SCALED) (void* context, const void* line, int y);
02979 
03005 MG_EXPORT BOOL GUIAPI BitmapDDAScaler (void* context, 
03006                 const BITMAP* src_bmp, int dst_w, int dst_h, 
03007                 CB_GET_LINE_BUFF cb_get_line_buff, 
03008                 CB_LINE_SCALED cb_line_scaled);
03009 
03034 MG_EXPORT BOOL GUIAPI BitmapDDAScaler2 (void* context, 
03035                 const BITMAP* src_bmp, int dst_w, int dst_h, 
03036                 CB_GET_LINE_BUFF cb_get_line_buff, 
03037                 CB_LINE_SCALED cb_line_scaled);
03038 
03052 MG_EXPORT void GUIAPI MoveTo (HDC hdc, int x, int y);
03053 
03068 MG_EXPORT void GUIAPI LineTo (HDC hdc, int x, int y);
03069 
03085 MG_EXPORT void GUIAPI Rectangle (HDC hdc, int x0, int y0, int x1, int y1);
03086 
03101 MG_EXPORT void GUIAPI PolyLineTo (HDC hdc, const POINT* pts, int vertices);
03102 
03119 MG_EXPORT void GUIAPI SplineTo (HDC hdc, const POINT* pts);
03120 
03135 MG_EXPORT void GUIAPI Circle (HDC hdc, int sx, int sy, int r);
03136 
03155 MG_EXPORT void GUIAPI Ellipse (HDC hdc, int sx, int sy, int rx, int ry);
03156 
03180 MG_EXPORT void GUIAPI CircleArc (HDC hdc, int sx, int sy, int r, 
03181                 int ang1, int ang2);
03182 
03197 MG_EXPORT void GUIAPI FillBox (HDC hdc, int x, int y, int w, int h);
03198 
03214 MG_EXPORT void GUIAPI FillCircle (HDC hdc, int sx, int sy, int r);
03215 
03234 MG_EXPORT void GUIAPI FillEllipse (HDC hdc, int sx, int sy, int rx, int ry);
03235 
03251 MG_EXPORT BOOL GUIAPI FillPolygon (HDC hdc, const POINT* pts, int vertices);
03252 
03268 MG_EXPORT BOOL GUIAPI FloodFill (HDC hdc, int x, int y);
03269 
03270 #ifdef _ADV_2DAPI
03271 
03280 typedef enum
03281 {
03286   PT_SOLID,
03291   PT_ON_OFF_DASH,
03298   PT_DOUBLE_DASH,
03299 } PenType;
03300 
03312 #define GetPenType(hdc)                 \
03313                 (PenType) GetDCAttr (hdc, DC_ATTR_PEN_TYPE)
03314 
03327 #define SetPenType(hdc, type)           \
03328                 (PenType) SetDCAttr (hdc, DC_ATTR_PEN_TYPE, (DWORD) type)
03329 
03349 MG_EXPORT void GUIAPI SetPenDashes (HDC hdc, int dash_offset, 
03350                 const unsigned char* dash_list, int n);
03351 
03355 typedef enum
03356 {
03361   PT_CAP_BUTT,
03366   PT_CAP_ROUND,
03371   PT_CAP_PROJECTING
03372 } PTCapStyle;
03373 
03385 #define GetPenCapStyle(hdc)                 \
03386                 (PTCapStyle) GetDCAttr (hdc, DC_ATTR_PEN_CAP_STYLE)
03387 
03400 #define SetPenCapStyle(hdc, style)          \
03401             (PTCapStyle) SetDCAttr (hdc, DC_ATTR_PEN_CAP_STYLE, (DWORD) style)
03402 
03406 typedef enum
03407 {
03411   PT_JOIN_MITER,
03415   PT_JOIN_ROUND,
03420   PT_JOIN_BEVEL
03421 } PTJoinStyle;
03422 
03434 #define GetPenJoinStyle(hdc)           (PTJoinStyle) GetDCAttr (hdc, DC_ATTR_PEN_JOIN_STYLE)
03435 
03448 #define SetPenJoinStyle(hdc, style)         \
03449             (PTJoinStyle) SetDCAttr (hdc, DC_ATTR_PEN_JOIN_STYLE, (DWORD) style)
03450 
03462 #define GetPenWidth(hdc)                    \
03463                 (unsigned int) GetDCAttr (hdc, DC_ATTR_PEN_WIDTH)
03464 
03477 #define SetPenWidth(hdc, width)             \
03478                 (unsigned int) SetDCAttr (hdc, DC_ATTR_PEN_WIDTH, (DWORD) width)
03479 
03487 typedef enum
03488 {
03492   BT_SOLID,
03496   BT_TILED,
03503   BT_STIPPLED,
03510   BT_OPAQUE_STIPPLED
03511 } BrushType;
03512 
03524 #define GetBrushType(hdc)               \
03525                 (BrushType) GetDCAttr (hdc, DC_ATTR_BRUSH_TYPE)
03526 
03539 #define SetBrushType(hdc, type)         \
03540                 (BrushType) SetDCAttr (hdc, DC_ATTR_BRUSH_TYPE, (DWORD) type)
03541 
03543 typedef struct _STIPPLE
03544 {
03546     int width;
03548     int height;
03549 
03551     int pitch;
03552 
03554     size_t size;
03555 
03557     const unsigned char* bits;
03558 } STIPPLE;
03559 
03571 MG_EXPORT void GUIAPI SetBrushInfo (HDC hdc, 
03572                 const BITMAP* tile, const STIPPLE* stipple);
03573 
03588 MG_EXPORT void GUIAPI SetBrushOrigin (HDC hdc, int x, int y);
03589 
03609 MG_EXPORT void GUIAPI LineEx (HDC hdc, int x1, int y1, int x2, int y2);
03610 
03636 MG_EXPORT void GUIAPI ArcEx (HDC hdc, int x, int y, int width, int height, 
03637                 int ang1, int ang2);
03638 
03662 MG_EXPORT void GUIAPI FillArcEx (HDC hdc, int x, int y, int width, int height, 
03663                 int ang1, int ang2);
03664 
03677 MG_EXPORT void GUIAPI PolyLineEx (HDC hdc, const POINT* pts, int nr_pts);
03678 
03682 typedef struct _ARC
03683 {
03685     int x;
03687     int y;
03688 
03690     int width;
03692     int height;
03693 
03698     int angle1;
03702     int angle2;
03703 } ARC;
03704 
03717 MG_EXPORT void GUIAPI PolyArcEx (HDC hdc, const ARC* arcs, int nr_arcs);
03718 
03731 MG_EXPORT void GUIAPI PolyFillArcEx (HDC hdc, const ARC* arcs, int nr_arcs);
03732 
03751 MG_EXPORT BOOL GUIAPI RoundRect (HDC hdc, int x0, int y0, int x1, int y1, int cw, int ch);
03752 
03756 #endif
03757 
03758 #else
03759 
03760 /* Old GDI drawing functions */
03761 MG_EXPORT void GUIAPI MoveTo (HDC hdc, int x, int y);
03762 MG_EXPORT void GUIAPI LineTo (HDC hdc, int x, int y);
03763 MG_EXPORT void GUIAPI Rectangle (HDC hdc, int x0, int y0, int x1, int y1);
03764 MG_EXPORT void GUIAPI PolyLineTo (HDC hdc, const POINT* pts, int vertices);
03765 MG_EXPORT void GUIAPI Circle (HDC hdc, int sx, int sy, int r);
03766 MG_EXPORT void GUIAPI FillBox (HDC hdc, int x, int y, int w, int h);
03767 
03768 #endif
03769 
03815 #define MM_TEXT               0
03816 #define MM_ANISOTROPIC        1
03817 
03818 #ifdef _USE_NEWGAL
03819 
03839 #define GetMapMode(hdc)         (int)GetDCAttr (hdc, DC_ATTR_MAP_MODE)
03840 
03860 #define SetMapMode(hdc, mapmode)        \
03861                 (int)SetDCAttr (hdc, DC_ATTR_MAP_MODE, (DWORD)mapmode)
03862 
03863 #else
03864 
03865 MG_EXPORT int GUIAPI GetMapMode (HDC hdc);
03866 MG_EXPORT void GUIAPI SetMapMode (HDC hdc, int mapmode);
03867 
03868 #endif /* _USE_NEWGAL */
03869 
03870 #ifdef _USE_NEWGAL
03871 
03898 MG_EXPORT void GUIAPI GetDCLCS (HDC hdc, int which, POINT* pt);
03899 
03926 MG_EXPORT void GUIAPI SetDCLCS (HDC hdc, int which, const POINT* pt);
03927 
03928 #define DC_LCS_VORG     0
03929 #define DC_LCS_VEXT     1
03930 #define DC_LCS_WORG     2
03931 #define DC_LCS_WEXT     3
03932 #define NR_DC_LCS_PTS   4
03933 
03951 #define GetViewportOrg(hdc, pPt)    GetDCLCS(hdc, DC_LCS_VORG, pPt)
03952 
03970 #define GetViewportExt(hdc, pPt)    GetDCLCS(hdc, DC_LCS_VEXT, pPt)
03971 
03989 #define GetWindowOrg(hdc, pPt)      GetDCLCS(hdc, DC_LCS_WORG, pPt)
03990 
04008 #define GetWindowExt(hdc, pPt)      GetDCLCS(hdc, DC_LCS_WEXT, pPt)
04009 
04027 #define SetViewportOrg(hdc, pPt)    SetDCLCS(hdc, DC_LCS_VORG, pPt)
04028 
04046 #define SetViewportExt(hdc, pPt)    SetDCLCS(hdc, DC_LCS_VEXT, pPt)
04047 
04065 #define SetWindowOrg(hdc, pPt)      SetDCLCS(hdc, DC_LCS_WORG, pPt)
04066 
04084 #define SetWindowExt(hdc, pPt)      SetDCLCS(hdc, DC_LCS_WEXT, pPt)
04085 
04086 #else
04087 
04088 MG_EXPORT void GUIAPI GetViewportExt (HDC hdc, POINT* pPt);
04089 MG_EXPORT void GUIAPI GetViewportOrg (HDC hdc, POINT* pPt);
04090 MG_EXPORT void GUIAPI GetWindowExt (HDC hdc, POINT* pPt);
04091 MG_EXPORT void GUIAPI GetWindowOrg (HDC hdc, POINT* pPt);
04092 MG_EXPORT void GUIAPI SetViewportExt (HDC hdc, POINT* pPt);
04093 MG_EXPORT void GUIAPI SetViewportOrg (HDC hdc, POINT* pPt);
04094 MG_EXPORT void GUIAPI SetWindowExt (HDC hdc, POINT* pPt);
04095 MG_EXPORT void GUIAPI SetWindowOrg (HDC hdc, POINT* pPt);
04096 
04097 #endif /* _USE_NEWGAL */
04098 
04117 MG_EXPORT void GUIAPI DPtoLP (HDC hdc, POINT* pPt);
04118 
04137 MG_EXPORT void GUIAPI LPtoDP (HDC hdc, POINT* pPt);
04138 
04159 MG_EXPORT void GUIAPI ExcludeClipRect (HDC hdc, const RECT* prc);
04160 
04174 MG_EXPORT void GUIAPI IncludeClipRect (HDC hdc, const RECT* prc);
04175 
04191 MG_EXPORT BOOL GUIAPI PtVisible (HDC hdc, int x, int y);
04192 
04205 MG_EXPORT void GUIAPI ClipRectIntersect (HDC hdc, const RECT* prc);
04206 
04219 MG_EXPORT void GUIAPI SelectClipRect (HDC hdc, const RECT* prc);
04220 
04233 MG_EXPORT void GUIAPI SelectClipRegion (HDC hdc, const CLIPRGN* pRgn);
04234 
04247 MG_EXPORT void GUIAPI GetBoundsRect (HDC hdc, RECT* pRect);
04248 
04266 MG_EXPORT BOOL GUIAPI RectVisible (HDC hdc, const RECT* pRect);
04267 
04280 #ifdef _USE_NEWGAL
04281 
04308 MG_EXPORT BOOL GUIAPI GetBitmapFromDC (HDC hdc, 
04309                 int x, int y, int w, int h, BITMAP* bmp);
04310 
04311 #else
04312 
04313 MG_EXPORT void GUIAPI SaveScreenBox (int x, int y, int w, int h, void* vbuf);
04314 MG_EXPORT void* GUIAPI SaveCoveredScreenBox (int x, int y, int w, int h);
04315 MG_EXPORT void GUIAPI PutSavedBoxOnScreen (int x, int y, int w, int h, void* vbuf);
04316 MG_EXPORT void GUIAPI PutSavedBoxOnDC (HDC hdc, int x, int y, int w, int h, void* vbuf);
04317 
04318 MG_EXPORT void GUIAPI ScreenCopy (int sx, int sy, HDC hdc, int dx, int dy);
04319 
04320 #endif /* _USE_NEWGAL */
04321 
04360 MG_EXPORT BOOL GUIAPI FillBoxWithBitmap (HDC hdc, int x, int y, int w, int h,
04361                 const BITMAP *bmp);
04362 
04410 MG_EXPORT BOOL GUIAPI FillBoxWithBitmapPart (HDC hdc, 
04411                 int x, int y, int w, int h,
04412                 int bw, int bh, const BITMAP* bmp, int xo, int yo);
04413 
04448 MG_EXPORT void GUIAPI BitBlt (HDC hsdc, int sx, int sy, int sw, int sh, 
04449                 HDC hddc, int dx, int dy, DWORD dwRop);
04450 
04487 MG_EXPORT void GUIAPI StretchBlt (HDC hsdc, int sx, int sy, int sw, int sh, 
04488                 HDC hddc, int dx, int dy, int dw, int dh, DWORD dwRop);
04489 
04507 MG_EXPORT BOOL GUIAPI ScaleBitmap (BITMAP* dst, const BITMAP* src);
04508 
04528 MG_EXPORT gal_pixel GUIAPI GetPixelInBitmap (const BITMAP* bmp, int x, int y);
04529 
04552 MG_EXPORT BOOL GUIAPI SetPixelInBitmap (const BITMAP* bmp, 
04553                 int x, int y, gal_pixel pixel);
04554 
04555 #ifdef _MISC_SAVESCREEN
04556 
04575 MG_EXPORT BOOL GUIAPI SaveScreenRectContent (const RECT* rcWin, 
04576                 const char* filename);
04577 
04595 MG_EXPORT BOOL GUIAPI SaveMainWindowContent (HWND hWnd, const char* filename);
04596 #endif
04597 
04622 MG_EXPORT HICON GUIAPI LoadIconFromFile (HDC hdc, const char* filename, 
04623                 int which);
04624 
04643 MG_EXPORT HICON GUIAPI LoadIconFromMem (HDC hdc, const void* area, int which);
04644 
04669 MG_EXPORT HICON GUIAPI CreateIconEx (HDC hdc, int w, int h, 
04670                 const BYTE* AndBits, const BYTE* XorBits, int colornum, 
04671                 const RGB* pal);
04676 #define CreateIcon(hdc, w, h, AndBits, XorBits, colornum) \
04677         CreateIconEx(hdc, w, h, AndBits, XorBits, colornum, NULL)
04678 
04689 MG_EXPORT BOOL GUIAPI DestroyIcon (HICON hicon);
04690 
04704 MG_EXPORT BOOL GUIAPI GetIconSize (HICON hicon, int* w, int* h);
04705 
04723 MG_EXPORT void GUIAPI DrawIcon (HDC hdc, 
04724                 int x, int y, int w, int h, HICON hicon);
04725 
04733 #ifdef _USE_NEWGAL
04734 
04751 static inline void SetRect (RECT* prc, int left, int top, int right, int bottom)
04752 {
04753     (prc)->left = left; (prc)->top = top; 
04754     (prc)->right = right; (prc)->bottom = bottom;
04755 }
04756 
04772 static inline void SetRectEmpty (RECT* prc)
04773 {
04774     (prc)->left = (prc)->top = (prc)->right = (prc)->bottom = 0;
04775 }
04776 
04791 static inline void CopyRect (RECT* pdrc, const RECT* psrc)
04792 {
04793     (pdrc)->left = (psrc)->left; (pdrc)->top = (psrc)->top;
04794     (pdrc)->right = (psrc)->right; (pdrc)->bottom = (psrc)->bottom;
04795 }
04796 
04814 static inline void OffsetRect (RECT* prc, int x, int y)
04815 {
04816     (prc)->left += x; (prc)->top += y; (prc)->right += x; (prc)->bottom += y;
04817 }
04818 
04837 static inline void InflateRect (RECT* prc, int cx, int cy)
04838 {
04839     (prc)->left -= cx; (prc)->top -= cy; 
04840     (prc)->right += cx; (prc)->bottom += cy;
04841 }
04842 
04858 static inline void InflateRectToPt (RECT* prc, int x, int y)
04859 {
04860     if ((x) < (prc)->left) (prc)->left = (x); 
04861     if ((y) < (prc)->top) (prc)->top = (y);
04862     if ((x) > (prc)->right) (prc)->right = (x);
04863     if ((y) > (prc)->bottom) (prc)->bottom = (y);
04864 }
04865 
04883 static inline BOOL PtInRect(const RECT* prc, int x, int y)
04884 {
04885     if (x >= prc->left && x < prc->right && y >= prc->top && y < prc->bottom)
04886         return TRUE;
04887     return FALSE;
04888 }
04889 
04890 #else
04891 
04892 MG_EXPORT void GUIAPI SetRect (RECT* prc, int left, int top, 
04893                 int right, int bottom);
04894 MG_EXPORT void GUIAPI SetRectEmpty (RECT* prc);
04895 MG_EXPORT void GUIAPI CopyRect (RECT* pdrc, const RECT* psrc);
04896 MG_EXPORT void GUIAPI OffsetRect (RECT* prc, int x, int y);
04897 MG_EXPORT void GUIAPI InflateRect (RECT* prc, int cx, int cy);
04898 MG_EXPORT void GUIAPI InflateRectToPt (RECT* prc, int x, int y);
04899 MG_EXPORT BOOL GUIAPI PtInRect (const RECT* prc, int x, int y);
04900 
04901 #endif
04902 
04915 MG_EXPORT BOOL GUIAPI IsRectEmpty (const RECT* prc);
04916 
04929 MG_EXPORT BOOL GUIAPI EqualRect (const RECT* prc1, const RECT* prc2);
04930 
04940 MG_EXPORT void GUIAPI NormalizeRect (RECT* pRect);
04941 
04962 MG_EXPORT BOOL GUIAPI IntersectRect (RECT* pdrc, 
04963                 const RECT* psrc1, const RECT* psrc2);
04964 
04980 MG_EXPORT BOOL GUIAPI IsCovered (const RECT* prc1, const RECT* prc2);
04981 
04995 MG_EXPORT BOOL GUIAPI DoesIntersect (const RECT* psrc1, const RECT* psrc2);
04996 
05014 MG_EXPORT BOOL GUIAPI UnionRect (RECT* pdrc, 
05015                 const RECT* psrc1, const RECT* psrc2);
05016 
05032 MG_EXPORT void GUIAPI GetBoundRect (PRECT pdrc, 
05033                 const RECT* psrc1, const RECT* psrc2);
05034 
05051 MG_EXPORT int GUIAPI SubtractRect (RECT* rc, const RECT* psrc1, const RECT* psrc2);
05052 
05057 #define RECTWP(prc)  (prc->right - prc->left)
05058 
05062 #define RECTHP(prc)  (prc->bottom - prc->top)
05063 
05067 #define RECTW(rc)    (rc.right - rc.left)
05068 
05072 #define RECTH(rc)    (rc.bottom - rc.top)
05073 
05087 /* Font-related structures */
05088 #define LEN_FONT_NAME               15
05089 #define LEN_DEVFONT_NAME            79
05090 #define LEN_UNIDEVFONT_NAME         127
05091 
05092 #define FONT_WEIGHT_NIL             '\0'
05093 #define FONT_WEIGHT_ALL             '*'
05094 #define FONT_WEIGHT_BLACK           'c'
05095 #define FONT_WEIGHT_BOLD            'b'
05096 #define FONT_WEIGHT_BOOK            'k'
05097 #define FONT_WEIGHT_DEMIBOLD        'd'
05098 #define FONT_WEIGHT_LIGHT           'l'
05099 #define FONT_WEIGHT_MEDIUM          'm'
05100 #define FONT_WEIGHT_REGULAR         'r'
05101 
05102 #define FS_WEIGHT_MASK              0x000000FF
05103 #define FS_WEIGHT_BLACK             0x00000001
05104 #define FS_WEIGHT_BOLD              0x00000002
05105 #define FS_WEIGHT_BOOK              0x00000004
05106 #define FS_WEIGHT_DEMIBOLD          0x00000006 /* BOOK | BOLD */
05107 #define FS_WEIGHT_LIGHT             0x00000010
05108 #define FS_WEIGHT_MEDIUM            0x00000020
05109 #define FS_WEIGHT_REGULAR           0x00000000
05110 
05111 #define FONT_SLANT_NIL              '\0'
05112 #define FONT_SLANT_ALL              '*'
05113 #define FONT_SLANT_ITALIC           'i'
05114 #define FONT_SLANT_OBLIQUE          'o'
05115 #define FONT_SLANT_ROMAN            'r'
05116 
05117 #define FS_SLANT_MASK               0x00000F00
05118 #define FS_SLANT_ITALIC             0x00000100
05119 #define FS_SLANT_OBLIQUE            0x00000200
05120 #define FS_SLANT_ROMAN              0x00000000
05121 
05122 #define FONT_FLIP_NIL               '\0'
05123 #define FONT_FLIP_HORZ              'H'
05124 #define FONT_FLIP_VERT              'V'
05125 #define FONT_FLIP_HORZVERT          'T'
05126 
05127 #define FS_FLIP_MASK                0x0000F000
05128 #define FS_FLIP_HORZ                0x00001000
05129 #define FS_FLIP_VERT                0x00002000
05130 #define FS_FLIP_HORZVERT            0x00003000 /* HORZ | VERT */
05131 
05132 #define FONT_OTHER_NIL              '\0'
05133 #define FONT_OTHER_AUTOSCALE        'S'
05134 #define FONT_OTHER_TTFNOCACHE       'N'
05135 
05136 #define FS_OTHER_MASK               0x000F0000
05137 #define FS_OTHER_AUTOSCALE          0x00010000
05138 #define FS_OTHER_TTFNOCACHE         0x00020000
05139 
05140 /* 
05141  * Backward compatiblilty definitions. 
05142  * All FONT_SETWIDTH_* and FONT_SPACING_* types will 
05143  * be treated as FONT_FLIP_NIL and FONT_OTHER_NIL respectively. 
05144  */
05145 #define FONT_SETWIDTH_NIL           '\0'
05146 #define FONT_SETWIDTH_ALL           '*'
05147 #define FONT_SETWIDTH_BOLD          'b'
05148 #define FONT_SETWIDTH_CONDENSED     'c'
05149 #define FONT_SETWIDTH_SEMICONDENSED 's'
05150 #define FONT_SETWIDTH_NORMAL        'n'
05151 #define FONT_SETWIDTH_TTFNOCACHE    'w'
05152 
05153 /*
05154 #define FS_SETWIDTH_MASK            0x0000F000
05155 #define FS_SETWIDTH_BOLD            0x00001000
05156 #define FS_SETWIDTH_CONDENSED       0x00002000
05157 #define FS_SETWIDTH_SEMICONDENSED   0x00004000
05158 #define FS_SETWIDTH_TTFNOCACHE      0x00008000
05159 #define FS_SETWIDTH_NORMAL          0x00000000
05160 */
05161 
05162 #define FONT_SPACING_NIL            '\0'
05163 #define FONT_SPACING_ALL            '*'
05164 #define FONT_SPACING_MONOSPACING    'm'
05165 #define FONT_SPACING_PROPORTIONAL   'p'
05166 #define FONT_SPACING_CHARCELL       'c'
05167 
05168 /*
05169 #define FS_SPACING_MASK             0x000F0000
05170 #define FS_SPACING_MONOSPACING      0x00010000
05171 #define FS_SPACING_PROPORTIONAL     0x00020000
05172 #define FS_SPACING_CHARCELL         0x00000000
05173 */
05174 
05175 #define FONT_UNDERLINE_NIL          '\0'
05176 #define FONT_UNDERLINE_ALL          '*'
05177 #define FONT_UNDERLINE_LINE         'u'
05178 #define FONT_UNDERLINE_NONE         'n'
05179 
05180 #define FS_UNDERLINE_MASK           0x00F00000
05181 #define FS_UNDERLINE_LINE           0x00100000
05182 #define FS_UNDERLINE_NONE           0x00000000
05183 
05184 #define FONT_STRUCKOUT_NIL          '\0'
05185 #define FONT_STRUCKOUT_ALL          '*'
05186 #define FONT_STRUCKOUT_LINE         's'
05187 #define FONT_STRUCKOUT_NONE         'n'
05188 
05189 #define FS_STRUCKOUT_MASK           0x0F000000
05190 #define FS_STRUCKOUT_LINE           0x01000000
05191 #define FS_STRUCKOUT_NONE           0x00000000
05192 
05193 #define FONT_TYPE_NAME_BITMAP_RAW   "rbf"
05194 #define FONT_TYPE_NAME_BITMAP_VAR   "vbf"
05195 #define FONT_TYPE_NAME_BITMAP_QPF   "qpf"
05196 #define FONT_TYPE_NAME_SCALE_TTF    "ttf"
05197 #define FONT_TYPE_NAME_SCALE_T1F    "t1f"
05198 #define FONT_TYPE_NAME_ALL          "*"
05199 
05200 #define FONT_TYPE_BITMAP_RAW        0x0001  /* "rbf" */
05201 #define FONT_TYPE_BITMAP_VAR        0x0002  /* "vbf" */
05202 #define FONT_TYPE_BITMAP_QPF        0x0003  /* "qpf" */
05203 #define FONT_TYPE_SCALE_TTF         0x0010  /* "ttf" */
05204 #define FONT_TYPE_SCALE_T1F         0x0011  /* "t1f" */
05205 #define FONT_TYPE_ALL               0xFFFF  /* "all" */
05206 
05207 #define FONT_CHARSET_US_ASCII       "US-ASCII"
05208 
05209 #define FONT_CHARSET_ISO8859_1      "ISO8859-1"
05210 #define FONT_CHARSET_ISO8859_2      "ISO8859-2"
05211 #define FONT_CHARSET_ISO8859_3      "ISO8859-3"
05212 #define FONT_CHARSET_ISO8859_4      "ISO8859-4"
05213 #define FONT_CHARSET_ISO8859_5      "ISO8859-5"
05214 #define FONT_CHARSET_ISO8859_6      "ISO8859-6"
05215 #define FONT_CHARSET_ISO8859_7      "ISO8859-7"
05216 #define FONT_CHARSET_ISO8859_8      "ISO8859-8"
05217 #define FONT_CHARSET_ISO8859_9      "ISO8859-9"
05218 #define FONT_CHARSET_ISO8859_10     "ISO8859-10"
05219 #define FONT_CHARSET_ISO8859_11     "ISO8859-11"
05220 #define FONT_CHARSET_ISO8859_12     "ISO8859-12"
05221 #define FONT_CHARSET_ISO8859_13     "ISO8859-13"
05222 #define FONT_CHARSET_ISO8859_14     "ISO8859-14"
05223 #define FONT_CHARSET_ISO8859_15     "ISO8859-15"
05224 #define FONT_CHARSET_ISO8859_16     "ISO8859-16"
05225 
05226 #define FONT_CHARSET_EUC_CN         "EUC-CN"
05227 
05232 #define FONT_CHARSET_GB1988_0       "GB1988-0"      
05233 
05238 #define FONT_CHARSET_GB2312_0       "GB2312-0"      
05239 #define FONT_CHARSET_GBK            "GBK"
05240 
05245 #define FONT_CHARSET_GB18030_0      "GB18030-0"     
05246 #define FONT_CHARSET_BIG5           "BIG5"
05247 
05252 #define FONT_CHARSET_EUCTW          "EUC-TW"        
05253 #define FONT_CHARSET_EUCKR          "EUC-KR"
05254 
05259 #define FONT_CHARSET_KSC5636_0      "KSC5636-0"     
05260 
05265 #define FONT_CHARSET_KSC5601_0      "KSC5601-0"     
05266 #define FONT_CHARSET_EUCJP          "EUC-JP"
05267 
05272 #define FONT_CHARSET_JISX0201_0     "JISX0201-0"    
05273 
05278 #define FONT_CHARSET_JISX0208_0     "JISX0208-0"    
05279 #define FONT_CHARSET_SHIFTJIS       "SHIFT-JIS"
05280 
05285 #define FONT_CHARSET_JISX0201_1     "JISX0201-1"    
05286 
05291 #define FONT_CHARSET_JISX0208_1     "JISX0208-1"    
05292 
05297 #define FONT_CHARSET_ISO_10646_1    "ISO-10646-1"   
05298 #define FONT_CHARSET_UTF8           "UTF-8"
05299 
05300 #define FONT_MAX_SIZE               256
05301 #define FONT_MIN_SIZE               4
05302 
05303 struct _DEVFONT;
05304 typedef struct _DEVFONT DEVFONT;
05305 
05307 typedef struct _LOGFONT {
05309     char type [LEN_FONT_NAME + 1];
05311     char family [LEN_FONT_NAME + 1];
05313     char charset [LEN_FONT_NAME + 1];
05315     DWORD style;
05317     int size;
05319     int rotation;
05321     unsigned short sbc_scale;
05323     unsigned short mbc_scale;
05325     DEVFONT* sbc_devfont;
05327     DEVFONT* mbc_devfont;
05328 } LOGFONT;
05333 typedef LOGFONT*    PLOGFONT;
05334 
05335 struct _WORDINFO;
05340 typedef struct _WORDINFO WORDINFO;
05341 
05342 #define MAX_LEN_MCHAR               4
05343 
05344 typedef struct _CHARSETOPS
05345 {
05346     int nr_chars;
05347     int bytes_per_char;
05348     int bytes_maxlen_char;
05349     const char* name;
05350     char def_char [MAX_LEN_MCHAR];
05351 
05352     int (*len_first_char) (const unsigned char* mstr, int mstrlen);
05353     unsigned int (*char_offset) (const unsigned char* mchar);
05354 
05355     int (*nr_chars_in_str) (const unsigned char* mstr, int mstrlen);
05356 
05357     int (*is_this_charset) (const unsigned char* charset);
05358 
05359     int (*len_first_substr) (const unsigned char* mstr, int mstrlen);
05360     const unsigned char* (*get_next_word) (const unsigned char* mstr, 
05361                 int strlen, WORDINFO* word_info);
05362 
05363     int (*pos_first_char) (const unsigned char* mstr, int mstrlen);
05364 
05365 #ifdef _UNICODE_SUPPORT
05366     unsigned short (*conv_to_uc16) (const unsigned char* mchar, int len);
05367     int (*conv_from_uc16) (unsigned short wc, unsigned char* mchar);
05368 #endif /* LITE_VERSION */
05369 } CHARSETOPS;
05370 
05371 typedef struct _FONTOPS
05372 {
05373     int (*get_char_width) (LOGFONT* logfont, DEVFONT* devfont, 
05374             const unsigned char* mchar, int len);
05375     int (*get_ave_width) (LOGFONT* logfont, DEVFONT* devfont);
05376     int (*get_max_width) (LOGFONT* logfont, DEVFONT* devfont);
05377     int (*get_font_height) (LOGFONT* logfont, DEVFONT* devfont);
05378     int (*get_font_size) (LOGFONT* logfont, DEVFONT* devfont, int expect);
05379     int (*get_font_ascent) (LOGFONT* logfont, DEVFONT* devfont);
05380     int (*get_font_descent) (LOGFONT* logfont, DEVFONT* devfont);
05381 
05382     const void* (*get_char_bitmap) (LOGFONT* logfont, DEVFONT* devfont, 
05383             const unsigned char* mchar, int len, unsigned short* scale);
05384     
05385     const void* (*get_char_pixmap) (LOGFONT* logfont, DEVFONT* devfont, 
05386             const unsigned char* mchar, int len, 
05387             int* pitch, unsigned short* scale);
05388          /* Can be NULL */
05389 
05390     void (*start_str_output) (LOGFONT* logfont, DEVFONT* devfont);
05391          /* Can be NULL */
05392     int (*get_char_bbox) (LOGFONT* logfont, DEVFONT* devfont,
05393             const unsigned char* mchar, int len,
05394             int* px, int* py, int* pwidth, int* pheight);
05395          /* Can be NULL */
05396     void (*get_char_advance) (LOGFONT* logfont, DEVFONT* devfont,
05397             const unsigned char* mchar, int len, int* px, int* py);
05398          /* Can be NULL */
05399 
05400     DEVFONT* (*new_instance) (LOGFONT* logfont, DEVFONT* devfont, 
05401             BOOL need_sbc_font);
05402          /* Can be NULL */
05403     void (*delete_instance) (DEVFONT* devfont);
05404          /* Can be NULL */
05405 } FONTOPS;
05406 
05407 struct _DEVFONT
05408 {
05409     char             name [LEN_UNIDEVFONT_NAME + 1];
05410     DWORD            style;
05411     FONTOPS*         font_ops;
05412     CHARSETOPS*      charset_ops;
05413     struct _DEVFONT* sbc_next;
05414     struct _DEVFONT* mbc_next;
05415     void*            data;
05416 };
05417 
05418 #define SBC_DEVFONT_INFO(logfont) (logfont.sbc_devfont)
05419 #define MBC_DEVFONT_INFO(logfont) (logfont.mbc_devfont)
05420 
05421 #define SBC_DEVFONT_INFO_P(logfont) (logfont->sbc_devfont)
05422 #define MBC_DEVFONT_INFO_P(logfont) (logfont->mbc_devfont)
05423 
05428 #define INV_LOGFONT     0
05429 
05431 typedef struct _FONTMETRICS
05432 {
05434     int font_height;
05436     int ascent;
05438     int descent;
05439 
05441     int max_width;
05443     int ave_width;
05444 } FONTMETRICS;
05445 
05460 MG_EXPORT void GUIAPI GetFontMetrics (LOGFONT* log_font, 
05461                 FONTMETRICS* font_metrics);
05462 
05464 typedef struct _GLYPHBITMAP
05465 {
05467     int bbox_x, bbox_y, bbox_w, bbox_h;
05469     int advance_x, advance_y;
05470 
05472     size_t bmp_size;
05474     int bmp_pitch;
05476     const unsigned char* bits;
05477 } GLYPHBITMAP;
05478 
05505 MG_EXPORT void GUIAPI GetGlyphBitmap (LOGFONT* log_font, 
05506                 const unsigned char* mchar, int mchar_len, 
05507                 GLYPHBITMAP* glyph_bitmap);
05508 
05509 #ifdef _LITE_VERSION
05510 
05529 MG_EXPORT BOOL GUIAPI InitVectorialFonts (void);
05530 
05543 MG_EXPORT void GUIAPI TermVectorialFonts (void);
05544 
05545 #endif
05546 
05641 MG_EXPORT PLOGFONT GUIAPI CreateLogFont (const char* type, const char* family, 
05642         const char* charset, char weight, char slant, char flip, 
05643         char other, char underline, char struckout, 
05644         int size, int rotation);
05645 
05659 MG_EXPORT PLOGFONT GUIAPI CreateLogFontByName (const char* font_name);
05660 
05672 MG_EXPORT PLOGFONT GUIAPI CreateLogFontIndirect (LOGFONT* logfont);
05673 
05684 MG_EXPORT void GUIAPI DestroyLogFont (PLOGFONT log_font);
05685 
05699 MG_EXPORT void GUIAPI GetLogFontInfo (HDC hdc, LOGFONT* log_font);
05700 
05713 MG_EXPORT PLOGFONT GUIAPI GetCurFont (HDC hdc);
05714 
05733 MG_EXPORT PLOGFONT GUIAPI SelectFont (HDC hdc, PLOGFONT log_font);
05734 
05745 MG_EXPORT const DEVFONT* GUIAPI GetNextDevFont (const DEVFONT* dev_font);
05746 
05765 #define SYSLOGFONT_DEFAULT          0
05766 
05771 #define SYSLOGFONT_WCHAR_DEF        1
05772 
05777 #define SYSLOGFONT_FIXED            2
05778 
05783 #define SYSLOGFONT_CAPTION          3
05784 
05789 #define SYSLOGFONT_MENU             4
05790 
05795 #define SYSLOGFONT_CONTROL          5
05796 
05797 #define NR_SYSLOGFONTS              6
05798 
05799 
05800 extern MG_EXPORT PLOGFONT g_SysLogFont [];
05801 
05825 static inline PLOGFONT GUIAPI GetSystemFont (int font_id)
05826 {
05827     if (font_id >= 0 && font_id < NR_SYSLOGFONTS)
05828         return g_SysLogFont [font_id];
05829     else
05830         return (PLOGFONT)NULL;
05831 }
05832 
05847 MG_EXPORT int GUIAPI GetSysFontMaxWidth (int font_id);
05848 
05863 MG_EXPORT int GUIAPI GetSysFontAveWidth (int font_id);
05864 
05878 MG_EXPORT int GUIAPI GetSysFontHeight (int font_id);
05879 
05894 MG_EXPORT const char* GUIAPI GetSysCharset (BOOL wchar);
05895 
05910 MG_EXPORT int GUIAPI GetSysCharHeight (void);
05911 
05925 MG_EXPORT int GUIAPI GetSysCharWidth (void);
05926 
05938 MG_EXPORT int GUIAPI GetSysCCharWidth (void);
05939 
05953 struct _WORDINFO
05954 {
05956     int len;
05958     unsigned char delimiter;
05960     int nr_delimiters;
05961 };
05962 
05982 MG_EXPORT int GUIAPI GetTextMCharInfo (PLOGFONT log_font, 
05983                 const char* mstr, int len, int* pos_chars);
05984 
06008 MG_EXPORT int GUIAPI GetTextWordInfo (PLOGFONT log_font, const char* mstr, 
06009                 int len, int* pos_words, WORDINFO* info_words);
06010 
06026 MG_EXPORT int GUIAPI GetFirstMCharLen (PLOGFONT log_font, 
06027                 const char* mstr, int len);
06028 
06049 MG_EXPORT int GUIAPI GetFirstWord (PLOGFONT log_font, 
06050                 const char* mstr, int len, WORDINFO* word_info);
06051 
06052 #ifdef _UNICODE_SUPPORT
06053 
06054 #include <stdlib.h>
06055 
06074 MG_EXPORT int GUIAPI MB2WC (PLOGFONT log_font, 
06075                 wchar_t* dest, const unsigned char* mstr, int n);
06076 
06094 MG_EXPORT int GUIAPI WC2MB (PLOGFONT log_font, unsigned char *s, wchar_t wc);
06095 
06122 MG_EXPORT int GUIAPI MBS2WCS (PLOGFONT log_font, wchar_t* dest, 
06123                 const unsigned char* mstr, int mstr_len, int n);
06124 
06150 MG_EXPORT int GUIAPI WCS2MBS (PLOGFONT log_font, unsigned char* dest, 
06151                 const wchar_t *wcs, int wcs_len, int n);
06152 
06153 #endif /* _UNICODE_SUPPORT */
06154 
06186 MG_EXPORT int GUIAPI GetTextExtentPoint (HDC hdc, const char* text, int len, 
06187                 int max_extent, int* fit_chars, int* pos_chars, 
06188                 int* dx_chars, SIZE* size);
06189 
06190 
06199 MG_EXPORT int GUIAPI GetTabbedTextExtentPoint (HDC hdc, 
06200                 const char* text, int len, int max_extent, 
06201                 int* fit_chars, int* pos_chars, int* dx_chars, SIZE* size);
06202 
06222 MG_EXPORT int GUIAPI GetFontHeight (HDC hdc);
06223 
06237 MG_EXPORT int GUIAPI GetMaxFontWidth (HDC hdc);
06238 
06255 MG_EXPORT void GUIAPI GetTextExtent (HDC hdc, 
06256                 const char* spText, int len, SIZE* pSize);
06257 
06276 MG_EXPORT void GUIAPI GetTabbedTextExtent (HDC hdc, 
06277                 const char* spText, int len, SIZE* pSize);
06278 
06279 #ifdef _USE_NEWGAL
06280 
06291 #define GetTextCharacterExtra(hdc)  (int)GetDCAttr (hdc, DC_ATTR_CHAR_EXTRA)
06292 
06303 #define GetTextAboveLineExtra(hdc)  (int)GetDCAttr (hdc, DC_ATTR_ALINE_EXTRA)
06304 
06315 #define GetTextBellowLineExtra(hdc) (int)GetDCAttr (hdc, DC_ATTR_BLINE_EXTRA)
06316 
06328 #define SetTextCharacterExtra(hdc, extra)       \
06329                 (int)SetDCAttr (hdc, DC_ATTR_CHAR_EXTRA, (DWORD) extra)
06330 
06341 #define SetTextAboveLineExtra(hdc, extra)       \
06342                 (int)SetDCAttr (hdc, DC_ATTR_ALINE_EXTRA, (DWORD) extra)
06343 
06354 #define SetTextBellowLineExtra(hdc, extra)      \
06355                 (int)SetDCAttr (hdc, DC_ATTR_BLINE_EXTRA, (DWORD) extra)
06356 
06357 #else
06358 
06359 MG_EXPORT int GUIAPI GetTextCharacterExtra (HDC hdc);
06360 MG_EXPORT int GUIAPI SetTextCharacterExtra (HDC hdc, int extra);
06361 MG_EXPORT int GUIAPI GetTextAboveLineExtra (HDC hdc);
06362 MG_EXPORT int GUIAPI SetTextAboveLineExtra (HDC hdc, int extra);
06363 MG_EXPORT int GUIAPI GetTextBellowLineExtra (HDC hdc);
06364 MG_EXPORT int GUIAPI SetTextBellowLineExtra (HDC hdc, int extra);
06365 
06366 #endif /* _USE_NEWGAL */
06367 
06386 MG_EXPORT int GUIAPI TextOutLen (HDC hdc, int x, int y, 
06387                 const char* spText, int len);
06388 
06409 MG_EXPORT int GUIAPI TabbedTextOutLen (HDC hdc, int x, int y, 
06410                 const char* spText, int len); 
06411 
06437 MG_EXPORT int GUIAPI TabbedTextOutEx (HDC hdc, int x, int y, 
06438                 const char* spText, int nCount, 
06439                 int nTabPositions, int *pTabPositions, int nTabOrigin);
06440 
06450 MG_EXPORT void GUIAPI GetLastTextOutPos (HDC hdc, POINT* pt);
06451 
06460 #define TextOut(hdc, x, y, text)    TextOutLen (hdc, x, y, text, -1)
06461 
06470 #define TabbedTextOut(hdc, x, y, text)  TabbedTextOutLen (hdc, x, y, text, -1)
06471 
06472 #define DT_TOP              0x00000000
06473 #define DT_LEFT             0x00000000
06474 #define DT_CENTER           0x00000001
06475 #define DT_RIGHT            0x00000002
06476 #define DT_VCENTER          0x00000004
06477 #define DT_BOTTOM           0x00000008
06478 #define DT_WORDBREAK        0x00000010
06479 #define DT_SINGLELINE       0x00000020
06480 #define DT_EXPANDTABS       0x00000040
06481 #define DT_TABSTOP          0x00000080
06482 #define DT_NOCLIP           0x00000100
06483 #define DT_EXTERNALLPADING  0x00000200
06484 #define DT_CALCRECT         0x00000400
06485 #define DT_NOPREFIX         0x00000800
06486 #define DT_INTERNAL         0x00001000
06487 #define DT_CHARBREAK        0x00002000
06488 
06492 typedef struct _DTFIRSTLINE
06493 {   
06495     int nr_chars;
06497     int startx;
06499     int starty;
06501     int width;
06503     int height;
06504 } DTFIRSTLINE;
06505 
06581 MG_EXPORT int GUIAPI DrawTextEx2 (HDC hdc, const char* pText, int nCount, 
06582                 RECT* pRect, int nIndent, UINT nFormat, DTFIRSTLINE *firstline);
06583 
06593 #define DrawText(hdc, text, n, rc, format)          \
06594                 DrawTextEx2 (hdc, text, n, rc, 0, format, NULL)
06595 
06604 #define DrawTextEx(hdc, text, n, rc, indent, format)    \
06605                 DrawTextEx2 (hdc, text, n, rc, indent, format, NULL)
06606 
06640 #define MYBMP_TYPE_NORMAL       0x00000000
06641 #define MYBMP_TYPE_RLE4         0x00000001
06642 #define MYBMP_TYPE_RLE8         0x00000002
06643 #define MYBMP_TYPE_RGB          0x00000003
06644 #define MYBMP_TYPE_BGR          0x00000004
06645 #define MYBMP_TYPE_RGBA         0x00000005
06646 #define MYBMP_TYPE_MASK         0x0000000F
06647 
06648 #define MYBMP_FLOW_DOWN         0x00000010
06649 #define MYBMP_FLOW_UP           0x00000020
06650 #define MYBMP_FLOW_MASK         0x000000F0
06651 
06652 #define MYBMP_TRANSPARENT       0x00000100
06653 #define MYBMP_ALPHACHANNEL      0x00000200
06654 #define MYBMP_ALPHA             0x00000400
06655 
06656 #define MYBMP_RGBSIZE_3         0x00001000
06657 #define MYBMP_RGBSIZE_4         0x00002000
06658 
06659 #define MYBMP_LOAD_GRAYSCALE    0x00010000
06660 #define MYBMP_LOAD_ALLOCATE_ONE 0x00020000
06661 #define MYBMP_LOAD_NONE         0x00000000
06662 
06664 struct _MYBITMAP
06665 {
06695     DWORD flags;
06697     int   frames;
06699     Uint8 depth;
06701     Uint8 alpha;
06702     Uint8 reserved [2];
06704     Uint32 transparent;
06705 
06707     Uint32 w;
06709     Uint32 h;
06711     Uint32 pitch;
06713     Uint32 size;
06714 
06716     BYTE* bits;
06717 };
06718 
06719 #ifdef _USE_NEWGAL
06720 
06721 #define BMP_TYPE_NORMAL         0x00
06722 #define BMP_TYPE_RLE            0x01
06723 #define BMP_TYPE_ALPHA          0x02
06724 #define BMP_TYPE_ALPHACHANNEL   0x04
06725 #define BMP_TYPE_COLORKEY       0x10
06726 #define BMP_TYPE_PRIV_PIXEL     0x20
06727 
06728 #ifdef _FOR_MONOBITMAP
06729   #define BMP_TYPE_MONOKEY      0x40
06730 #endif
06731 
06733 struct _BITMAP
06734 {
06764     Uint8   bmType;
06766     Uint8   bmBitsPerPixel;
06768     Uint8   bmBytesPerPixel;
06770     Uint8   bmAlpha;
06772     Uint32  bmColorKey;
06773 #ifdef _FOR_MONOBITMAP
06774     Uint32  bmColorRep;
06775 #endif
06776 
06778     Uint32  bmWidth;
06780     Uint32  bmHeight;
06782     Uint32  bmPitch;
06784     Uint8*  bmBits;
06785 
06787     void*   bmAlphaPixelFormat;
06788 };
06789 
06790 #else
06791 
06792 #define BMP_TYPE_NORMAL         0x00
06793 #define BMP_TYPE_COLORKEY       0x01
06794 
06795 /* expanded bitmap struct */
06796 struct _BITMAP
06797 {
06798     Uint8   bmType;
06799     Uint8   bmBitsPerPixel;
06800     Uint8   bmBytesPerPixel;
06801     Uint8   bmReserved;
06802 
06803     Uint32  bmColorKey;
06804 
06805     Uint32  bmWidth;
06806     Uint32  bmHeight;
06807     Uint32  bmPitch;
06808 
06809     void*   bmBits;
06810     Uint32  bmReserved1;
06811 };
06812 
06813 #endif /* _USE_NEWGAL */
06814 
06826 #include <stdio.h>
06827 #include "endianrw.h"
06828 
06833 typedef void (* CB_ONE_SCANLINE) (void* context, MYBITMAP* my_bmp, int y);
06834 
06869 MG_EXPORT BOOL GUIAPI RegisterBitmapFileType (const char *ext,
06870             void* (*init) (MG_RWops* fp, MYBITMAP *my_bmp, RGB *pal),
06871             int (*load) (MG_RWops* fp, void* init_info, MYBITMAP *my_bmp, 
06872                     CB_ONE_SCANLINE cb, void* context),
06873             void (*cleanup) (void* init_info),
06874             int (*save) (MG_RWops* fp, MYBITMAP *my_bmp, RGB *pal),
06875             BOOL (*check) (MG_RWops* fp));
06876 
06891 MG_EXPORT const char* GUIAPI CheckBitmapType (MG_RWops* fp);
06892 
06893 #define ERR_BMP_OK              0
06894 #define ERR_BMP_IMAGE_TYPE      -1
06895 #define ERR_BMP_UNKNOWN_TYPE    -2
06896 #define ERR_BMP_CANT_READ       -3
06897 #define ERR_BMP_CANT_SAVE       -4
06898 #define ERR_BMP_NOT_SUPPORTED   -5   
06899 #define ERR_BMP_MEM             -6
06900 #define ERR_BMP_LOAD            -7
06901 #define ERR_BMP_FILEIO          -8
06902 #define ERR_BMP_OTHER           -9
06903 #define ERR_BMP_ERROR_SOURCE    -10
06904 
06932 MG_EXPORT int GUIAPI LoadBitmapEx (HDC hdc, PBITMAP pBitmap, 
06933                 MG_RWops* area, const char* ext);
06934 
06942 MG_EXPORT int GUIAPI LoadBitmapFromFile (HDC hdc, PBITMAP pBitmap, 
06943                 const char* spFileName);
06944 
06951 #define LoadBitmap  LoadBitmapFromFile
06952 
06960 MG_EXPORT int GUIAPI LoadBitmapFromMem (HDC hdc, PBITMAP pBitmap, 
06961                 const void* mem, int size, const char* ext);
06962 
06974 MG_EXPORT void GUIAPI UnloadBitmap (PBITMAP pBitmap);
06975 
06990 MG_EXPORT void GUIAPI ReplaceBitmapColor (HDC hdc, PBITMAP pBitmap, 
06991                 gal_pixel iOColor, gal_pixel iNColor);
06992 
06993 
06994 void GUIAPI HFlipBitmap (BITMAP* bmp, unsigned char* inter_buff);
06995 void GUIAPI VFlipBitmap (BITMAP* bmp, unsigned char* inter_buff);
06996 
07015 MG_EXPORT void* GUIAPI InitMyBitmapSL (MG_RWops* area, 
07016                 const char* ext, MYBITMAP* my_bmp, RGB* pal);
07017 
07036 MG_EXPORT int GUIAPI LoadMyBitmapSL (MG_RWops* area, void* load_info, 
07037                 MYBITMAP* my_bmp, CB_ONE_SCANLINE cb, void* context);
07038 
07053 MG_EXPORT int GUIAPI CleanupMyBitmapSL (MYBITMAP* my_bmp, void* load_info);
07054 
07070 MG_EXPORT int GUIAPI LoadMyBitmapEx (PMYBITMAP my_bmp, RGB* pal, 
07071                 MG_RWops* area, const char* ext);
07072 
07080 MG_EXPORT int GUIAPI LoadMyBitmapFromFile (PMYBITMAP my_bmp, RGB* pal, 
07081                 const char* file_name);
07082 
07089 #define LoadMyBitmap    LoadMyBitmapFromFile
07090 
07106 MG_EXPORT int GUIAPI LoadMyBitmapFromMem (PMYBITMAP my_bmp, RGB* pal, 
07107                 const void* mem, int size, const char* ext);
07108 
07120 MG_EXPORT void GUIAPI UnloadMyBitmap (PMYBITMAP my_bmp);
07121 
07122 #ifdef _SAVE_BITMAP
07123 
07140 MG_EXPORT int GUIAPI SaveMyBitmapToFile (PMYBITMAP my_bmp, RGB* pal, 
07141                 const char* spFileName);
07142 
07158 MG_EXPORT int GUIAPI SaveBitmapToFile (HDC hdc, PBITMAP pBitmap, 
07159                 const char* spFileName);
07160 #define SaveBitmap  SaveBitmapToFile 
07161 #endif
07162 
07184 MG_EXPORT BOOL GUIAPI InitBitmap (HDC hdc, Uint32 w, Uint32 h, Uint32 pitch, 
07185                 BYTE* bits, PBITMAP bmp);
07186 
07187 #ifdef _USE_NEWGAL
07188 
07204 MG_EXPORT BOOL GUIAPI InitBitmapPixelFormat (HDC hdc, PBITMAP bmp);
07205 
07215 MG_EXPORT void GUIAPI DeleteBitmapAlphaPixel (PBITMAP bmp);
07216 
07232 MG_EXPORT int GUIAPI ExpandMyBitmap (HDC hdc, PBITMAP bmp, 
07233                 const MYBITMAP* my_bmp, const RGB* pal, int frame);
07234 
07235 void GUIAPI ExpandMonoBitmap (HDC hdc, BYTE* bits, Uint32 pitch, 
07236                 const BYTE* my_bits, Uint32 my_pitch, 
07237                 Uint32 w, Uint32 h, DWORD flags, Uint32 bg, Uint32 fg);
07238 void GUIAPI Expand16CBitmap (HDC hdc, BYTE* bits, Uint32 pitch, 
07239                 const BYTE* my_bits, Uint32 my_pitch, 
07240                 Uint32 w, Uint32 h, DWORD flags, const RGB* pal);
07241 void GUIAPI Expand256CBitmap (HDC hdc, BYTE* bits, Uint32 pitch, 
07242                 const BYTE* my_bits, Uint32 my_pitch, 
07243                 Uint32 w, Uint32 h, DWORD flags, const RGB* pal);
07244 void GUIAPI CompileRGBABitmap (HDC hdc, BYTE* bits, Uint32 pitch, 
07245                 const BYTE* my_bits, Uint32 my_pitch, 
07246                 Uint32 w, Uint32 h, DWORD flags, void* pixel_format);
07247 
07248 #define CompileRGBBitmap CompileRGBABitmap 
07249 
07278 MG_EXPORT int GUIAPI PaintImageEx (HDC hdc, int x, int y, 
07279                 MG_RWops* area, const char* ext);
07280 
07295 MG_EXPORT int GUIAPI PaintImageFromFile (HDC hdc, int x, int y, 
07296                 const char* spFileName);
07297 
07314 MG_EXPORT int GUIAPI PaintImageFromMem (HDC hdc, int x, int y, 
07315                 const void* mem, int size, const char* ext);
07316 
07348 MG_EXPORT int GUIAPI StretchPaintImageEx (HDC hdc, int x, int y, int w, int h, 
07349                 MG_RWops* area, const char* ext);
07350 
07367 MG_EXPORT int GUIAPI StretchPaintImageFromFile (HDC hdc, int x, int y, 
07368                 int w, int h, const char* spFileName);
07369 
07388 MG_EXPORT int GUIAPI StretchPaintImageFromMem (HDC hdc, int x, int y, 
07389                 int w, int h, const void* mem, int size, const char* ext);
07390 
07391 #ifdef _FIXED_MATH
07392 
07408 MG_EXPORT void GUIAPI RotateBitmap (HDC hdc, const BITMAP *bmp, 
07409                 int lx, int ty, int angle);
07410 
07421 MG_EXPORT void GUIAPI RotateBitmapVFlip (HDC hdc, const BITMAP *bmp, 
07422                 int lx, int ty, int angle);
07423 
07432 MG_EXPORT void GUIAPI RotateBitmapHFlip (HDC hdc, const BITMAP *bmp, 
07433                 int lx, int ty, int angle);
07434 
07443 MG_EXPORT void GUIAPI RotateScaledBitmap (HDC hdc, const BITMAP *bmp, 
07444                 int lx, int ty, int angle, int w, int h);
07445 
07457 MG_EXPORT void GUIAPI RotateScaledBitmapVFlip (HDC hdc, const BITMAP *bmp, 
07458                 int lx, int ty, int angle, int w, int h);
07459 
07471 MG_EXPORT void GUIAPI RotateScaledBitmapHFlip (HDC hdc, const BITMAP *bmp, 
07472                 int lx, int ty, int angle, int w, int h);
07473 
07485 MG_EXPORT void GUIAPI PivotBitmap(HDC hdc, const BITMAP *bmp, 
07486                 int lx, int ty, int cx, int cy, int angle);
07487 
07514 MG_EXPORT void GUIAPI PivotScaledBitmapFlip (HDC hdc, const BITMAP *bmp, 
07515                 fixed x, fixed y, fixed cx, fixed cy, int angle, fixed scale_x, 
07516                 fixed scale_y, BOOL h_flip, BOOL v_flip);
07517 
07518 #endif /*_FIXED_MATH*/
07519 
07520 #else
07521 
07522 MG_EXPORT int GUIAPI ExpandMyBitmap (HDC hdc, const MYBITMAP* pMyBitmap, 
07523                 const RGB* pal, PBITMAP pBitmap);
07524 MG_EXPORT void GUIAPI ExpandMonoBitmap (HDC hdc, int w, int h, 
07525                 const BYTE* my_bits, int my_pitch, int bits_flow, 
07526                 BYTE* bitmap, int pitch, int bg, int fg);
07527 MG_EXPORT void GUIAPI Expand16CBitmap (HDC hdc, int w, int h, 
07528                 const BYTE* my_bits, int my_pitch, int bits_flow,
07529                 BYTE* bitmap, int pitch, const RGB* pal);
07530 MG_EXPORT void GUIAPI Expand256CBitmap (HDC hdc, int w, int h, 
07531                 const BYTE* my_bits, int my_pitch, int bits_flow,
07532                 BYTE* bitmap, int pitch, const RGB* pal);
07533 MG_EXPORT void GUIAPI CompileRGBBitmap (HDC hdc, int w, int h, 
07534                 const BYTE* my_bits, int my_pitch, int bits_flow,
07535                 BYTE* bitmap, int pitch, int rgb_order);
07536 
07537 #endif /* _USE_NEWGAL */
07538 
07545 #ifdef __cplusplus
07546 }
07547 #endif  /* __cplusplus */
07548 
07549 #endif  /* _MGUI_GDI_H */
07550 
07551 

Generated on Mon Jun 26 13:54:27 2006 for MiniGUI V1.6.9 API Reference by  doxygen 1.4.2