gdi.h

Go to the documentation of this file.
00001 
00021 /*
00022  * $Id: gdi.h 13751 2011-03-22 03:08:37Z houhuihua $
00023  *
00024  *             MiniGUI for Linux/uClinux, eCos, uC/OS-II, VxWorks, 
00025  *                     pSOS, ThreadX, NuCleus, OSE, and Win32.
00026  *
00027  *             Copyright (C) 2002-2009 Feynman Software.
00028  *             Copyright (C) 1998-2002 Wei Yongming.
00029  */
00030 
00031 #ifndef _MGUI_GDI_H
00032     #define _MGUI_GDI_H
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 #ifdef _MGRM_THREADS
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 
00508 
00545 typedef struct _CLIPRECT
00546 {
00550     RECT rc;
00554     struct _CLIPRECT* next;
00558     struct _CLIPRECT* prev;
00559 } CLIPRECT;
00560 typedef CLIPRECT* PCLIPRECT;
00561 
00562 /* Clipping Region */
00563 #define NULLREGION      0x00
00564 #define SIMPLEREGION    0x01
00565 #define COMPLEXREGION   0x02
00566 
00570 typedef struct _CLIPRGN
00571 {
00581     BYTE            type;
00585     BYTE            reserved[3];
00589     RECT            rcBound;
00593     PCLIPRECT       head;
00597     PCLIPRECT       tail;
00602     PBLOCKHEAP      heap;
00603 } CLIPRGN;
00604 
00611 typedef CLIPRGN* PCLIPRGN;
00612 
00626 #define InitFreeClipRectList(heap, size)    \
00627                 InitBlockDataHeap (heap, sizeof (CLIPRECT), size)
00628 
00639 #define ClipRectAlloc(heap)     BlockDataAlloc (heap)
00640 
00653 #define FreeClipRect(heap, cr)  BlockDataFree (heap, cr);
00654 
00666 #define DestroyFreeClipRectList(heap)   DestroyBlockDataHeap (heap);
00667 
00688 MG_EXPORT void GUIAPI InitClipRgn (PCLIPRGN pRgn, PBLOCKHEAP pFreeList);
00689 
00700 MG_EXPORT void GUIAPI EmptyClipRgn (PCLIPRGN pRgn);
00701 
00711 MG_EXPORT PCLIPRGN GUIAPI CreateClipRgn (void);
00712 
00723 MG_EXPORT void GUIAPI DestroyClipRgn (PCLIPRGN pRgn);
00724 
00741 MG_EXPORT BOOL GUIAPI ClipRgnCopy (PCLIPRGN pDstRgn, const CLIPRGN* pSrcRgn);
00742 
00763 MG_EXPORT BOOL GUIAPI ClipRgnIntersect (PCLIPRGN pRstRgn,
00764                        const CLIPRGN* pRgn1, const CLIPRGN* pRgn2);
00765 
00778 MG_EXPORT void GUIAPI GetClipRgnBoundRect (PCLIPRGN pRgn, PRECT pRect);
00779 
00796 MG_EXPORT BOOL GUIAPI SetClipRgn (PCLIPRGN pRgn, const RECT* pRect);
00797 
00811 MG_EXPORT BOOL GUIAPI IsEmptyClipRgn (const CLIPRGN* pRgn);
00812 
00826 MG_EXPORT BOOL GUIAPI AddClipRect (PCLIPRGN pRgn, const RECT* pRect);
00827 
00842 MG_EXPORT BOOL GUIAPI IntersectClipRect (PCLIPRGN pRgn, const RECT* pRect);
00843 
00858 MG_EXPORT BOOL GUIAPI SubtractClipRect (PCLIPRGN pRgn, const RECT* pRect);
00859 
00875 MG_EXPORT BOOL GUIAPI PtInRegion (PCLIPRGN region, int x, int y);
00876 
00891 MG_EXPORT BOOL GUIAPI RectInRegion (PCLIPRGN region, const RECT* rect);
00892 
00908 MG_EXPORT void GUIAPI OffsetRegionEx (PCLIPRGN region, const RECT *rcClient,
00909                             const RECT *rcScroll, int x, int y);
00910 
00922 MG_EXPORT void GUIAPI OffsetRegion (PCLIPRGN region, int x, int y);
00923 
00940 MG_EXPORT BOOL GUIAPI UnionRegion (PCLIPRGN dst, 
00941                 const CLIPRGN* src1, const CLIPRGN* src2);
00942 
00958 MG_EXPORT BOOL GUIAPI SubtractRegion (CLIPRGN* rgnD, 
00959                 const CLIPRGN* rgnM, const CLIPRGN* rgnS);
00960 
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 
01014 MG_EXPORT BOOL GUIAPI InitCircleRegion (PCLIPRGN dst, int x, int y, int r);
01015 
01030 MG_EXPORT BOOL GUIAPI InitEllipseRegion (PCLIPRGN dst, 
01031                 int x, int y, int rx, int ry);
01032 
01045 MG_EXPORT BOOL GUIAPI InitPolygonRegion (PCLIPRGN dst, 
01046                 const POINT* pts, int vertices);
01047 
01093 #define HDC_SCREEN          0
01094 
01095 /* 
01096  * This is a system screen DC create for MiniGUI internal usage, for example,
01097  * menu and z-order operations
01098  */
01099 #define HDC_SCREEN_SYS      1
01100 
01105 #define HDC_INVALID         0xFFFFFFFF
01106 
01107 #define GDCAP_COLORNUM      0
01108 #define GDCAP_HPIXEL        1
01109 #define GDCAP_VPIXEL        2
01110 #define GDCAP_MAXX          3
01111 #define GDCAP_MAXY          4
01112 #define GDCAP_DEPTH         5
01113 #define GDCAP_BPP           6
01114 #define GDCAP_BITSPP        7
01115 #define GDCAP_RMASK         8
01116 #define GDCAP_GMASK         9
01117 #define GDCAP_BMASK         10
01118 #define GDCAP_AMASK         11
01119 #define GDCAP_PITCH         12
01120 
01166 MG_EXPORT unsigned int GUIAPI GetGDCapability (HDC hdc, int iItem);
01167 
01185 MG_EXPORT HDC GUIAPI GetDC (HWND hwnd);
01186 
01204 MG_EXPORT HDC GUIAPI GetClientDC (HWND hwnd);
01205 
01230 MG_EXPORT HDC GUIAPI GetSubDC (HDC hdc, int off_x, int off_y, int width, int height);
01231 
01242 MG_EXPORT void GUIAPI ReleaseDC (HDC hdc);
01243 
01257 MG_EXPORT HWND GUIAPI WindowFromDC (HDC hdc);
01258 
01279 MG_EXPORT int GUIAPI SaveDC (HDC hdc);
01280 
01306 MG_EXPORT BOOL GUIAPI RestoreDC (HDC hdc, int saved_dc);
01307 
01308 #define MEMDC_FLAG_NONE             0x00000000  /* None. */
01309 #define MEMDC_FLAG_SWSURFACE        0x00000000  /* DC is in system memory */
01310 #define MEMDC_FLAG_HWSURFACE        0x00000001  /* DC is in video memory */
01311 #define MEMDC_FLAG_SRCCOLORKEY      0x00001000  /* Blit uses a source color key */
01312 #define MEMDC_FLAG_SRCALPHA         0x00010000  /* Blit uses source alpha blending*/
01313 #define MEMDC_FLAG_SRCPIXELALPHA    0x00020000  /* Blit uses source per-pixel alpha blending*/
01314 #define MEMDC_FLAG_RLEACCEL         0x00004000  /* Surface is RLE encoded */
01315 
01336 MG_EXPORT HDC GUIAPI CreateCompatibleDCEx (HDC hdc, int width, int height);
01337 
01352 MG_EXPORT BOOL GUIAPI IsCompatibleDC (HDC hdc1, HDC hdc2);
01353 
01397 MG_EXPORT HDC GUIAPI CreateMemDCEx (int width, int height, int depth, DWORD flags,
01398         Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask, 
01399         void* bits, int pitch);
01400 
01434 static inline HDC GUIAPI CreateMemDC (int width, int height, int depth, DWORD flags,
01435         Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
01436 {
01437     return CreateMemDCEx (width, height, depth, flags, Rmask, Gmask, Bmask, Amask,
01438             NULL, 0);
01439 }
01440 
01465 MG_EXPORT HDC GUIAPI CreateSubMemDC (HDC parent, int off_x, int off_y, 
01466                 int width, int height, BOOL comp_to_parent);
01467 
01483 MG_EXPORT HDC GUIAPI CreateMemDCFromBitmap (HDC hdc, const BITMAP* bmp);
01484 
01510 MG_EXPORT HDC GUIAPI CreateMemDCFromMyBitmap (const MYBITMAP* my_bmp, const RGB* pal);
01511 
01535 MG_EXPORT BOOL GUIAPI ConvertMemDC (HDC mem_dc, HDC ref_dc, DWORD flags);
01536 
01566 MG_EXPORT BOOL GUIAPI SetMemDCAlpha (HDC mem_dc, DWORD flags, Uint8 alpha);
01567 
01587 MG_EXPORT BOOL GUIAPI SetMemDCColorKey (HDC mem_dc, DWORD flags, 
01588                 Uint32 color_key);
01589 
01602 MG_EXPORT void GUIAPI DeleteMemDC (HDC mem_dc);
01603 
01616 #define CreateCompatibleDC(hdc) CreateCompatibleDCEx(hdc, 0, 0)
01617 
01628 #define DeleteCompatibleDC(hdc) DeleteMemDC(hdc)
01629 
01667 MG_EXPORT Uint8* GUIAPI LockDC (HDC hdc, const RECT* rw_rc, 
01668                 int* width, int* height, int* pitch);
01669 
01686 typedef void (* CB_DIRECT_DRAW_RECT) (HDC hdc, Uint8 * pixels,
01687         int pitch, int bytesPerPixel, const RECT* rc, void* context);
01688 
01715 MG_EXPORT BOOL GUIAPI LockDCEx (HDC hdc, const PCLIPRGN region, 
01716         void* context, CB_DIRECT_DRAW_RECT cb);
01717 
01726 MG_EXPORT void GUIAPI UnlockDC (HDC hdc);
01727 
01746 MG_EXPORT HDC GUIAPI CreatePrivateDC (HWND hwnd);
01747 
01767 MG_EXPORT HDC GUIAPI CreatePrivateClientDC (HWND hwnd);
01768 
01795 HDC GUIAPI CreatePrivateSubDC(HDC hdc, int off_x, int off_y,
01796         int width, int height);
01797 
01819 MG_EXPORT HDC GUIAPI GetPrivateClientDC (HWND hwnd);
01820 
01830 MG_EXPORT void GUIAPI DeletePrivateDC (HDC hdc);
01831 
01854 MG_EXPORT HDC GUIAPI CreateSecondaryDC (HWND hwnd);
01855 
01871 typedef int (* ON_UPDATE_SECONDARYDC)(HWND hwnd, HDC secondary_dc, 
01872         HDC real_dc, const RECT* secondary_rc, const RECT* real_rc,
01873         const RECT* main_update_rc);
01874 
01875 #define ON_UPDSECDC_DEFAULT     ((ON_UPDATE_SECONDARYDC)0)
01876 #define ON_UPDSECDC_DONOTHING   ((ON_UPDATE_SECONDARYDC)0xFFFFFFFF)
01877 
01903 MG_EXPORT HDC GUIAPI SetSecondaryDC (HWND hwnd, HDC secondary_dc, 
01904         ON_UPDATE_SECONDARYDC on_update_secondarydc);
01905 
01922 MG_EXPORT HDC GUIAPI GetSecondaryDC (HWND hwnd);
01923 
01940 MG_EXPORT HDC GUIAPI GetSecondaryClientDC (HWND hwnd);
01941 
01953 MG_EXPORT void GUIAPI ReleaseSecondaryDC (HWND hwnd, HDC hdc);
01954 
01963 MG_EXPORT void GUIAPI DeleteSecondaryDC (HWND hwnd);
01964 
01972 #define BM_TRANSPARENT          1
01973 #define BM_OPAQUE               0
01974 
01975 #define DC_ATTR_BK_COLOR        0
01976 #define DC_ATTR_PEN_COLOR       1
01977 #define DC_ATTR_BRUSH_COLOR     2
01978 #define DC_ATTR_TEXT_COLOR      3
01979 
01980 #define DC_ATTR_BK_MODE         4
01981 
01982 #define DC_ATTR_TAB_STOP        5
01983 #define DC_ATTR_CHAR_EXTRA      6
01984 #define DC_ATTR_ALINE_EXTRA     7
01985 #define DC_ATTR_BLINE_EXTRA     8
01986 
01987 #define DC_ATTR_MAP_MODE        9
01988 
01989 #define DC_ATTR_TEXT_ALIGN      10
01990 
01991 #ifdef _MGHAVE_ADV_2DAPI
01992 
01993 #define DC_ATTR_PEN_TYPE        11
01994 #define DC_ATTR_PEN_CAP_STYLE   12
01995 #define DC_ATTR_PEN_JOIN_STYLE  13
01996 #define DC_ATTR_PEN_WIDTH       14
01997 
01998 #define DC_ATTR_BRUSH_TYPE      15
01999 
02000 #define NR_DC_ATTRS             16
02001 
02002 #else
02003 
02004 #define NR_DC_ATTRS             11
02005 
02006 #endif
02007 
02008 
02053 MG_EXPORT Uint32 GUIAPI GetDCAttr (HDC hdc, int attr);
02054 
02068 MG_EXPORT Uint32 GUIAPI SetDCAttr (HDC hdc, int attr, Uint32 value);
02069 
02079 #define GetBkColor(hdc)     GetDCAttr (hdc, DC_ATTR_BK_COLOR)
02080 
02096 #define GetBkMode(hdc)      GetDCAttr (hdc, DC_ATTR_BK_MODE)
02097 
02107 #define GetPenColor(hdc)    GetDCAttr (hdc, DC_ATTR_PEN_COLOR)
02108 
02118 #define GetBrushColor(hdc)  GetDCAttr (hdc, DC_ATTR_BRUSH_COLOR)
02119 
02129 #define GetTextColor(hdc)   GetDCAttr (hdc, DC_ATTR_TEXT_COLOR)
02130 
02140 #define GetTabStop(hdc)     GetDCAttr (hdc, DC_ATTR_TAB_STOP)
02141 
02152 #define SetBkColor(hdc, color)  \
02153                 SetDCAttr (hdc, DC_ATTR_BK_COLOR, (DWORD) color)
02154 
02172 #define SetBkMode(hdc, mode)    \
02173                 SetDCAttr (hdc, DC_ATTR_BK_MODE, (DWORD) mode)
02174 
02185 #define SetPenColor(hdc, color) \
02186                 SetDCAttr (hdc, DC_ATTR_PEN_COLOR, (DWORD) color)
02187 
02198 #define SetBrushColor(hdc, color)   \
02199                 SetDCAttr (hdc, DC_ATTR_BRUSH_COLOR, (DWORD) color)
02200 
02211 #define SetTextColor(hdc, color)    \
02212                 SetDCAttr (hdc, DC_ATTR_TEXT_COLOR, (DWORD) color)
02213 
02224 #define SetTabStop(hdc, value)  \
02225                 SetDCAttr (hdc, DC_ATTR_TAB_STOP, (DWORD) value)
02226 
02227 #define ROP_SET         0
02228 #define ROP_AND         1
02229 #define ROP_OR          2
02230 #define ROP_XOR         3
02231 #define ROP_COMPOSITE   4
02232 #define ROP_COMP_USER   0x0100
02233 /* Reserved for future
02234  * #define ROP_COMP_XXX    0x01XX
02235  */
02236 
02261 MG_EXPORT int GUIAPI GetRasterOperation (HDC hdc);
02262 
02290 MG_EXPORT int GUIAPI SetRasterOperation (HDC hdc, int rop);
02291 
02314 MG_EXPORT int GUIAPI GetPalette (HDC hdc, int start, int len, GAL_Color* cmap);
02315 
02330 MG_EXPORT BOOL GUIAPI SetPalette (HDC hdc, int start, int len, GAL_Color* cmap);
02331 
02343 MG_EXPORT BOOL GUIAPI SetColorfulPalette (HDC hdc);
02344 
02358 MG_EXPORT HPALETTE GUIAPI CreatePalette (GAL_Palette* pal);
02359 
02375 MG_EXPORT BOOL GUIAPI SelectPalette (HDC hdc, HPALETTE hpal, BOOL reserved);
02376 
02398 MG_EXPORT BOOL GUIAPI RealizePalette (HDC hdc);
02399 
02413 MG_EXPORT BOOL GUIAPI ResizePalette (HPALETTE hpal, int len);
02414 
02425 MG_EXPORT void GUIAPI DestroyPalette (HPALETTE hpal);
02426 
02435 MG_EXPORT HPALETTE GUIAPI GetDefaultPalette (void);
02436 
02453 MG_EXPORT int GUIAPI GetPaletteEntries (HPALETTE hpal, 
02454                 int start, int len, GAL_Color* cmap);
02455 
02472 MG_EXPORT int GUIAPI SetPaletteEntries (HPALETTE hpal, 
02473                 int start, int len, GAL_Color* cmap);
02474 
02493 MG_EXPORT UINT GUIAPI GetNearestPaletteIndex (HPALETTE hpal, 
02494                 Uint8 red, Uint8 green, Uint8 blue);
02495 
02513 MG_EXPORT RGBCOLOR GUIAPI GetNearestColor (HDC hdc, 
02514                 Uint8 red, Uint8 green, Uint8 blue);
02515 
02539 MG_EXPORT void GUIAPI SetPixel (HDC hdc, int x, int y, gal_pixel pixel);
02540 
02559 MG_EXPORT gal_pixel GUIAPI SetPixelRGB (HDC hdc, int x, int y, 
02560                 Uint8 r, Uint8 g, Uint8 b);
02561 
02582 MG_EXPORT gal_pixel GUIAPI SetPixelRGBA (HDC hdc, int x, int y, 
02583                 Uint8 r, Uint8 g, Uint8 b, Uint8 a);
02584 
02600 MG_EXPORT gal_pixel GUIAPI GetPixel (HDC hdc, int x, int y);
02601 
02623 MG_EXPORT gal_pixel GUIAPI GetPixelRGB (HDC hdc, int x, int y, 
02624                 Uint8* r, Uint8* g, Uint8* b);
02625 
02651 MG_EXPORT gal_pixel GUIAPI GetPixelRGBA (HDC hdc, int x, int y, 
02652                 Uint8* r, Uint8* g, Uint8* b, Uint8* a);
02653 
02668 MG_EXPORT void GUIAPI RGBA2Pixels (HDC hdc, const RGB* rgbs, 
02669                 gal_pixel* pixels, int count);
02670 
02689 static inline gal_pixel RGBA2Pixel (HDC hdc, 
02690                 Uint8 r, Uint8 g, Uint8 b, Uint8 a)
02691 {
02692     RGB rgb = {r, g, b, a};
02693     gal_pixel pixel;
02694 
02695     RGBA2Pixels (hdc, &rgb, &pixel, 1);
02696     return pixel;
02697 }
02698 
02713 MG_EXPORT void GUIAPI RGB2Pixels (HDC hdc, const RGB* rgbs, 
02714                 gal_pixel* pixels, int count);
02715 
02733 static inline gal_pixel RGB2Pixel (HDC hdc, Uint8 r, Uint8 g, Uint8 b)
02734 {
02735     RGB rgb = {r, g, b, 0};
02736     gal_pixel pixel;
02737 
02738     RGB2Pixels (hdc, &rgb, &pixel, 1);
02739     return pixel;
02740 }
02741 
02756 MG_EXPORT void GUIAPI Pixel2RGBs (HDC hdc, const gal_pixel* pixels, 
02757                 RGB* rgbs, int count);
02758 
02780 static inline void Pixel2RGB (HDC hdc, gal_pixel pixel, 
02781                 Uint8* r, Uint8* g, Uint8* b)
02782 {
02783     RGB rgb;
02784     Pixel2RGBs (hdc, &pixel, &rgb, 1);
02785     *r = rgb.r; *g = rgb.g, *b = rgb.b;
02786 }
02787 
02802 MG_EXPORT void GUIAPI Pixel2RGBAs (HDC hdc, const gal_pixel* pixels, 
02803                 RGB* rgbs, int count);
02804 
02828 static inline void Pixel2RGBA (HDC hdc, gal_pixel pixel, 
02829                 Uint8* r, Uint8* g, Uint8* b, Uint8* a)
02830 {
02831     RGB rgb;
02832     Pixel2RGBAs (hdc, &pixel, &rgb, 1);
02833     *r = rgb.r; *g = rgb.g, *b = rgb.b; *a = rgb.a;
02834 }
02835 
02846 static inline DWORD Pixel2DWORD (HDC hdc, gal_pixel pixel)
02847 {
02848     Uint8 r,g,b,a;
02849     Pixel2RGBA (hdc, pixel, &r, &g, &b, &a);
02850     return MakeRGBA (r, g, b, a);
02851 }
02852 
02853 #define PIXEL2DWORD(hdc, pixel) Pixel2DWORD(hdc, pixel)
02854 
02865 static inline gal_pixel DWORD2PIXEL (HDC hdc, DWORD dword)
02866 {
02867     return RGBA2Pixel (hdc, 
02868             GetRValue(dword), GetGValue(dword),
02869             GetBValue(dword), GetAValue(dword));
02870 }
02871 
02889 MG_EXPORT void GUIAPI FocusRect (HDC hdc, int x0, int y0, int x1, int y1);
02890 
02908 MG_EXPORT void GUIAPI DrawHVDotLine (HDC hdc, int x, int y, int w_h, BOOL H_V);
02909 
02926 #define DrawHDotLine(hdc, x, y, w) DrawHVDotLine (hdc, x, y, w, TRUE);
02927 
02944 #define DrawVDotLine(hdc, x, y, h) DrawHVDotLine (hdc, x, y, h, FALSE);
02945 
02975 MG_EXPORT BOOL GUIAPI LineClipper (const RECT* cliprc, 
02976                 int *_x0, int *_y0, int *_x1, int *_y1);
02977 
02982 typedef void (* CB_LINE) (void* context, int stepx, int stepy);
02983 
03006 MG_EXPORT void GUIAPI LineGenerator (void* context, 
03007                 int x1, int y1, int x2, int y2, CB_LINE cb);
03008 
03013 typedef void (* CB_CIRCLE) (void* context, int x1, int x2, int y);
03014 
03042 MG_EXPORT void GUIAPI CircleGenerator (void* context, 
03043                 int sx, int sy, int r, CB_CIRCLE cb);
03044 
03049 typedef void (* CB_ELLIPSE) (void* context, int x1, int x2, int y);
03050 
03075 MG_EXPORT void GUIAPI EllipseGenerator (void* context, 
03076                 int sx, int sy, int rx, int ry, CB_ELLIPSE cb);
03077 
03082 typedef void (* CB_ARC) (void* context, int x, int y);
03083 
03107 MG_EXPORT void GUIAPI CircleArcGenerator (void* context, 
03108                 int sx, int sy, int r, int ang1, int ang2, CB_ARC cb);
03109 
03114 typedef void (* CB_POLYGON) (void* context, int x1, int x2, int y);
03115 
03154 MG_EXPORT BOOL GUIAPI MonotoneVerticalPolygonGenerator (void* context, 
03155                 const POINT* pts, int vertices, CB_POLYGON cb);
03156 
03174 MG_EXPORT BOOL GUIAPI PolygonIsMonotoneVertical (const POINT* pts, 
03175                 int vertices);
03176 
03203 MG_EXPORT BOOL GUIAPI PolygonGeneratorEx (void* context, 
03204                 const POINT* pts, int vertices, CB_POLYGON cb, RECT* rc_output);
03214 #define PolygonGenerator(context, pts, vertices, cb)          \
03215                 PolygonGeneratorEx(context, pts, vertices, cb, NULL)
03216 
03221 typedef BOOL (* CB_EQUAL_PIXEL) (void* context, int x, int y);
03222 
03227 typedef void (* CB_FLOOD_FILL) (void* context, int x1, int x2, int y);
03228 
03249 MG_EXPORT BOOL GUIAPI FloodFillGenerator (void* context, 
03250                 const RECT* src_rc, int x, int y, 
03251                 CB_EQUAL_PIXEL cb_equal_pixel, CB_FLOOD_FILL cb_flood_fill);
03252 
03253 /* DDA algorithm */
03254 #define BITMAP_SCALER_DDA       0
03255 /* Bilinear interpolation algorithm */
03256 #define BITMAP_SCALER_BILINEAR  1         
03257 
03274 MG_EXPORT int GUIAPI SetBitmapScalerType (HDC hdc,  int scaler_type);
03275 
03289 MG_EXPORT void GUIAPI MoveTo (HDC hdc, int x, int y);
03290 
03305 MG_EXPORT void GUIAPI LineTo (HDC hdc, int x, int y);
03306 
03322 MG_EXPORT void GUIAPI Rectangle (HDC hdc, int x0, int y0, int x1, int y1);
03323 
03338 MG_EXPORT void GUIAPI PolyLineTo (HDC hdc, const POINT* pts, int vertices);
03339 
03354 MG_EXPORT void GUIAPI SplineTo (HDC hdc, const POINT* pts);
03355 
03370 MG_EXPORT void GUIAPI Circle (HDC hdc, int sx, int sy, int r);
03371 
03388 MG_EXPORT void GUIAPI Ellipse (HDC hdc, int sx, int sy, int rx, int ry);
03389 
03411 MG_EXPORT void GUIAPI CircleArc (HDC hdc, int sx, int sy, int r, 
03412                 int ang1, int ang2);
03413 
03428 MG_EXPORT void GUIAPI FillBox (HDC hdc, int x, int y, int w, int h);
03429 
03443 MG_EXPORT void GUIAPI FillCircle (HDC hdc, int sx, int sy, int r);
03444 
03461 MG_EXPORT void GUIAPI FillEllipse (HDC hdc, int sx, int sy, int rx, int ry);
03462 
03476 MG_EXPORT BOOL GUIAPI FillPolygon (HDC hdc, const POINT* pts, int vertices);
03477 
03491 MG_EXPORT BOOL GUIAPI FloodFill (HDC hdc, int x, int y);
03492 
03493 #ifdef _MGHAVE_ADV_2DAPI
03494 
03503 typedef enum
03504 {
03509   PT_SOLID,
03514   PT_ON_OFF_DASH,
03521   PT_DOUBLE_DASH,
03522 } PenType;
03523 
03533 #define GetPenType(hdc)                 \
03534                 GetDCAttr (hdc, DC_ATTR_PEN_TYPE)
03535 
03546 #define SetPenType(hdc, type)           \
03547                 SetDCAttr (hdc, DC_ATTR_PEN_TYPE, (DWORD) type)
03548 
03568 MG_EXPORT void GUIAPI SetPenDashes (HDC hdc, int dash_offset, 
03569                 const unsigned char* dash_list, int n);
03570 
03574 typedef enum
03575 {
03580   PT_CAP_BUTT,
03585   PT_CAP_ROUND,
03590   PT_CAP_PROJECTING
03591 } PTCapStyle;
03592 
03602 #define GetPenCapStyle(hdc)                 \
03603                 GetDCAttr (hdc, DC_ATTR_PEN_CAP_STYLE)
03604 
03615 #define SetPenCapStyle(hdc, style)          \
03616             SetDCAttr (hdc, DC_ATTR_PEN_CAP_STYLE, (DWORD) style)
03617 
03621 typedef enum
03622 {
03626   PT_JOIN_MITER,
03630   PT_JOIN_ROUND,
03635   PT_JOIN_BEVEL
03636 } PTJoinStyle;
03637 
03647 #define GetPenJoinStyle(hdc)           GetDCAttr (hdc, DC_ATTR_PEN_JOIN_STYLE)
03648 
03659 #define SetPenJoinStyle(hdc, style)         \
03660             SetDCAttr (hdc, DC_ATTR_PEN_JOIN_STYLE, (DWORD) style)
03661 
03671 #define GetPenWidth(hdc)                    \
03672                 GetDCAttr (hdc, DC_ATTR_PEN_WIDTH)
03673 
03684 #define SetPenWidth(hdc, width)             \
03685                 SetDCAttr (hdc, DC_ATTR_PEN_WIDTH, (DWORD) width)
03686 
03694 typedef enum
03695 {
03699   BT_SOLID,
03703   BT_TILED,
03710   BT_STIPPLED,
03717   BT_OPAQUE_STIPPLED
03718 } BrushType;
03719 
03729 #define GetBrushType(hdc)               \
03730                 GetDCAttr (hdc, DC_ATTR_BRUSH_TYPE)
03731 
03742 #define SetBrushType(hdc, type)         \
03743                 SetDCAttr (hdc, DC_ATTR_BRUSH_TYPE, (DWORD) type)
03744 
03746 typedef struct _STIPPLE
03747 {
03749     int width;
03751     int height;
03752 
03754     int pitch;
03755 
03757     size_t size;
03758 
03760     const unsigned char* bits;
03761 } STIPPLE;
03762 
03774 MG_EXPORT void GUIAPI SetBrushInfo (HDC hdc, 
03775                 const BITMAP* tile, const STIPPLE* stipple);
03776 
03791 MG_EXPORT void GUIAPI SetBrushOrigin (HDC hdc, int x, int y);
03792 
03810 MG_EXPORT void GUIAPI LineEx (HDC hdc, int x1, int y1, int x2, int y2);
03811 
03835 MG_EXPORT void GUIAPI ArcEx (HDC hdc, int x, int y, int width, int height, 
03836                 int ang1, int ang2);
03837 
03861 MG_EXPORT void GUIAPI FillArcEx (HDC hdc, int x, int y, int width, int height, 
03862                 int ang1, int ang2);
03863 
03876 MG_EXPORT void GUIAPI PolyLineEx (HDC hdc, const POINT* pts, int nr_pts);
03877 
03881 typedef struct _ARC
03882 {
03884     int x;
03886     int y;
03887 
03889     int width;
03891     int height;
03892 
03897     int angle1;
03901     int angle2;
03902 } ARC;
03903 
03916 MG_EXPORT void GUIAPI PolyArcEx (HDC hdc, const ARC* arcs, int nr_arcs);
03917 
03930 MG_EXPORT void GUIAPI PolyFillArcEx (HDC hdc, const ARC* arcs, int nr_arcs);
03931 
03950 MG_EXPORT BOOL GUIAPI RoundRect (HDC hdc, int x0, int y0, int x1, int y1, int cw, int ch);
03951 
03955 #endif
03956 
04002 #define MM_TEXT               0
04003 #define MM_ANISOTROPIC        1
04004 
04020 #define GetMapMode(hdc)         GetDCAttr (hdc, DC_ATTR_MAP_MODE)
04021 
04037 #define SetMapMode(hdc, mapmode)        \
04038                 SetDCAttr (hdc, DC_ATTR_MAP_MODE, (DWORD)mapmode)
04039 
04064 MG_EXPORT void GUIAPI GetDCLCS (HDC hdc, int which, POINT* pt);
04065 
04090 MG_EXPORT void GUIAPI SetDCLCS (HDC hdc, int which, const POINT* pt);
04091 
04092 #define DC_LCS_VORG     0
04093 #define DC_LCS_VEXT     1
04094 #define DC_LCS_WORG     2
04095 #define DC_LCS_WEXT     3
04096 #define NR_DC_LCS_PTS   4
04097 
04111 #define GetViewportOrg(hdc, pPt)    GetDCLCS(hdc, DC_LCS_VORG, pPt)
04112 
04126 #define GetViewportExt(hdc, pPt)    GetDCLCS(hdc, DC_LCS_VEXT, pPt)
04127 
04141 #define GetWindowOrg(hdc, pPt)      GetDCLCS(hdc, DC_LCS_WORG, pPt)
04142 
04156 #define GetWindowExt(hdc, pPt)      GetDCLCS(hdc, DC_LCS_WEXT, pPt)
04157 
04171 #define SetViewportOrg(hdc, pPt)    SetDCLCS(hdc, DC_LCS_VORG, pPt)
04172 
04186 #define SetViewportExt(hdc, pPt)    SetDCLCS(hdc, DC_LCS_VEXT, pPt)
04187 
04201 #define SetWindowOrg(hdc, pPt)      SetDCLCS(hdc, DC_LCS_WORG, pPt)
04202 
04216 #define SetWindowExt(hdc, pPt)      SetDCLCS(hdc, DC_LCS_WEXT, pPt)
04217 
04236 MG_EXPORT void GUIAPI DPtoLP (HDC hdc, POINT* pPt);
04237 
04238 
04257 MG_EXPORT void GUIAPI LPtoDP (HDC hdc, POINT* pPt);
04258 
04277 MG_EXPORT void GUIAPI SPtoLP(HDC hdc, POINT* pPt);
04278 
04279 
04298 MG_EXPORT void GUIAPI LPtoSP(HDC hdc, POINT* pPt);
04299 
04320 MG_EXPORT void GUIAPI ExcludeClipRect (HDC hdc, const RECT* prc);
04321 
04335 MG_EXPORT void GUIAPI IncludeClipRect (HDC hdc, const RECT* prc);
04336 
04352 MG_EXPORT BOOL GUIAPI PtVisible (HDC hdc, int x, int y);
04353 
04366 MG_EXPORT void GUIAPI ClipRectIntersect (HDC hdc, const RECT* prc);
04367 
04380 MG_EXPORT void GUIAPI SelectClipRect (HDC hdc, const RECT* prc);
04381 
04382 #define RGN_COPY        0x00
04383 #define RGN_DIFF        0x01
04384 #define RGN_AND         0x02
04385 #define RGN_OR          0x03
04386 #define RGN_XOR         0x04
04387 
04442 MG_EXPORT int GUIAPI SelectClipRegionEx (HDC hdc, const CLIPRGN* pRgn, 
04443                 int fnMode);
04444 
04457 MG_EXPORT void GUIAPI SelectClipRegion (HDC hdc, const CLIPRGN* pRgn);
04458 
04481 MG_EXPORT int GUIAPI OffsetClipRegion (HDC hdc, int nXOffset, int nYOffset);
04482 
04495 MG_EXPORT void GUIAPI GetBoundsRect (HDC hdc, RECT* pRect);
04496 
04514 MG_EXPORT BOOL GUIAPI RectVisible (HDC hdc, const RECT* pRect);
04515 
04534 MG_EXPORT int GUIAPI GetClipBox (HDC hdc, RECT* clipbox);
04535 
04554 MG_EXPORT int GUIAPI GetClipRegion (HDC hdc, CLIPRGN* cliprgn);
04555 
04594 MG_EXPORT BOOL GUIAPI GetBitmapFromDC (HDC hdc, 
04595                 int x, int y, int w, int h, BITMAP* bmp);
04596 
04632 MG_EXPORT BOOL GUIAPI FillBoxWithBitmap (HDC hdc, int x, int y, int w, int h,
04633                 const BITMAP *bmp);
04634 
04688 MG_EXPORT BOOL GUIAPI FillBoxWithBitmapPart (HDC hdc, 
04689                 int x, int y, int w, int h,
04690                 int bw, int bh, const BITMAP* bmp, int xo, int yo);
04691 
04714 MG_EXPORT BOOL GUIAPI FillBitmapPartInBox (HDC hdc, int box_x, int box_y, 
04715                 int box_w, int box_h, const BITMAP* pbmp, int bmp_x, int bmp_y, 
04716                 int bmp_w, int bmp_h);
04717 
04751 MG_EXPORT void GUIAPI BitBlt (HDC hsdc, int sx, int sy, int sw, int sh, 
04752                 HDC hddc, int dx, int dy, DWORD dwRop);
04753 
04792 MG_EXPORT void GUIAPI StretchBlt (HDC hsdc, int sx, int sy, int sw, int sh, 
04793                 HDC hddc, int dx, int dy, int dw, int dh, DWORD dwRop);
04794 
04814 MG_EXPORT BOOL GUIAPI ScaleBitmapEx (BITMAP* dst, const BITMAP* src, 
04815         HDC ref_dc);
04816 
04817 #define ScaleBitmap(dst, src) ScaleBitmapEx(dst, src, HDC_SCREEN)
04818 
04840 MG_EXPORT gal_pixel GUIAPI GetPixelInBitmapEx (const BITMAP* bmp, int x, int y, Uint8* alpha);
04841 
04859 static inline gal_pixel GUIAPI GetPixelInBitmap (const BITMAP* bmp, int x, int y)
04860 {
04861     return GetPixelInBitmapEx (bmp, x, y, NULL);
04862 }
04863 
04888 MG_EXPORT BOOL GUIAPI SetPixelInBitmapEx (const BITMAP* bmp, 
04889                 int x, int y, gal_pixel pixel, const Uint8* alpha);
04890 
04911 static inline BOOL GUIAPI SetPixelInBitmap (const BITMAP* bmp,
04912         int x, int y, gal_pixel pixel)
04913 {
04914     return SetPixelInBitmapEx (bmp, x, y, pixel, NULL);
04915 }
04916 
04917 #ifdef _MGMISC_SAVESCREEN
04918 
04937 MG_EXPORT BOOL GUIAPI SaveScreenRectContent (const RECT* rcWin, 
04938                 const char* filename);
04939 
04957 MG_EXPORT BOOL GUIAPI SaveMainWindowContent (HWND hWnd, const char* filename);
04958 #endif
04959 
04984 MG_EXPORT HICON GUIAPI LoadIconFromFile (HDC hdc, const char* filename, 
04985                 int which);
04986 
05005 MG_EXPORT HICON GUIAPI LoadIconFromMem (HDC hdc, const void* area, int which);
05006 
05031 MG_EXPORT HICON GUIAPI CreateIconEx (HDC hdc, int w, int h, 
05032                 const BYTE* AndBits, const BYTE* XorBits, int colornum, 
05033                 const RGB* pal);
05038 #define CreateIcon(hdc, w, h, AndBits, XorBits, colornum) \
05039         CreateIconEx(hdc, w, h, AndBits, XorBits, colornum, NULL)
05040 
05041 
05053 MG_EXPORT BOOL GUIAPI DestroyIcon (HICON hicon);
05054 
05068 MG_EXPORT BOOL GUIAPI GetIconSize (HICON hicon, int* w, int* h);
05069 
05087 MG_EXPORT void GUIAPI DrawIcon (HDC hdc, 
05088                 int x, int y, int w, int h, HICON hicon);
05089 
05111 static inline void SetRect (RECT* prc, int left, int top, int right, int bottom)
05112 {
05113     (prc)->left = left; (prc)->top = top; 
05114     (prc)->right = right; (prc)->bottom = bottom;
05115 }
05116 
05130 static inline void SetRectEmpty (RECT* prc)
05131 {
05132     (prc)->left = (prc)->top = (prc)->right = (prc)->bottom = 0;
05133 }
05134 
05147 static inline void CopyRect (RECT* pdrc, const RECT* psrc)
05148 {
05149     (pdrc)->left = (psrc)->left; (pdrc)->top = (psrc)->top;
05150     (pdrc)->right = (psrc)->right; (pdrc)->bottom = (psrc)->bottom;
05151 }
05152 
05168 static inline void OffsetRect (RECT* prc, int x, int y)
05169 {
05170     (prc)->left += x; (prc)->top += y; (prc)->right += x; (prc)->bottom += y;
05171 }
05172 
05189 static inline void InflateRect (RECT* prc, int cx, int cy)
05190 {
05191     (prc)->left -= cx; (prc)->top -= cy; 
05192     (prc)->right += cx; (prc)->bottom += cy;
05193 }
05194 
05208 static inline void InflateRectToPt (RECT* prc, int x, int y)
05209 {
05210     if ((x) < (prc)->left) (prc)->left = (x); 
05211     if ((y) < (prc)->top) (prc)->top = (y);
05212     if ((x) > (prc)->right) (prc)->right = (x);
05213     if ((y) > (prc)->bottom) (prc)->bottom = (y);
05214 }
05215 
05231 static inline BOOL PtInRect(const RECT* prc, int x, int y)
05232 {
05233     if (x >= prc->left && x < prc->right && y >= prc->top && y < prc->bottom)
05234         return TRUE;
05235     return FALSE;
05236 }
05237 
05250 MG_EXPORT BOOL GUIAPI IsRectEmpty (const RECT* prc);
05251 
05264 MG_EXPORT BOOL GUIAPI EqualRect (const RECT* prc1, const RECT* prc2);
05265 
05275 MG_EXPORT void GUIAPI NormalizeRect (RECT* pRect);
05276 
05297 MG_EXPORT BOOL GUIAPI IntersectRect (RECT* pdrc, 
05298                 const RECT* psrc1, const RECT* psrc2);
05299 
05315 MG_EXPORT BOOL GUIAPI IsCovered (const RECT* prc1, const RECT* prc2);
05316 
05330 MG_EXPORT BOOL GUIAPI DoesIntersect (const RECT* psrc1, const RECT* psrc2);
05331 
05349 MG_EXPORT BOOL GUIAPI UnionRect (RECT* pdrc, 
05350                 const RECT* psrc1, const RECT* psrc2);
05351 
05367 MG_EXPORT void GUIAPI GetBoundRect (PRECT pdrc, 
05368                 const RECT* psrc1, const RECT* psrc2);
05369 
05386 MG_EXPORT int GUIAPI SubtractRect (RECT* rc, const RECT* psrc1, const RECT* psrc2);
05387 
05392 #define RECTWP(prc)  ((prc)->right - (prc)->left)
05393 
05397 #define RECTHP(prc)  ((prc)->bottom - (prc)->top)
05398 
05402 #define RECTW(rc)    ((rc).right - (rc).left)
05403 
05407 #define RECTH(rc)    ((rc).bottom - (rc).top)
05408 
05422 /* Font-related structures */
05423 #define LEN_FONT_NAME               31
05424 #define LEN_DEVFONT_NAME            79
05425 #define LEN_UNIDEVFONT_NAME         127
05426 
05427 #define FONT_WEIGHT_NIL             '\0'
05428 #define FONT_WEIGHT_ALL             '*'
05429 #define FONT_WEIGHT_BLACK           'c'
05430 #define FONT_WEIGHT_BOLD            'b'
05431 #define FONT_WEIGHT_BOOK            'k'
05432 #define FONT_WEIGHT_DEMIBOLD        'd'
05433 #define FONT_WEIGHT_LIGHT           'l'
05434 #define FONT_WEIGHT_MEDIUM          'm'
05435 #define FONT_WEIGHT_REGULAR         'r'
05436 #define FONT_WEIGHT_SUBPIXEL        's'
05437 
05438 #define FS_WEIGHT_MASK              0x000000FF
05439 #define FS_WEIGHT_BLACK             0x00000001
05440 #define FS_WEIGHT_BOLD              0x00000002
05441 #define FS_WEIGHT_BOOK              0x00000004
05442 #define FS_WEIGHT_DEMIBOLD          0x00000006 /* BOOK | BOLD */
05443 #define FS_WEIGHT_LIGHT             0x00000010
05444 #define FS_WEIGHT_MEDIUM            0x00000020
05445 #define FS_WEIGHT_SUBPIXEL          0x00000040
05446 #define FS_WEIGHT_REGULAR           0x00000000
05447 
05448 #define FONT_SLANT_NIL              '\0'
05449 #define FONT_SLANT_ALL              '*'
05450 #define FONT_SLANT_ITALIC           'i'
05451 #define FONT_SLANT_OBLIQUE          'o'
05452 #define FONT_SLANT_ROMAN            'r'
05453 
05454 #define FS_SLANT_MASK               0x00000F00
05455 #define FS_SLANT_ITALIC             0x00000100
05456 #define FS_SLANT_OBLIQUE            0x00000200
05457 #define FS_SLANT_ROMAN              0x00000000
05458 
05459 #define FONT_FLIP_NIL               '\0'
05460 #define FONT_FLIP_HORZ              'H'
05461 #define FONT_FLIP_VERT              'V'
05462 #define FONT_FLIP_HORZVERT          'T'
05463 
05464 #define FS_FLIP_MASK                0x0000F000
05465 #define FS_FLIP_HORZ                0x00001000
05466 #define FS_FLIP_VERT                0x00002000
05467 #define FS_FLIP_HORZVERT            0x00003000 /* HORZ | VERT */
05468 
05469 #define FONT_OTHER_NIL              '\0'
05470 #define FONT_OTHER_AUTOSCALE        'S'
05471 #define FONT_OTHER_TTFNOCACHE       'N'
05472 #define FONT_OTHER_TTFKERN          'K'
05473 #define FONT_OTHER_TTFNOCACHEKERN   'R'
05474 #define FONT_OTHER_LCDPORTRAIT      'P'
05475 #define FONT_OTHER_LCDPORTRAITKERN  'Q'
05476 
05477 #define FS_OTHER_MASK               0x00FF0000
05478 #define FS_OTHER_AUTOSCALE          0x00010000
05479 #define FS_OTHER_TTFNOCACHE         0x00020000
05480 #define FS_OTHER_TTFKERN            0x00040000
05481 #define FS_OTHER_TTFNOCACHEKERN     0x00060000 /* KERN | NOCACHE */
05482 #define FS_OTHER_LCDPORTRAIT        0x00100000
05483 #define FS_OTHER_LCDPORTRAITKERN    0x00140000
05484 
05485 /* 
05486  * Backward compatiblilty definitions. 
05487  * All FONT_SETWIDTH_* and FONT_SPACING_* types will 
05488  * be treated as FONT_FLIP_NIL and FONT_OTHER_NIL respectively. 
05489  */
05490 #define FONT_SETWIDTH_NIL           '\0'
05491 #define FONT_SETWIDTH_ALL           '*'
05492 #define FONT_SETWIDTH_BOLD          'b'
05493 #define FONT_SETWIDTH_CONDENSED     'c'
05494 #define FONT_SETWIDTH_SEMICONDENSED 's'
05495 #define FONT_SETWIDTH_NORMAL        'n'
05496 #define FONT_SETWIDTH_TTFNOCACHE    'w'
05497 
05498 /*
05499 #define FS_SETWIDTH_MASK            0x0000F000
05500 #define FS_SETWIDTH_BOLD            0x00001000
05501 #define FS_SETWIDTH_CONDENSED       0x00002000
05502 #define FS_SETWIDTH_SEMICONDENSED   0x00004000
05503 #define FS_SETWIDTH_TTFNOCACHE      0x00008000
05504 #define FS_SETWIDTH_NORMAL          0x00000000
05505 */
05506 
05507 #define FONT_SPACING_NIL            '\0'
05508 #define FONT_SPACING_ALL            '*'
05509 #define FONT_SPACING_MONOSPACING    'm'
05510 #define FONT_SPACING_PROPORTIONAL   'p'
05511 #define FONT_SPACING_CHARCELL       'c'
05512 
05513 /*
05514 #define FS_SPACING_MASK             0x000F0000
05515 #define FS_SPACING_MONOSPACING      0x00010000
05516 #define FS_SPACING_PROPORTIONAL     0x00020000
05517 #define FS_SPACING_CHARCELL         0x00000000
05518 */
05519 
05520 #define FONT_UNDERLINE_NIL          '\0'
05521 #define FONT_UNDERLINE_ALL          '*'
05522 #define FONT_UNDERLINE_LINE         'u'
05523 #define FONT_UNDERLINE_NONE         'n'
05524 
05525 #define FS_UNDERLINE_MASK           0x00F00000
05526 #define FS_UNDERLINE_LINE           0x00100000
05527 #define FS_UNDERLINE_NONE           0x00000000
05528 
05529 #define FONT_STRUCKOUT_NIL          '\0'
05530 #define FONT_STRUCKOUT_ALL          '*'
05531 #define FONT_STRUCKOUT_LINE         's'
05532 #define FONT_STRUCKOUT_NONE         'n'
05533 
05534 #define FS_STRUCKOUT_MASK           0x0F000000
05535 #define FS_STRUCKOUT_LINE           0x01000000
05536 #define FS_STRUCKOUT_NONE           0x00000000
05537 
05538 #define FONT_TYPE_NAME_LEN          3
05539 #define FONT_TYPE_NAME_BITMAP_RAW   "rbf"
05540 #define FONT_TYPE_NAME_BITMAP_VAR   "vbf"
05541 #define FONT_TYPE_NAME_BITMAP_QPF   "qpf"
05542 #define FONT_TYPE_NAME_BITMAP_UPF   "upf"
05543 #define FONT_TYPE_NAME_BITMAP_BMP   "bmp"
05544 #define FONT_TYPE_NAME_SCALE_TTF    "ttf"
05545 #define FONT_TYPE_NAME_SCALE_T1F    "t1f"
05546 #define FONT_TYPE_NAME_ALL          "*"
05547 
05548 #define FONT_ETC_SECTION_NAME_VBF   "varbitmapfonts"
05549 #define FONT_ETC_SECTION_NAME_RBF   "rawbitmapfonts"
05550 #define FONT_ETC_SECTION_NAME_UPF   "upf"
05551 #define FONT_ETC_SECTION_NAME_QPF   "qpf"
05552 #define FONT_ETC_SECTION_NAME_TTF   "truetypefonts"
05553 
05554 #define FONT_TYPE_BITMAP_RAW        0x0001  /* "rbf" */
05555 #define FONT_TYPE_BITMAP_VAR        0x0002  /* "vbf" */
05556 #define FONT_TYPE_BITMAP_QPF        0x0003  /* "qpf" */
05557 #define FONT_TYPE_BITMAP_BMP        0x0004  /* "bmp" */
05558 #define FONT_TYPE_BITMAP_UPF        0x0005  /* "upf" */
05559 #define FONT_TYPE_SCALE_TTF         0x0010  /* "ttf" */
05560 #define FONT_TYPE_SCALE_T1F         0x0011  /* "t1f" */
05561 #define FONT_TYPE_ALL               0x00FF  /* "all" */
05562 
05563 #define FONT_CHARSET_US_ASCII       "US-ASCII"
05564 
05565 #define FONT_CHARSET_ISO8859_1      "ISO8859-1"
05566 #define FONT_CHARSET_ISO8859_2      "ISO8859-2"
05567 #define FONT_CHARSET_ISO8859_3      "ISO8859-3"
05568 #define FONT_CHARSET_ISO8859_4      "ISO8859-4"
05569 #define FONT_CHARSET_ISO8859_5      "ISO8859-5"
05570 #define FONT_CHARSET_ISO8859_6      "ISO8859-6"
05571 #define FONT_CHARSET_ISO8859_7      "ISO8859-7"
05572 #define FONT_CHARSET_ISO8859_8      "ISO8859-8"
05573 #define FONT_CHARSET_ISO8859_9      "ISO8859-9"
05574 #define FONT_CHARSET_ISO8859_10     "ISO8859-10"
05575 #define FONT_CHARSET_ISO8859_11     "ISO8859-11"
05576 #define FONT_CHARSET_ISO8859_12     "ISO8859-12"
05577 #define FONT_CHARSET_ISO8859_13     "ISO8859-13"
05578 #define FONT_CHARSET_ISO8859_14     "ISO8859-14"
05579 #define FONT_CHARSET_ISO8859_15     "ISO8859-15"
05580 #define FONT_CHARSET_ISO8859_16     "ISO8859-16"
05581 
05582 #define FONT_CHARSET_EUC_CN         "EUC-CN"
05583 
05588 #define FONT_CHARSET_GB1988_0       "GB1988-0"      
05589 
05594 #define FONT_CHARSET_GB2312_0       "GB2312-0"      
05595 #define FONT_CHARSET_GBK            "GBK"
05596 
05601 #define FONT_CHARSET_GB18030_0      "GB18030-0"     
05602 #define FONT_CHARSET_BIG5           "BIG5"
05603 
05608 #define FONT_CHARSET_EUCTW          "EUC-TW"        
05609 #define FONT_CHARSET_EUCKR          "EUC-KR"
05610 
05615 #define FONT_CHARSET_KSC5636_0      "KSC5636-0"     
05616 
05621 #define FONT_CHARSET_KSC5601_0      "KSC5601-0"     
05622 #define FONT_CHARSET_EUCJP          "EUC-JP"
05623 
05628 #define FONT_CHARSET_JISX0201_0     "JISX0201-0"    
05629 
05634 #define FONT_CHARSET_JISX0208_0     "JISX0208-0"    
05635 #define FONT_CHARSET_SHIFTJIS       "SHIFT-JIS"
05636 
05641 #define FONT_CHARSET_JISX0201_1     "JISX0201-1"    
05642 
05647 #define FONT_CHARSET_JISX0208_1     "JISX0208-1"    
05648 
05653 #define FONT_CHARSET_ISO_10646_1    "ISO-10646-1"   
05654 
05659 #define FONT_CHARSET_UTF8           "UTF-8"
05660 
05665 #define FONT_CHARSET_UTF16LE        "UTF-16LE"
05666 
05671 #define FONT_CHARSET_UTF16BE        "UTF-16BE"
05672 
05673 #define FONT_MAX_SIZE               256
05674 #define FONT_MIN_SIZE               4
05675 
05676 struct _DEVFONT;
05677 typedef struct _DEVFONT DEVFONT;
05678 
05680 typedef struct _LOGFONT {
05682     char type [LEN_FONT_NAME + 1];
05684     char family [LEN_FONT_NAME + 1];
05686     char charset [LEN_FONT_NAME + 1];
05688     DWORD style;
05690     int size;
05692     int rotation;
05694     int ascent;
05696     int descent;
05698     unsigned short sbc_scale;
05700     unsigned short mbc_scale;
05702     DEVFONT* sbc_devfont;
05704     DEVFONT* mbc_devfont;
05705 } LOGFONT;
05710 typedef LOGFONT*    PLOGFONT;
05715 typedef const LOGFONT*    CPLOGFONT;
05716 
05717 struct _WORDINFO;
05722 typedef struct _WORDINFO WORDINFO;
05723 
05724 #define MAX_LEN_MCHAR               6
05725 
05726 typedef unsigned short  UChar16;
05727 typedef int    UChar32;
05728 
05729 #define MCHAR_TYPE_UNKNOWN          0xFFFF
05730 #define MCHAR_TYPE_NUL              0x0000
05731 #define MCHAR_TYPE_CTRL1            0x0100
05732 #define MCHAR_TYPE_BEL              0x0200
05733 #define MCHAR_TYPE_BS               0x0300
05734 #define MCHAR_TYPE_HT               0x0400
05735 #define MCHAR_TYPE_LF               0x0500
05736 #define MCHAR_TYPE_VT               0x0600
05737 #define MCHAR_TYPE_FF               0x0700
05738 #define MCHAR_TYPE_CR               0x0800
05739 #define MCHAR_TYPE_CTRL2            0x0900
05740 #define MCHAR_TYPE_SPACE            0x0A00
05741 #define MCHAR_TYPE_ZEROWIDTH        0x0B00
05742 #define MCHAR_TYPE_GENERIC          0x0C00
05743 #define MCHAR_TYPE_NOSPACING_MARK   0x0001
05744 #define MCHAR_TYPE_LIGATURE         (MCHAR_TYPE_NOSPACING_MARK |0x0D00)
05745 #define MCHAR_TYPE_VOWEL            (MCHAR_TYPE_NOSPACING_MARK |0x0E00)
05746 #define MCHAR_TYPE_VOWEL_ABOVE      (MCHAR_TYPE_VOWEL |0x0002)
05747 #define MCHAR_TYPE_VOWEL_BELLOW     (MCHAR_TYPE_VOWEL |0x0004)
05748 
05749 #define MCHAR_TYPE_ASCII            0x0080
05750 #define MCHAR_TYPE_LATIN1           0x0081
05751 #define MCHAR_TYPE_LATIN2           0x0082
05752 #define MCHAR_TYPE_LATIN3           0x0083
05753 #define MCHAR_TYPE_LATIN4           0x0084
05754 #define MCHAR_TYPE_LATIN5           0x0085
05755 #define MCHAR_TYPE_LATIN6           0x0086
05756 #define MCHAR_TYPE_LATIN7           0x0087
05757 #define MCHAR_TYPE_LATIN8           0x0088
05758 #define MCHAR_TYPE_LATIN9           0x0089
05759 #define MCHAR_TYPE_LATIN10          0x008A
05760 #define MCHAR_TYPE_CYRILLIC         0x008B
05761 #define MCHAR_TYPE_ARABIC           0x008C
05762 #define MCHAR_TYPE_GREEK            0x008D
05763 #define MCHAR_TYPE_HEBREW           0x008E
05764 #define MCHAR_TYPE_THAI             0x008F
05765 
05766 #define MCHAR_TYPE_DIGIT            0x0091
05767 #define MCHAR_TYPE_SYMBOL_PUNCT     0x0092
05768 #define MCHAR_TYPE_SYMBOL_MATH      0x0093
05769 #define MCHAR_TYPE_SYMBOL_OTHER     0x0094
05770 #define MCHAR_TYPE_FW_DIGIT         0x0095
05771 #define MCHAR_TYPE_FW_SYM_PUNCT     0x0096
05772 #define MCHAR_TYPE_FW_SYM_MATH      0x0097
05773 #define MCHAR_TYPE_FW_SYM_OTHER     0x0098
05774 
05775 #define MCHAR_TYPE_HANGUL           0x00A1
05776 #define MCHAR_TYPE_KATAKANA         0x00A2
05777 #define MCHAR_TYPE_CJK              0x00A3
05778 
05779 struct _FONTOPS;
05780 struct _CHARSETOPS;
05781 
05782 typedef struct _FONTOPS FONTOPS;
05783 typedef struct _CHARSETOPS CHARSETOPS;
05784 
05785 /* charops fontops devont structure is  here. */
05787 struct _DEVFONT
05788 {
05790     char             name [LEN_UNIDEVFONT_NAME + 1];
05791 
05793     DWORD            style;
05794 
05796     FONTOPS*         font_ops;
05797 
05799     CHARSETOPS*      charset_ops;
05800 
05802     struct _DEVFONT* next;
05803 
05805     void*            data;
05806 
05808     void*            relationship;
05809 
05811     BOOL             need_unload;
05812 };
05813 
05814 #define SBC_DEVFONT_INFO(logfont) (logfont.sbc_devfont)
05815 #define MBC_DEVFONT_INFO(logfont) (logfont.mbc_devfont)
05816 
05817 #define SBC_DEVFONT_INFO_P(logfont) (logfont->sbc_devfont)
05818 #define MBC_DEVFONT_INFO_P(logfont) (logfont->mbc_devfont)
05819 
05824 #define INV_LOGFONT     0
05825 
05827 typedef struct _FONTMETRICS
05828 {
05830     int font_height;
05832     int ascent;
05834     int descent;
05835 
05837     int max_width;
05839     int ave_width;
05840 } FONTMETRICS;
05841 
05856 MG_EXPORT void GUIAPI GetFontMetrics (LOGFONT* log_font, 
05857                 FONTMETRICS* font_metrics);
05858 
05860 typedef struct _GLYPHBITMAP
05861 {
05863     int bbox_x, bbox_y, bbox_w, bbox_h;
05865     int advance_x, advance_y;
05866 
05868     size_t bmp_size;
05870     int bmp_pitch;
05872     const unsigned char* bits;
05873 } GLYPHBITMAP;
05874 
05901 MG_EXPORT void GUIAPI GetGlyphBitmap (LOGFONT* log_font, 
05902                 const char* mchar, int mchar_len, 
05903                 GLYPHBITMAP* glyph_bitmap);
05904 
05905 #ifndef _MGRM_THREADS
05906 
05925 MG_EXPORT BOOL GUIAPI InitVectorialFonts (void);
05926 
05927 
05940 MG_EXPORT void GUIAPI TermVectorialFonts (void);
05941 
05942 #endif
05943 
06048 MG_EXPORT PLOGFONT GUIAPI CreateLogFont (const char* type, const char* family, 
06049         const char* charset, char weight, char slant, char flip, 
06050         char other, char underline, char struckout, 
06051         int size, int rotation);
06052 
06066 MG_EXPORT PLOGFONT GUIAPI CreateLogFontByName (const char* font_name);
06067 
06079 MG_EXPORT PLOGFONT GUIAPI CreateLogFontIndirect (LOGFONT* logfont);
06080 
06091 MG_EXPORT void GUIAPI DestroyLogFont (PLOGFONT log_font);
06092 
06106 MG_EXPORT void GUIAPI GetLogFontInfo (HDC hdc, LOGFONT* log_font);
06107 
06120 MG_EXPORT PLOGFONT GUIAPI GetCurFont (HDC hdc);
06121 
06140 MG_EXPORT PLOGFONT GUIAPI SelectFont (HDC hdc, PLOGFONT log_font);
06141 
06152 MG_EXPORT const DEVFONT* GUIAPI GetNextDevFont (const DEVFONT* dev_font);
06153 
06154  
06155 #ifdef _MGFONT_FT2
06156 
06161 typedef enum
06162 {
06164     MG_SMOOTH_NONE = 0,
06166     MG_SMOOTH_DEFAULT = 1,
06168     MG_SMOOTH_LIGHT = 2,
06170     MG_SMOOTH_LEGACY = 16,
06172     MG_SMOOTH_MAX    /*do not remove*/
06173 } mg_FT_LcdFilter;
06174 
06190 MG_EXPORT BOOL GUIAPI ft2SetLcdFilter (LOGFONT* logfont, mg_FT_LcdFilter filter);
06191 
06192 #endif
06193 
06194 #if defined(_MGFONT_QPF) || defined(_MGFONT_FT2) || defined(_MGFONT_TTF) || defined(_MGFONT_UPF)
06195 
06211 MG_EXPORT DEVFONT* GUIAPI LoadDevFontFromFile (const char *devfont_name, 
06212         const char *file_name);
06213 
06223 MG_EXPORT void GUIAPI DestroyDynamicDevFont (DEVFONT **devfont);
06224 #endif
06225 
06244 #define SYSLOGFONT_DEFAULT          0
06245 
06250 #define SYSLOGFONT_WCHAR_DEF        1
06251 
06256 #define SYSLOGFONT_FIXED            2
06257 
06262 #define SYSLOGFONT_CAPTION          3
06263 
06268 #define SYSLOGFONT_MENU             4
06269 
06274 #define SYSLOGFONT_CONTROL          5
06275 
06276 #define NR_SYSLOGFONTS              6
06277 
06278 
06279 extern MG_EXPORT PLOGFONT g_SysLogFont [];
06280 
06304 static inline PLOGFONT GUIAPI GetSystemFont (int font_id)
06305 {
06306     if (font_id >= 0 && font_id < NR_SYSLOGFONTS)
06307         return g_SysLogFont [font_id];
06308     else
06309         return (PLOGFONT)NULL;
06310 }
06311 
06326 MG_EXPORT int GUIAPI GetSysFontMaxWidth (int font_id);
06327 
06342 MG_EXPORT int GUIAPI GetSysFontAveWidth (int font_id);
06343 
06357 MG_EXPORT int GUIAPI GetSysFontHeight (int font_id);
06358 
06373 MG_EXPORT const char* GUIAPI GetSysCharset (BOOL wchar);
06374 
06389 MG_EXPORT int GUIAPI GetSysCharHeight (void);
06390 
06404 MG_EXPORT int GUIAPI GetSysCharWidth (void);
06405 
06417 MG_EXPORT int GUIAPI GetSysCCharWidth (void);
06418 
06432 struct _WORDINFO
06433 {
06435     int len;
06437     unsigned char delimiter;
06439     int nr_delimiters;
06440 };
06441 
06461 MG_EXPORT int GUIAPI GetTextMCharInfo (PLOGFONT log_font, 
06462                 const char* mstr, int len, int* pos_chars);
06463 
06487 MG_EXPORT int GUIAPI GetTextWordInfo (PLOGFONT log_font, const char* mstr, 
06488                 int len, int* pos_words, WORDINFO* info_words);
06489 
06505 MG_EXPORT int GUIAPI GetFirstMCharLen (PLOGFONT log_font, 
06506                 const char* mstr, int len);
06507 
06528 MG_EXPORT int GUIAPI GetFirstWord (PLOGFONT log_font, 
06529                 const char* mstr, int len, WORDINFO* word_info);
06530 
06531 #ifdef _MGCHARSET_UNICODE
06532 
06533 #include <stddef.h>
06534 #include <stdlib.h>
06535 
06556 MG_EXPORT int GUIAPI MB2WCEx (PLOGFONT log_font, void* dest, BOOL wc32,
06557                 const unsigned char* mstr, int n);
06558 
06565 #define MB2WC(log_font, dest, mstr, n) \
06566                    MB2WCEx (log_font, dest, sizeof(wchar_t) == 4, mstr, n)
06567 
06585 MG_EXPORT int GUIAPI WC2MBEx (PLOGFONT log_font, unsigned char *s, UChar32 wc);
06586 
06593 #define WC2MB(log_font, s, wc) \
06594                    WC2MBEx (log_font, s, (UChar32)wc)
06595 
06628 MG_EXPORT int GUIAPI MBS2WCSEx (PLOGFONT log_font, void* dest, BOOL wc32,
06629                 const unsigned char* mstr, int mstr_len, int n, 
06630                 int* conved_mstr_len);
06631 
06638 #define MBS2WCS(log_font, dest, mstr, mstr_len, n) \
06639             MBS2WCSEx(log_font, dest, sizeof (wchar_t) == 4, mstr, \
06640             mstr_len, n, NULL)
06641 
06674 MG_EXPORT int GUIAPI WCS2MBSEx (PLOGFONT log_font, unsigned char* dest,
06675                 const void *wcs, int wcs_len, BOOL wc32, int n,
06676                 int* conved_wcs_len);
06677 
06684 #define WCS2MBS(log_font, dest, wcs, wcs_len, n) \
06685             WCS2MBSEx (log_font, dest, wcs, wcs_len, sizeof (wchar_t) == 4, \
06686             n, NULL)
06687 
06688 #endif /* _MGCHARSET_UNICODE */
06689 
06721 MG_EXPORT int GUIAPI GetTextExtentPoint (HDC hdc, const char* text, int len, 
06722                 int max_extent, int* fit_chars, int* pos_chars, 
06723                 int* dx_chars, SIZE* size);
06724 
06733 MG_EXPORT int GUIAPI GetTabbedTextExtentPoint (HDC hdc, 
06734                 const char* text, int len, int max_extent, 
06735                 int* fit_chars, int* pos_chars, int* dx_chars, SIZE* size);
06736 
06756 MG_EXPORT int GUIAPI GetFontHeight (HDC hdc);
06757 
06771 MG_EXPORT int GUIAPI GetMaxFontWidth (HDC hdc);
06772 
06773 
06792 MG_EXPORT int GUIAPI GetTextExtent (HDC hdc, 
06793                 const char* spText, int len, SIZE* pSize);
06794 
06815 MG_EXPORT int GUIAPI GetTabbedTextExtent (HDC hdc, 
06816                 const char* spText, int len, SIZE* pSize);
06817 
06824 #define GetTextCharacterExtra(hdc)  GetDCAttr (hdc, DC_ATTR_CHAR_EXTRA)
06825 
06832 #define GetTextAboveLineExtra(hdc)  GetDCAttr (hdc, DC_ATTR_ALINE_EXTRA)
06833 
06840 #define GetTextBellowLineExtra(hdc) GetDCAttr (hdc, DC_ATTR_BLINE_EXTRA)
06841 
06849 #define SetTextCharacterExtra(hdc, extra)       \
06850                 SetDCAttr (hdc, DC_ATTR_CHAR_EXTRA, (DWORD) extra)
06851 
06858 #define SetTextAboveLineExtra(hdc, extra)       \
06859                 SetDCAttr (hdc, DC_ATTR_ALINE_EXTRA, (DWORD) extra)
06860 
06867 #define SetTextBellowLineExtra(hdc, extra)      \
06868                 SetDCAttr (hdc, DC_ATTR_BLINE_EXTRA, (DWORD) extra)
06869 
06870 #define TA_LEFT         0x0000
06871 #define TA_RIGHT        0x0001
06872 #define TA_CENTER       0x0002
06873 #define TA_X_MASK       0x000F
06874 
06875 #define TA_TOP          0x0000
06876 #define TA_BASELINE     0x0010
06877 #define TA_BOTTOM       0x0020
06878 #define TA_Y_MASK       0x00F0
06879 
06880 #define TA_NOUPDATECP   0x0000
06881 #define TA_UPDATECP     0x0100
06882 #define TA_CP_MASK      0x0F00
06883 
06935 #define GetTextAlign(hdc)         GetDCAttr (hdc, DC_ATTR_TEXT_ALIGN)
06936 
06993 #define SetTextAlign(hdc, ta_flags)        \
06994                 SetDCAttr (hdc, DC_ATTR_TEXT_ALIGN, (DWORD)ta_flags)
06995 
07014 MG_EXPORT int GUIAPI TextOutLen (HDC hdc, int x, int y, 
07015                 const char* spText, int len);
07016 
07017 
07039 MG_EXPORT int GUIAPI TextOutOmitted (HDC hdc, int x, int y, 
07040                 const char *mtext, int len, int max_extent);
07041 
07063 MG_EXPORT int GUIAPI TabbedTextOutLen (HDC hdc, int x, int y, 
07064                 const char* spText, int len); 
07065 
07092 MG_EXPORT int GUIAPI TabbedTextOutEx (HDC hdc, int x, int y, 
07093                 const char* spText, int nCount, 
07094                 int nTabPositions, int *pTabPositions, int nTabOrigin);
07095 
07105 MG_EXPORT void GUIAPI GetLastTextOutPos (HDC hdc, POINT* pt);
07106 
07115 #define TextOut(hdc, x, y, text)    TextOutLen (hdc, x, y, text, -1)
07116 
07125 #define TabbedTextOut(hdc, x, y, text)  TabbedTextOutLen (hdc, x, y, text, -1)
07126 
07127 #define DT_TOP              0x00000000
07128 #define DT_LEFT             0x00000000
07129 #define DT_CENTER           0x00000001
07130 #define DT_RIGHT            0x00000002
07131 #define DT_VCENTER          0x00000004
07132 #define DT_BOTTOM           0x00000008
07133 #define DT_WORDBREAK        0x00000010
07134 #define DT_SINGLELINE       0x00000020
07135 #define DT_EXPANDTABS       0x00000040
07136 #define DT_TABSTOP          0x00000080
07137 #define DT_NOCLIP           0x00000100
07138 #define DT_EXTERNALLPADING  0x00000200
07139 #define DT_CALCRECT         0x00000400
07140 #define DT_NOPREFIX         0x00000800
07141 #define DT_INTERNAL         0x00001000
07142 #define DT_CHARBREAK        0x00002000
07143 
07147 typedef struct _DTFIRSTLINE
07148 {   
07150     int nr_chars;
07152     int startx;
07154     int starty;
07156     int width;
07158     int height;
07159 } DTFIRSTLINE;
07160 
07236 MG_EXPORT int GUIAPI DrawTextEx2 (HDC hdc, const char* pText, int nCount, 
07237                 RECT* pRect, int nIndent, UINT nFormat, DTFIRSTLINE *firstline);
07238 
07248 #define DrawText(hdc, text, n, rc, format)          \
07249                 DrawTextEx2 (hdc, text, n, rc, 0, format, NULL)
07250 
07259 #define DrawTextEx(hdc, text, n, rc, indent, format)    \
07260                 DrawTextEx2 (hdc, text, n, rc, indent, format, NULL)
07261 
07272 #define MYBMP_TYPE_NORMAL       0x00000000
07273 #define MYBMP_TYPE_RLE4         0x00000001
07274 #define MYBMP_TYPE_RLE8         0x00000002
07275 #define MYBMP_TYPE_RGB          0x00000003
07276 #define MYBMP_TYPE_BGR          0x00000004
07277 #define MYBMP_TYPE_RGBA         0x00000005
07278 #define MYBMP_TYPE_MASK         0x0000000F
07279 
07280 #define MYBMP_FLOW_DOWN         0x00000010
07281 #define MYBMP_FLOW_UP           0x00000020
07282 #define MYBMP_FLOW_MASK         0x000000F0
07283 
07284 #define MYBMP_TRANSPARENT       0x00000100
07285 #define MYBMP_ALPHACHANNEL      0x00000200
07286 #define MYBMP_ALPHA             0x00000400
07287 
07288 #define MYBMP_RGBSIZE_3         0x00001000
07289 #define MYBMP_RGBSIZE_4         0x00002000
07290 
07291 #define MYBMP_LOAD_GRAYSCALE    0x00010000
07292 #define MYBMP_LOAD_ALLOCATE_ONE 0x00020000
07293 #define MYBMP_LOAD_NONE         0x00000000
07294 
07296 struct _MYBITMAP
07297 {
07327     DWORD flags;
07329     int   frames;
07331     Uint8 depth;
07333     Uint8 alpha;
07334     Uint8 reserved [2];
07336     Uint32 transparent;
07337 
07339     Uint32 w;
07341     Uint32 h;
07343     Uint32 pitch;
07345     Uint32 size;
07346 
07348     BYTE* bits;
07349 };
07350 
07351 #define BMP_TYPE_NORMAL         0x00
07352 #define BMP_TYPE_RLE            0x01
07353 #define BMP_TYPE_ALPHA          0x02
07354 #define BMP_TYPE_ALPHACHANNEL   0x04
07355 #define BMP_TYPE_COLORKEY       0x10
07356 
07357 #define BMP_TYPE_ALPHA_MASK     0x20
07358 #define BMP_TYPE_PRIV_PIXEL     0x00
07359 
07360 #ifdef _FOR_MONOBITMAP
07361   #define BMP_TYPE_MONOKEY      0x40
07362 #endif
07363 
07365 struct _BITMAP
07366 {
07396     Uint8   bmType;
07398     Uint8   bmBitsPerPixel;
07400     Uint8   bmBytesPerPixel;
07402     Uint8   bmAlpha;
07404     Uint32  bmColorKey;
07405 #ifdef _FOR_MONOBITMAP
07406     Uint32  bmColorRep;
07407 #endif
07408 
07410     Uint32  bmWidth;
07412     Uint32  bmHeight;
07414     Uint32  bmPitch;
07416     Uint8*  bmBits;
07417 
07419     /*void*   bmAlphaPixelFormat;*/
07421     Uint8*  bmAlphaMask;
07422 
07424     Uint32  bmAlphaPitch;
07425 };
07426 
07438 #include <stdio.h>
07439 #include "endianrw.h"
07440 
07445 typedef void (* CB_ONE_SCANLINE) (void* context, MYBITMAP* my_bmp, int y);
07446 
07481 MG_EXPORT BOOL GUIAPI RegisterBitmapFileType (const char *ext,
07482             void* (*init) (MG_RWops* fp, MYBITMAP *my_bmp, RGB *pal),
07483             int (*load) (MG_RWops* fp, void* init_info, MYBITMAP *my_bmp, 
07484                     CB_ONE_SCANLINE cb, void* context),
07485             void (*cleanup) (void* init_info),
07486             int (*save) (MG_RWops* fp, MYBITMAP *my_bmp, RGB *pal),
07487             BOOL (*check) (MG_RWops* fp));
07488 
07504 MG_EXPORT const char* GUIAPI CheckBitmapType (MG_RWops* fp);
07505 
07547 #define MLS_BLENDMODE_NONE           0x00 
07548 #define MLS_BLENDMODE_COLORKEY       0x01
07549 #define MLS_BLENDMODE_ALPHA          0x02
07550 
07551 #define MLS_INFOMASK_OFFSET          0x01
07552 #define MLS_INFOMASK_BLEND           0x02
07553 #define MLS_INFOMASK_ZORDER          0x04
07554 #define MLS_INFOMASK_ALL             0x07
07555 #define MLS_INFOMASK_ENABLE          0x08
07556 
07557 MG_EXPORT BOOL GUIAPI mlsSetSlaveScreenInfo (HDC dc_mls, DWORD mask, int offset_x, int offset_y, 
07558         DWORD blend_flags, gal_pixel color_key, int alpha, int z_order);
07559 
07560 MG_EXPORT BOOL GUIAPI mlsGetSlaveScreenInfo (HDC dc_mls, DWORD mask, int* offset_x, int* offset_y,
07561                         DWORD blend_flags, gal_pixel* color_key, int* alpha, int* z_order);
07575 MG_EXPORT BOOL GUIAPI mlsEnableSlaveScreen (HDC dc_mls, BOOL enable);
07576 
07577 
07578 #define ERR_BMP_OK              0
07579 #define ERR_BMP_IMAGE_TYPE      -1
07580 #define ERR_BMP_UNKNOWN_TYPE    -2
07581 #define ERR_BMP_CANT_READ       -3
07582 #define ERR_BMP_CANT_SAVE       -4
07583 #define ERR_BMP_NOT_SUPPORTED   -5   
07584 #define ERR_BMP_MEM             -6
07585 #define ERR_BMP_LOAD            -7
07586 #define ERR_BMP_FILEIO          -8
07587 #define ERR_BMP_OTHER           -9
07588 #define ERR_BMP_ERROR_SOURCE    -10
07589 
07616 MG_EXPORT int GUIAPI LoadBitmapEx (HDC hdc, PBITMAP pBitmap, 
07617                 MG_RWops* area, const char* ext);
07618 
07626 MG_EXPORT int GUIAPI LoadBitmapFromFile (HDC hdc, PBITMAP pBitmap, 
07627                 const char* spFileName);
07628 
07635 #define LoadBitmap  LoadBitmapFromFile
07636 
07644 MG_EXPORT int GUIAPI LoadBitmapFromMem (HDC hdc, PBITMAP pBitmap, 
07645                 const void* mem, int size, const char* ext);
07646 
07658 MG_EXPORT void GUIAPI UnloadBitmap (PBITMAP pBitmap);
07659 
07674 MG_EXPORT void GUIAPI ReplaceBitmapColor (HDC hdc, PBITMAP pBitmap, 
07675                 gal_pixel iOColor, gal_pixel iNColor);
07676 
07686 MG_EXPORT void GUIAPI HFlipBitmap (BITMAP* bmp, unsigned char* inter_buff);
07687 
07697 MG_EXPORT void GUIAPI VFlipBitmap (BITMAP* bmp, unsigned char* inter_buff);
07698 
07717 MG_EXPORT void* GUIAPI InitMyBitmapSL (MG_RWops* area, 
07718                 const char* ext, MYBITMAP* my_bmp, RGB* pal);
07719 
07738 MG_EXPORT int GUIAPI LoadMyBitmapSL (MG_RWops* area, void* load_info, 
07739                 MYBITMAP* my_bmp, CB_ONE_SCANLINE cb, void* context);
07740 
07755 MG_EXPORT int GUIAPI CleanupMyBitmapSL (MYBITMAP* my_bmp, void* load_info);
07756 
07772 MG_EXPORT int GUIAPI LoadMyBitmapEx (PMYBITMAP my_bmp, RGB* pal, 
07773                 MG_RWops* area, const char* ext);
07774 
07782 MG_EXPORT int GUIAPI LoadMyBitmapFromFile (PMYBITMAP my_bmp, RGB* pal, 
07783                 const char* file_name);
07784 
07791 #define LoadMyBitmap    LoadMyBitmapFromFile
07792 
07808 MG_EXPORT int GUIAPI LoadMyBitmapFromMem (PMYBITMAP my_bmp, RGB* pal, 
07809                 const void* mem, int size, const char* ext);
07810 
07822 MG_EXPORT void GUIAPI UnloadMyBitmap (PMYBITMAP my_bmp);
07823 
07824 #ifdef _MGMISC_SAVEBITMAP
07825 
07842 MG_EXPORT int GUIAPI SaveMyBitmapToFile (PMYBITMAP my_bmp, RGB* pal, 
07843                 const char* spFileName);
07844 
07860 MG_EXPORT int GUIAPI SaveBitmapToFile (HDC hdc, PBITMAP pBitmap, 
07861                 const char* spFileName);
07862 #define SaveBitmap  SaveBitmapToFile 
07863 #endif
07864 
07886 MG_EXPORT BOOL GUIAPI InitBitmap (HDC hdc, Uint32 w, Uint32 h, Uint32 pitch, 
07887                 BYTE* bits, PBITMAP bmp);
07888 
07898 MG_EXPORT HDC GUIAPI InitSlaveScreen (const char* name, const char* mode);
07899 
07907 MG_EXPORT void GUIAPI TerminateSlaveScreen (HDC hdc);
07923 MG_EXPORT BOOL GUIAPI InitBitmapPixelFormat (HDC hdc, PBITMAP bmp);
07924 
07934 MG_EXPORT void GUIAPI DeleteBitmapAlphaPixel (PBITMAP bmp);
07935 
07936 /* Everything in the pixel format structure is read-only */
07937 typedef struct GAL_PixelFormat {
07938     GAL_Palette *palette;
07939 
07940     Uint8  BitsPerPixel;
07941     Uint8  BytesPerPixel;
07942     /* The flag indicating dithered palette */
07943     Uint8  DitheredPalette;
07944     /* The flag indicating the Most Significant Bits (MSB) 
07945      * is left when depth is less than 8. */
07946     Uint8  MSBLeft;
07947 
07948     Uint8  Rloss;
07949     Uint8  Gloss;
07950     Uint8  Bloss;
07951     Uint8  Aloss;
07952     Uint8  Rshift;
07953     Uint8  Gshift;
07954     Uint8  Bshift;
07955     Uint8  Ashift;
07956     Uint32 Rmask;
07957     Uint32 Gmask;
07958     Uint32 Bmask;
07959     Uint32 Amask;
07960 
07961     /* RGB color key information */
07962     gal_pixel colorkey;
07963     /* Alpha value information (per-surface alpha) */
07964     gal_uint8 alpha;
07965 } GAL_PixelFormat;
07966 
07967 #define _FILL_MYBITMAP
07968 
07969 #ifndef MYBITMAP_CONTXT
07970 typedef struct _MYBITMAP_CONTXT{
07971     Uint32 colorKey;
07972     Uint32 pitch;
07973     GAL_PixelFormat* AlphaPixelFormat;
07974     MYBITMAP*  mybmp;
07975 }MYBITMAP_CONTXT;
07976 #endif
07977 
07978 typedef BYTE* (* CB_DRAW_PIXEL) (HDC hdc, MYBITMAP_CONTXT* mybmp, Uint32 pixel, BYTE* dest);
07979 
07995 MG_EXPORT int GUIAPI ExpandMyBitmap (HDC hdc, PBITMAP bmp, 
07996                 const MYBITMAP* my_bmp, const RGB* pal, int frame);
07997 
08020 MG_EXPORT void GUIAPI ExpandMonoBitmap (HDC hdc, BYTE* bits, Uint32 pitch, 
08021                 const BYTE* my_bits, Uint32 my_pitch, 
08022                 Uint32 w, Uint32 h, DWORD flags, Uint32 bg, Uint32 fg);
08023                                 
08045 MG_EXPORT void GUIAPI Expand16CBitmap (HDC hdc, BYTE* bits, Uint32 pitch, 
08046                 const BYTE* my_bits, Uint32 my_pitch, 
08047                 Uint32 w, Uint32 h, DWORD flags, const RGB* pal);
08048                                 
08073 MG_EXPORT void GUIAPI Expand256CBitmap (HDC hdc, BYTE* bits, Uint32 pitch, 
08074                 const BYTE* my_bits, Uint32 my_pitch, 
08075                 Uint32 w, Uint32 h, DWORD flags, const RGB* pal, 
08076                 CB_DRAW_PIXEL cb_draw, MYBITMAP_CONTXT* mybmp);
08077 
08101 MG_EXPORT void GUIAPI CompileRGBABitmap (HDC hdc, BYTE* bits, Uint32 pitch, 
08102                 const BYTE* my_bits, Uint32 my_pitch, 
08103                 Uint32 w, Uint32 h, DWORD flags, void* pixel_format, 
08104                 CB_DRAW_PIXEL cb_draw, MYBITMAP_CONTXT* mybmp);
08105 
08118 MG_EXPORT void GUIAPI CompileRGBABitmapEx (HDC hdc, BYTE* bits, Uint32 pitch,
08119                         const BYTE* my_bits, Uint32 my_pitch,
08120                         Uint32 w, Uint32 h, DWORD flags, void* pixel_format,
08121                         CB_DRAW_PIXEL cb_draw, MYBITMAP_CONTXT* mybmp,
08122                         BYTE* alpha_mask);
08123 
08124 #ifdef _FILL_MYBITMAP
08125 MG_EXPORT int GUIAPI FillBoxWithMyBitmap (HDC hdc, int x, int y, MYBITMAP* mybmp, RGB* pal);
08126 
08127 MG_EXPORT void GUIAPI ExpandPartMonoBitmap (HDC hdc, BYTE* bits, Uint32 pitch, 
08128                 const BYTE* my_bits, Uint32 my_pitch,
08129                 Uint32 w, Uint32 h, DWORD flags, Uint32 bg, Uint32 fg, 
08130                 int stepx, CB_DRAW_PIXEL cb_draw, MYBITMAP_CONTXT* mybmp);
08131 MG_EXPORT void GUIAPI ExpandPart16CBitmap (HDC hdc, BYTE* bits, Uint32 pitch, const BYTE* my_bits, 
08132         Uint32 my_pitch, Uint32 w, Uint32 h, DWORD flags, const RGB* pal,
08133         int stepx, CB_DRAW_PIXEL cb_draw, MYBITMAP_CONTXT* mybmp);
08134 
08135 #endif
08136 
08137 #define CompileRGBBitmap CompileRGBABitmap 
08138 
08167 MG_EXPORT int GUIAPI PaintImageEx (HDC hdc, int x, int y, 
08168                 MG_RWops* area, const char* ext);
08169 
08184 MG_EXPORT int GUIAPI PaintImageFromFile (HDC hdc, int x, int y, 
08185                 const char* spFileName);
08186 
08203 MG_EXPORT int GUIAPI PaintImageFromMem (HDC hdc, int x, int y, 
08204                 const void* mem, int size, const char* ext);
08205 
08237 MG_EXPORT int GUIAPI StretchPaintImageEx (HDC hdc, int x, int y, int w, int h, 
08238                 MG_RWops* area, const char* ext);
08239 
08256 MG_EXPORT int GUIAPI StretchPaintImageFromFile (HDC hdc, int x, int y, 
08257                 int w, int h, const char* spFileName);
08258 
08277 MG_EXPORT int GUIAPI StretchPaintImageFromMem (HDC hdc, int x, int y, 
08278                 int w, int h, const void* mem, int size, const char* ext);
08279 
08280 #ifdef _MGHAVE_FIXED_MATH
08281 
08297 MG_EXPORT void GUIAPI RotateBitmap (HDC hdc, const BITMAP *bmp, 
08298                 int lx, int ty, int angle);
08299 
08310 MG_EXPORT void GUIAPI RotateBitmapVFlip (HDC hdc, const BITMAP *bmp, 
08311                 int lx, int ty, int angle);
08312 
08321 MG_EXPORT void GUIAPI RotateBitmapHFlip (HDC hdc, const BITMAP *bmp, 
08322                 int lx, int ty, int angle);
08323 
08332 MG_EXPORT void GUIAPI RotateScaledBitmap (HDC hdc, const BITMAP *bmp, 
08333                 int lx, int ty, int angle, int w, int h);
08334 
08346 MG_EXPORT void GUIAPI RotateScaledBitmapVFlip (HDC hdc, const BITMAP *bmp, 
08347                 int lx, int ty, int angle, int w, int h);
08348 
08360 MG_EXPORT void GUIAPI RotateScaledBitmapHFlip (HDC hdc, const BITMAP *bmp, 
08361                 int lx, int ty, int angle, int w, int h);
08362 
08374 MG_EXPORT void GUIAPI PivotBitmap(HDC hdc, const BITMAP *bmp, 
08375                 int lx, int ty, int cx, int cy, int angle);
08376 
08403 MG_EXPORT void GUIAPI PivotScaledBitmapFlip (HDC hdc, const BITMAP *bmp, 
08404                 fixed x, fixed y, fixed cx, fixed cy, int angle, fixed scale_x, 
08405                 fixed scale_y, BOOL h_flip, BOOL v_flip);
08406 
08407 #endif /*_MGHAVE_FIXED_MATH*/
08408 
08415 #ifdef _MGFONT_BMPF
08416 
08434 MG_EXPORT DEVFONT* GUIAPI CreateBMPDevFont (const char *bmpfont_name,
08435                 const BITMAP* glyph_bmp, const char* start_mchar, int nr_glyphs,
08436                 int glyph_width);
08437 
08453 MG_EXPORT BOOL GUIAPI AddGlyphsToBMPFont (DEVFONT* dev_font, BITMAP* glyph_bmp,
08454                 const char* start_mchar, int nr_glyphs, int glyph_width);
08455 
08466 MG_EXPORT void GUIAPI DestroyBMPFont (DEVFONT* dev_font);
08467 
08468 #ifdef _DEBUG
08469 /*
08470  * Dump avl tree info
08471  */
08472 void dump_tree (DEVFONT *dev_font);
08473 
08474 /*
08475  * look up a node in bitmap font avl tree.
08476  */ 
08477 int avl_look_up (DEVFONT *dev_font, char *start_mchar, int n);
08478 
08479 /*
08480  * destroy bitmap font avl tree.
08481  */ 
08482 void destroy_avl_tree (DEVFONT *dev_font);
08483 
08484 #endif /* end of _DEBUG */
08485 
08486 #endif /* end of _MGFONT_BMPF */ 
08487 
08501 typedef int Glyph32;
08505 #define INV_GLYPH_VALUE    -1
08506 
08513 #define IS_MBC_GLYPH(glyph)  ((glyph) & 0x80000000)
08514 
08521 #define SET_MBC_GLYPH(glyph) ((glyph) | 0x80000000)
08522 
08529 #define REAL_GLYPH(glyph)    ((glyph) & 0x7FFFFFFF)
08530 
08531 
08540 #define SELECT_DEVFONT(plogfont, glyph) \
08541     ((glyph) & 0x80000000 ? \
08542     (plogfont)->mbc_devfont : \
08543     (plogfont)->sbc_devfont)
08544 
08549 typedef enum {
08550     GLYPH_ISOLATED,
08551     GLYPH_FINAL,
08552     GLYPH_INITIAL,
08553     GLYPH_MEDIAL
08554 }SHAPETYPE;
08555 
08560 typedef struct _GLYPHMAPINFO{
08561     int byte_index;
08562     int char_len;
08563     BOOL is_rtol;
08564 }GLYPHMAPINFO;
08565 
08566 
08567 #define GLYPH_INFO_TYPE      1
08568 #define GLYPH_INFO_METRICS   2
08569 #define GLYPH_INFO_BMP       4
08570 
08571 /*the type of glyph bitmap*/
08572 #define GLYPHBMP_TYPE_MONO      0
08573 #define GLYPHBMP_TYPE_GREY      1
08574 #define GLYPHBMP_TYPE_SUBPIXEL  2
08575 #define GLYPHBMP_TYPE_PRERENDER 3
08576 
08577 /*the glyph info structure. */
08582 typedef struct _GLYPHINFO
08583 {
08585     char mask;
08587     char glyph_type;
08589     char bmp_type;
08590 
08591     Uint8 padding;
08592 
08594     int height;
08596     int descent;
08597 
08599     int advance_x, advance_y;
08601     int bbox_x, bbox_y;
08602     int bbox_w, bbox_h;
08603 
08605     size_t bmp_size;
08606     /* The pitch of the glyph bitmap. */
08607     int bmp_pitch;
08609     const unsigned char* bits;
08610 
08612     BITMAP prbitmap;
08613 } GLYPHINFO;
08614 
08628 MG_EXPORT Glyph32 GUIAPI GetGlyphValue (LOGFONT* logfont, const char* mchar,
08629         int mchar_len, const char* pre_mchar, int pre_len);
08630 
08643 MG_EXPORT Glyph32 GUIAPI GetGlyphShape (LOGFONT* logfont, const char* mchar,
08644         int mchar_len, SHAPETYPE shape_type);
08645 
08664 MG_EXPORT int GUIAPI DrawGlyph (HDC hdc, int x, int y, Glyph32 glyph_value,
08665         int* adv_x, int* adv_y);
08666 
08667 /*
08668  * \fn int GUIAPI DrawGlyphString (HDC hdc, int x, int y, \
08669  *      Glyph32* glyph_string, int len, int* adv_x, int* adv_y);
08670  * \brief Draw a glyph string.
08671  *
08672  * This function draws a glyph string to the specific postion of a DC.
08673  *
08674  * \param hdc The device context.
08675  * \param x The output start x position.
08676  * \param y The output start y position.
08677  * \param glyph_string The pointer to the glyph string.
08678  * \param len The length of the glyph string.
08679  * \param adv_x The pointer used to return the advance in x-coordinate of 
08680  *        the glyph string, can be NULL.
08681  * \param adv_y The pointer used to return the advance in y-coordinate of 
08682  *        the glyph string, can be NULL.
08683  *
08684  * \return The advance on baseline.
08685  */
08686 MG_EXPORT int GUIAPI DrawGlyphString (HDC hdc, int x, int y, Glyph32* glyph_string, 
08687         int len, int* adv_x, int* adv_y);
08688 
08706 MG_EXPORT int GUIAPI GetGlyphInfo (LOGFONT* logfont, Glyph32 glyph_value,
08707         GLYPHINFO* glyph_info);
08708 
08723 MG_EXPORT int GUIAPI GetGlyphsExtent(HDC hdc, Glyph32* glyphs, int nr_glyphs, 
08724         SIZE* size);
08725 
08741 MG_EXPORT int GUIAPI GetGlyphsExtentPoint(HDC hdc, Glyph32* glyphs,
08742         int nr_glyphs, int max_extent, SIZE* size);
08743 
08760 MG_EXPORT int GUIAPI BIDIGetTextLogicalGlyphs(LOGFONT* log_font, 
08761         const char* text, int text_len, Glyph32** glyphs, 
08762         GLYPHMAPINFO** glyphs_map);
08763 
08779 MG_EXPORT int GUIAPI BIDIGetTextVisualGlyphs (LOGFONT* log_font, 
08780         const char* text, int text_len, Glyph32** glyphs, 
08781         GLYPHMAPINFO** glyphs_map);
08782 
08799 MG_EXPORT Glyph32* GUIAPI BIDILogGlyphs2VisGlyphs (LOGFONT* log_font,
08800         Glyph32* glyphs, int nr_glyphs, GLYPHMAPINFO* glyphs_map);
08801 
08818 MG_EXPORT void GUIAPI GetTextRangesLog2Vis (LOGFONT* log_font, char* text, 
08819         int text_len, int start_index, int end_index, int** ranges, 
08820         int* nr_ranges);
08821 
08836 MG_EXPORT void GUIAPI BIDIGetLogicalEmbeddLevels (LOGFONT* log_font, 
08837         Glyph32*  glyphs, int nr_glyphs, Uint8** embedding_level_list);
08838 
08852 MG_EXPORT void GUIAPI BIDIGetVisualEmbeddLevels (LOGFONT* log_font, 
08853         Glyph32* glyphs, int nr_glyphs, Uint8**  embedding_level_list);
08854 
08856 /*
08857  * \var typedef struct _COMP_CTXT COMP_CTXT
08858  * \brief The context information of user defined color composition operators.
08859  *
08860  * \sa SetUserCompositionOps
08861  * 
08862  */   
08863 typedef struct _COMP_CTXT {
08865     int step;
08866 
08868     gal_uint8* cur_dst;
08869 
08871     gal_pixel skip_pixel;
08872 
08874     gal_pixel cur_pixel;
08875 
08877     void* user_comp_ctxt;
08878 } COMP_CTXT;
08879 
08880 /*
08881  * \var typedef struct _SPAN_CTXT SPAN_CTXT
08882  * \brief span context
08883  */
08884 typedef struct _SPAN_CTXT {
08885     GAL_PixelFormat* dst_format; /* The pixel format of the destination pixels */
08886     GAL_PixelFormat* src_format; /* The pixel format of the source pixels */
08887     void * user_context; /* The user context passed to SetColorCompositeFunc */
08888 } SPAN_CTXT;
08889 
08890 /*
08891  * \var typedef struct _COMPOSITE_CTXT COMPOSITE_CTXT
08892  * \brief composite context
08893  */
08894 typedef struct _COMPOSITE_CTXT {
08895     HDC dst_dc;
08896     int comp_mode;
08897     const int *far_bkmode;
08898     const int *far_step;
08899     const gal_pixel *far_skip_pixel; 
08900 } COMPOSITE_CTXT;
08901 
08902 /*
08903  * \var typedef struct _RASTER_CTXT RASTER_CTXT
08904  * \brief raster context
08905  */
08906 typedef struct _RASTER_CTXT {
08907     HDC dst_dc;
08908 } RASTER_CTXT;
08909 
08910 /*
08911  * \var typedef void (*CB_COMP_SETPIXEL) (COMP_CTXT* comp_ctxt)
08912  * \brief The prototype of the user defined color composition setpixel.
08913  *
08914  * This operator sets a pixel on the \a cur_dst defined in \a comp_ctxt with
08915  * the cur_pixel defined in \a comp_ctxt.
08916  *
08917  * \sa SetUserCompositionOps, COMP_CTXT
08918  */
08919 typedef void (*CB_COMP_SETPIXEL) (COMP_CTXT* comp_ctxt);
08920 
08921 /*
08922  * \var typedef void (*CB_COMP_SETHLINE) (COMP_CTXT* comp_ctxt, int w)
08923  * \brief The prototype of the user defined color composition sethline.
08924  *
08925  * This operator sets a horizital line on the \a cur_dst defined in \a comp_ctxt
08926  * with the \a cur_pixel defined in \a comp_ctxt, totally \a w pixels.
08927  *
08928  * \sa SetUserCompositionOps, COMP_CTXT
08929  */
08930 typedef void (*CB_COMP_SETHLINE) (COMP_CTXT* comp_ctxt, int w);
08931 
08932 /*
08933  * \var typedef void (*CB_COMP_PUTHLINE) (COMP_CTXT* comp_ctxt, gal_uint8* src, int w)
08934  * \brief The prototype of the user defined color composition puthline.
08935  *
08936  * This operator puts the pixels in \a src to a horizital line on the \a cur_dst 
08937  * defined in \a comp_ctxt, totally \a w pixels.
08938  *
08939  * \sa SetUserCompositionOps, COMP_CTXT
08940  */
08941 typedef void (*CB_COMP_PUTHLINE) (COMP_CTXT* comp_ctxt, gal_uint8* src, int bkmode, int w);
08942 
08964 MG_EXPORT int GUIAPI SetUserCompositionOps (HDC hdc, CB_COMP_SETPIXEL comp_setpixel, 
08965         CB_COMP_SETHLINE comp_sethline, CB_COMP_PUTHLINE comp_puthline, void* user_comp_ctxt);
08966 
08969 #ifdef _MGGAL_HI3560
08970 
08971 //#include <hi_api.h>
08972 
08973 /* API speicific to Hi3560 GAL engines */
08974 MG_EXPORT int hi3560GetVideoFD (void);
08975 MG_EXPORT void* hi3560GetFBAddress (void);
08976 MG_EXPORT int hi3560SetScreenAttr (Uint8 siAttr, void* pValue);
08977 
08978 #endif /* _MGGAL_HI3560 */
08979 
08980 MG_EXPORT int GUIAPI GetTextMCharInfo (PLOGFONT log_font, const char* mstr, int len, 
08981                 int* pos_chars);
08982 MG_EXPORT int GUIAPI GetTextWordInfo (PLOGFONT log_font, const char* mstr, int len, 
08983                 int* pos_words, WORDINFO* info_words);
08984 MG_EXPORT int GUIAPI GetFirstMCharLen (PLOGFONT log_font, const char* mstr, int len);
08985 MG_EXPORT int GUIAPI GetLastMCharLen (PLOGFONT log_font, const char* mstr, int len);
08986 MG_EXPORT int GUIAPI GetFirstWord (PLOGFONT log_font, const char* mstr, int len,
08987                     WORDINFO* word_info);
08988 MG_EXPORT int GUIAPI MB2WCEx (PLOGFONT log_font, void* dest, BOOL wc32, 
08989                 const unsigned char* mchar, int n);
08990 MG_EXPORT int GUIAPI WC2MBEx (PLOGFONT log_font, unsigned char *s, UChar32 wc);
08991 MG_EXPORT int GUIAPI MBS2WCSEx (PLOGFONT log_font, void* dest, BOOL wc32,
08992                 const unsigned char* mstr, int mstr_len, int n,
08993                 int* conved_mstr_len);
08994 MG_EXPORT int GUIAPI WCS2MBSEx (PLOGFONT log_font, unsigned char* dest,
08995                 const void *wcs, int wcs_len, BOOL wc32, int n,
08996                 int* conved_wcs_len);
08997 
08998 #ifdef __cplusplus
08999 }
09000 #endif  /* __cplusplus */
09001 
09002 #endif  /* _MGUI_GDI_H */
09003 
09004 
Generated on Thu Apr 7 15:58:31 2011 for MiniGUI V3.0.12 API Reference by  doxygen 1.6.3