MiniGUI API Reference (MiniGUI-Standalone)  v3.2.0
A mature and proven cross-platform GUI system for embedded and smart IoT devices
gdi.h
Go to the documentation of this file.
1 
45 /*
46  * $Id: gdi.h 13674 2010-12-06 06:45:01Z wanzheng $
47  *
48  * MiniGUI for Linux/uClinux, eCos, uC/OS-II, VxWorks,
49  * pSOS, ThreadX, NuCleus, OSE, and Win32.
50  */
51 
52 #ifndef _MGUI_GDI_H
53  #define _MGUI_GDI_H
54 
55 #ifdef __cplusplus
56 extern "C" {
57 #endif /* __cplusplus */
58 
110 extern MG_EXPORT gal_pixel SysPixelIndex [];
111 
118 extern const MG_EXPORT RGB SysPixelColor [];
119 
125 #define PIXEL_invalid 0
126 
132 #define PIXEL_transparent SysPixelIndex[0]
133 
139 #define PIXEL_darkblue SysPixelIndex[1]
140 
146 #define PIXEL_darkgreen SysPixelIndex[2]
147 
153 #define PIXEL_darkcyan SysPixelIndex[3]
154 
160 #define PIXEL_darkred SysPixelIndex[4]
161 
167 #define PIXEL_darkmagenta SysPixelIndex[5]
168 
174 #define PIXEL_darkyellow SysPixelIndex[6]
175 
181 #define PIXEL_darkgray SysPixelIndex[7]
182 
188 #define PIXEL_lightgray SysPixelIndex[8]
189 
195 #define PIXEL_blue SysPixelIndex[9]
196 
202 #define PIXEL_green SysPixelIndex[10]
203 
209 #define PIXEL_cyan SysPixelIndex[11]
210 
216 #define PIXEL_red SysPixelIndex[12]
217 
223 #define PIXEL_magenta SysPixelIndex[13]
224 
230 #define PIXEL_yellow SysPixelIndex[14]
231 
237 #define PIXEL_lightwhite SysPixelIndex[15]
238 
244 #define PIXEL_black SysPixelIndex[16]
245 
246 /* Compatiblity definitions */
251 #define COLOR_invalid PIXEL_invalid
252 
257 #define COLOR_transparent PIXEL_transparent
258 
263 #define COLOR_darkred PIXEL_darkred
264 
269 #define COLOR_darkgreen PIXEL_darkgreen
270 
275 #define COLOR_darkyellow PIXEL_darkyellow
276 
281 #define COLOR_darkblue PIXEL_darkblue
282 
287 #define COLOR_darkmagenta PIXEL_darkmagenta
288 
293 #define COLOR_darkcyan PIXEL_darkcyan
294 
299 #define COLOR_lightgray PIXEL_lightgray
300 
305 #define COLOR_darkgray PIXEL_darkgray
306 
311 #define COLOR_red PIXEL_red
312 
317 #define COLOR_green PIXEL_green
318 
323 #define COLOR_yellow PIXEL_yellow
324 
329 #define COLOR_blue PIXEL_blue
330 
335 #define COLOR_magenta PIXEL_magenta
336 
341 #define COLOR_cyan PIXEL_cyan
342 
347 #define COLOR_lightwhite PIXEL_lightwhite
348 
353 #define COLOR_black PIXEL_black
354 
359 #define SysColorIndex SysPixelIndex
360 
392 typedef struct _BLOCKHEAP
393 {
394 #ifdef _MGRM_THREADS
395  pthread_mutex_t lock;
396 #endif
397 
400  size_t bd_size;
404  size_t heap_size;
408  int free;
412  void* heap;
413 } BLOCKHEAP;
414 
422 
445 MG_EXPORT extern void InitBlockDataHeap (PBLOCKHEAP heap,
446  size_t bd_size, size_t heap_size);
447 
463 MG_EXPORT extern void* BlockDataAlloc (PBLOCKHEAP heap);
464 
478 MG_EXPORT extern void BlockDataFree (PBLOCKHEAP heap, void* data);
479 
488 MG_EXPORT extern void DestroyBlockDataHeap (PBLOCKHEAP heap);
489 
499 struct _BITMAP;
500 
505 typedef struct _BITMAP BITMAP;
506 
512 typedef BITMAP* PBITMAP;
513 
514 struct _MYBITMAP;
515 
520 typedef struct _MYBITMAP MYBITMAP;
521 
527 typedef struct _MYBITMAP* PMYBITMAP;
528 
529 
566 typedef struct _CLIPRECT
567 {
575  struct _CLIPRECT* next;
579  struct _CLIPRECT* prev;
580 } CLIPRECT;
581 typedef CLIPRECT* PCLIPRECT;
582 
583 /* Clipping Region */
584 #define NULLREGION 0x00
585 #define SIMPLEREGION 0x01
586 #define COMPLEXREGION 0x02
587 
591 typedef struct _CLIPRGN
592 {
606  BYTE reserved[3];
614  PCLIPRECT head;
618  PCLIPRECT tail;
623  PBLOCKHEAP heap;
624 } CLIPRGN;
625 
632 typedef CLIPRGN* PCLIPRGN;
633 
647 #define InitFreeClipRectList(heap, size) \
648  InitBlockDataHeap (heap, sizeof (CLIPRECT), size)
649 
660 #define ClipRectAlloc(heap) BlockDataAlloc (heap)
661 
674 #define FreeClipRect(heap, cr) BlockDataFree (heap, cr);
675 
687 #define DestroyFreeClipRectList(heap) DestroyBlockDataHeap (heap);
688 
709 MG_EXPORT void GUIAPI InitClipRgn (PCLIPRGN pRgn, PBLOCKHEAP pFreeList);
710 
721 MG_EXPORT void GUIAPI EmptyClipRgn (PCLIPRGN pRgn);
722 
732 MG_EXPORT PCLIPRGN GUIAPI CreateClipRgn (void);
733 
744 MG_EXPORT void GUIAPI DestroyClipRgn (PCLIPRGN pRgn);
745 
762 MG_EXPORT BOOL GUIAPI ClipRgnCopy (PCLIPRGN pDstRgn, const CLIPRGN* pSrcRgn);
763 
784 MG_EXPORT BOOL GUIAPI ClipRgnIntersect (PCLIPRGN pRstRgn,
785  const CLIPRGN* pRgn1, const CLIPRGN* pRgn2);
786 
799 MG_EXPORT void GUIAPI GetClipRgnBoundRect (PCLIPRGN pRgn, PRECT pRect);
800 
817 MG_EXPORT BOOL GUIAPI SetClipRgn (PCLIPRGN pRgn, const RECT* pRect);
818 
832 MG_EXPORT BOOL GUIAPI IsEmptyClipRgn (const CLIPRGN* pRgn);
833 
847 MG_EXPORT BOOL GUIAPI AddClipRect (PCLIPRGN pRgn, const RECT* pRect);
848 
863 MG_EXPORT BOOL GUIAPI IntersectClipRect (PCLIPRGN pRgn, const RECT* pRect);
864 
879 MG_EXPORT BOOL GUIAPI SubtractClipRect (PCLIPRGN pRgn, const RECT* pRect);
880 
896 MG_EXPORT BOOL GUIAPI PtInRegion (PCLIPRGN region, int x, int y);
897 
912 MG_EXPORT BOOL GUIAPI RectInRegion (PCLIPRGN region, const RECT* rect);
913 
929 MG_EXPORT void GUIAPI OffsetRegionEx (PCLIPRGN region, const RECT *rcClient,
930  const RECT *rcScroll, int x, int y);
931 
943 MG_EXPORT void GUIAPI OffsetRegion (PCLIPRGN region, int x, int y);
944 
961 MG_EXPORT BOOL GUIAPI UnionRegion (PCLIPRGN dst,
962  const CLIPRGN* src1, const CLIPRGN* src2);
963 
979 MG_EXPORT BOOL GUIAPI SubtractRegion (CLIPRGN* rgnD,
980  const CLIPRGN* rgnM, const CLIPRGN* rgnS);
981 
998 MG_EXPORT BOOL GUIAPI XorRegion (CLIPRGN *dst,
999  const CLIPRGN *src1, const CLIPRGN *src2);
1000 
1006 #define UnionRectWithRegion AddClipRect
1007 
1013 #define CopyRegion ClipRgnCopy
1014 
1020 #define IntersectRegion ClipRgnIntersect
1021 
1035 MG_EXPORT BOOL GUIAPI InitCircleRegion (PCLIPRGN dst, int x, int y, int r);
1036 
1051 MG_EXPORT BOOL GUIAPI InitEllipseRegion (PCLIPRGN dst,
1052  int x, int y, int rx, int ry);
1053 
1066 MG_EXPORT BOOL GUIAPI InitPolygonRegion (PCLIPRGN dst,
1067  const POINT* pts, int vertices);
1068 
1114 #define HDC_SCREEN ((HDC)0)
1115 
1116 /*
1117  * This is a system screen DC create for MiniGUI internal usage, for example,
1118  * menu and z-order operations
1119  */
1120 #define HDC_SCREEN_SYS ((HDC)1)
1121 
1126 #define HDC_INVALID ((HDC)-1)
1127 
1128 #define GDCAP_COLORNUM 0
1129 #define GDCAP_HPIXEL 1
1130 #define GDCAP_VPIXEL 2
1131 #define GDCAP_MAXX 3
1132 #define GDCAP_MAXY 4
1133 #define GDCAP_DEPTH 5
1134 #define GDCAP_BPP 6
1135 #define GDCAP_BITSPP 7
1136 #define GDCAP_RMASK 8
1137 #define GDCAP_GMASK 9
1138 #define GDCAP_BMASK 10
1139 #define GDCAP_AMASK 11
1140 #define GDCAP_PITCH 12
1141 
1187 MG_EXPORT unsigned int GUIAPI GetGDCapability (HDC hdc, int iItem);
1188 
1206 MG_EXPORT HDC GUIAPI GetDC (HWND hwnd);
1207 
1225 MG_EXPORT HDC GUIAPI GetClientDC (HWND hwnd);
1226 
1251 MG_EXPORT HDC GUIAPI GetSubDC (HDC hdc, int off_x, int off_y, int width, int height);
1252 
1263 MG_EXPORT void GUIAPI ReleaseDC (HDC hdc);
1264 
1278 MG_EXPORT HWND GUIAPI WindowFromDC (HDC hdc);
1279 
1300 MG_EXPORT int GUIAPI SaveDC (HDC hdc);
1301 
1327 MG_EXPORT BOOL GUIAPI RestoreDC (HDC hdc, int saved_dc);
1328 
1329 #define MEMDC_FLAG_NONE 0x00000000 /* None. */
1330 #define MEMDC_FLAG_SWSURFACE 0x00000000 /* DC is in system memory */
1331 #define MEMDC_FLAG_HWSURFACE 0x00000001 /* DC is in video memory */
1332 #define MEMDC_FLAG_SRCCOLORKEY 0x00001000 /* Blit uses a source color key */
1333 #define MEMDC_FLAG_SRCALPHA 0x00010000 /* Blit uses source alpha blending*/
1334 #define MEMDC_FLAG_SRCPIXELALPHA 0x00020000 /* Blit uses source per-pixel alpha blending*/
1335 #define MEMDC_FLAG_RLEACCEL 0x00004000 /* Surface is RLE encoded */
1336 
1357 MG_EXPORT HDC GUIAPI CreateCompatibleDCEx (HDC hdc, int width, int height);
1358 
1373 MG_EXPORT BOOL GUIAPI IsCompatibleDC (HDC hdc1, HDC hdc2);
1374 
1418 MG_EXPORT HDC GUIAPI CreateMemDCEx (int width, int height, int depth, DWORD flags,
1419  Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask,
1420  void* bits, int pitch);
1421 
1455 static inline HDC GUIAPI CreateMemDC (int width, int height, int depth, DWORD flags,
1456  Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
1457 {
1458  return CreateMemDCEx (width, height, depth, flags, Rmask, Gmask, Bmask, Amask,
1459  NULL, 0);
1460 }
1461 
1486 MG_EXPORT HDC GUIAPI CreateSubMemDC (HDC parent, int off_x, int off_y,
1487  int width, int height, BOOL comp_to_parent);
1488 
1504 MG_EXPORT HDC GUIAPI CreateMemDCFromBitmap (HDC hdc, const BITMAP* bmp);
1505 
1531 MG_EXPORT HDC GUIAPI CreateMemDCFromMyBitmap (const MYBITMAP* my_bmp, const RGB* pal);
1532 
1556 MG_EXPORT BOOL GUIAPI ConvertMemDC (HDC mem_dc, HDC ref_dc, DWORD flags);
1557 
1587 MG_EXPORT BOOL GUIAPI SetMemDCAlpha (HDC mem_dc, DWORD flags, Uint8 alpha);
1588 
1608 MG_EXPORT BOOL GUIAPI SetMemDCColorKey (HDC mem_dc, DWORD flags,
1609  Uint32 color_key);
1610 
1623 MG_EXPORT void GUIAPI DeleteMemDC (HDC mem_dc);
1624 
1637 #define CreateCompatibleDC(hdc) CreateCompatibleDCEx(hdc, 0, 0)
1638 
1649 #define DeleteCompatibleDC(hdc) DeleteMemDC(hdc)
1650 
1688 MG_EXPORT Uint8* GUIAPI LockDC (HDC hdc, const RECT* rw_rc,
1689  int* width, int* height, int* pitch);
1690 
1707 typedef void (* CB_DIRECT_DRAW_RECT) (HDC hdc, Uint8 * pixels,
1708  int pitch, int bytesPerPixel, const RECT* rc, void* context);
1709 
1736 MG_EXPORT BOOL GUIAPI LockDCEx (HDC hdc, const PCLIPRGN region,
1737  void* context, CB_DIRECT_DRAW_RECT cb);
1738 
1747 MG_EXPORT void GUIAPI UnlockDC (HDC hdc);
1748 
1767 MG_EXPORT HDC GUIAPI CreatePrivateDC (HWND hwnd);
1768 
1788 MG_EXPORT HDC GUIAPI CreatePrivateClientDC (HWND hwnd);
1789 
1816 HDC GUIAPI CreatePrivateSubDC(HDC hdc, int off_x, int off_y,
1817  int width, int height);
1818 
1840 MG_EXPORT HDC GUIAPI GetPrivateClientDC (HWND hwnd);
1841 
1851 MG_EXPORT void GUIAPI DeletePrivateDC (HDC hdc);
1852 
1875 MG_EXPORT HDC GUIAPI CreateSecondaryDC (HWND hwnd);
1876 
1892 typedef int (* ON_UPDATE_SECONDARYDC)(HWND hwnd, HDC secondary_dc,
1893  HDC real_dc, const RECT* secondary_rc, const RECT* real_rc,
1894  const RECT* main_update_rc);
1895 
1896 #define ON_UPDSECDC_DEFAULT ((ON_UPDATE_SECONDARYDC)0)
1897 #define ON_UPDSECDC_DONOTHING ((ON_UPDATE_SECONDARYDC)0xFFFFFFFF)
1898 
1924 MG_EXPORT HDC GUIAPI SetSecondaryDC (HWND hwnd, HDC secondary_dc,
1925  ON_UPDATE_SECONDARYDC on_update_secondarydc);
1926 
1943 MG_EXPORT HDC GUIAPI GetSecondaryDC (HWND hwnd);
1944 
1961 MG_EXPORT HDC GUIAPI GetSecondaryClientDC (HWND hwnd);
1962 
1974 MG_EXPORT void GUIAPI ReleaseSecondaryDC (HWND hwnd, HDC hdc);
1975 
1984 MG_EXPORT void GUIAPI DeleteSecondaryDC (HWND hwnd);
1985 
1993 #define BM_TRANSPARENT 1
1994 #define BM_OPAQUE 0
1995 
1996 #define DC_ATTR_BK_COLOR 0
1997 #define DC_ATTR_PEN_COLOR 1
1998 #define DC_ATTR_BRUSH_COLOR 2
1999 #define DC_ATTR_TEXT_COLOR 3
2000 
2001 #define DC_ATTR_BK_MODE 4
2002 
2003 #define DC_ATTR_TAB_STOP 5
2004 #define DC_ATTR_CHAR_EXTRA 6
2005 #define DC_ATTR_ALINE_EXTRA 7
2006 #define DC_ATTR_BLINE_EXTRA 8
2007 
2008 #define DC_ATTR_MAP_MODE 9
2009 
2010 #define DC_ATTR_TEXT_ALIGN 10
2011 
2012 #ifdef _MGHAVE_ADV_2DAPI
2013 
2014 #define DC_ATTR_PEN_TYPE 11
2015 #define DC_ATTR_PEN_CAP_STYLE 12
2016 #define DC_ATTR_PEN_JOIN_STYLE 13
2017 #define DC_ATTR_PEN_WIDTH 14
2018 
2019 #define DC_ATTR_BRUSH_TYPE 15
2020 
2021 #define NR_DC_ATTRS 16
2022 
2023 #else
2024 
2025 #define NR_DC_ATTRS 11
2026 
2027 #endif
2028 
2029 
2074 MG_EXPORT Uint32 GUIAPI GetDCAttr (HDC hdc, int attr);
2075 
2089 MG_EXPORT Uint32 GUIAPI SetDCAttr (HDC hdc, int attr, Uint32 value);
2090 
2100 #define GetBkColor(hdc) GetDCAttr (hdc, DC_ATTR_BK_COLOR)
2101 
2117 #define GetBkMode(hdc) GetDCAttr (hdc, DC_ATTR_BK_MODE)
2118 
2128 #define GetPenColor(hdc) GetDCAttr (hdc, DC_ATTR_PEN_COLOR)
2129 
2139 #define GetBrushColor(hdc) GetDCAttr (hdc, DC_ATTR_BRUSH_COLOR)
2140 
2150 #define GetTextColor(hdc) GetDCAttr (hdc, DC_ATTR_TEXT_COLOR)
2151 
2161 #define GetTabStop(hdc) GetDCAttr (hdc, DC_ATTR_TAB_STOP)
2162 
2173 #define SetBkColor(hdc, color) \
2174  SetDCAttr (hdc, DC_ATTR_BK_COLOR, (DWORD) color)
2175 
2193 #define SetBkMode(hdc, mode) \
2194  SetDCAttr (hdc, DC_ATTR_BK_MODE, (DWORD) mode)
2195 
2206 #define SetPenColor(hdc, color) \
2207  SetDCAttr (hdc, DC_ATTR_PEN_COLOR, (DWORD) color)
2208 
2219 #define SetBrushColor(hdc, color) \
2220  SetDCAttr (hdc, DC_ATTR_BRUSH_COLOR, (DWORD) color)
2221 
2232 #define SetTextColor(hdc, color) \
2233  SetDCAttr (hdc, DC_ATTR_TEXT_COLOR, (DWORD) color)
2234 
2245 #define SetTabStop(hdc, value) \
2246  SetDCAttr (hdc, DC_ATTR_TAB_STOP, (DWORD) value)
2247 
2248 #define ROP_SET 0
2249 #define ROP_AND 1
2250 #define ROP_OR 2
2251 #define ROP_XOR 3
2252 #define ROP_COMPOSITE 4
2253 #define ROP_COMP_USER 0x0100
2254 /* Reserved for future
2255  * #define ROP_COMP_XXX 0x01XX
2256  */
2257 
2282 MG_EXPORT int GUIAPI GetRasterOperation (HDC hdc);
2283 
2311 MG_EXPORT int GUIAPI SetRasterOperation (HDC hdc, int rop);
2312 
2335 MG_EXPORT int GUIAPI GetPalette (HDC hdc, int start, int len, GAL_Color* cmap);
2336 
2351 MG_EXPORT BOOL GUIAPI SetPalette (HDC hdc, int start, int len, GAL_Color* cmap);
2352 
2364 MG_EXPORT BOOL GUIAPI SetColorfulPalette (HDC hdc);
2365 
2379 MG_EXPORT HPALETTE GUIAPI CreatePalette (GAL_Palette* pal);
2380 
2396 MG_EXPORT BOOL GUIAPI SelectPalette (HDC hdc, HPALETTE hpal, BOOL reserved);
2397 
2419 MG_EXPORT BOOL GUIAPI RealizePalette (HDC hdc);
2420 
2434 MG_EXPORT BOOL GUIAPI ResizePalette (HPALETTE hpal, int len);
2435 
2446 MG_EXPORT void GUIAPI DestroyPalette (HPALETTE hpal);
2447 
2456 MG_EXPORT HPALETTE GUIAPI GetDefaultPalette (void);
2457 
2474 MG_EXPORT int GUIAPI GetPaletteEntries (HPALETTE hpal,
2475  int start, int len, GAL_Color* cmap);
2476 
2493 MG_EXPORT int GUIAPI SetPaletteEntries (HPALETTE hpal,
2494  int start, int len, GAL_Color* cmap);
2495 
2514 MG_EXPORT UINT GUIAPI GetNearestPaletteIndex (HPALETTE hpal,
2515  Uint8 red, Uint8 green, Uint8 blue);
2516 
2534 MG_EXPORT RGBCOLOR GUIAPI GetNearestColor (HDC hdc,
2535  Uint8 red, Uint8 green, Uint8 blue);
2536 
2560 MG_EXPORT void GUIAPI SetPixel (HDC hdc, int x, int y, gal_pixel pixel);
2561 
2580 MG_EXPORT gal_pixel GUIAPI SetPixelRGB (HDC hdc, int x, int y,
2581  Uint8 r, Uint8 g, Uint8 b);
2582 
2603 MG_EXPORT gal_pixel GUIAPI SetPixelRGBA (HDC hdc, int x, int y,
2604  Uint8 r, Uint8 g, Uint8 b, Uint8 a);
2605 
2621 MG_EXPORT gal_pixel GUIAPI GetPixel (HDC hdc, int x, int y);
2622 
2644 MG_EXPORT gal_pixel GUIAPI GetPixelRGB (HDC hdc, int x, int y,
2645  Uint8* r, Uint8* g, Uint8* b);
2646 
2672 MG_EXPORT gal_pixel GUIAPI GetPixelRGBA (HDC hdc, int x, int y,
2673  Uint8* r, Uint8* g, Uint8* b, Uint8* a);
2674 
2689 MG_EXPORT void GUIAPI RGBA2Pixels (HDC hdc, const RGB* rgbs,
2690  gal_pixel* pixels, int count);
2691 
2710 static inline gal_pixel RGBA2Pixel (HDC hdc,
2711  Uint8 r, Uint8 g, Uint8 b, Uint8 a)
2712 {
2713  RGB rgb = {r, g, b, a};
2714  gal_pixel pixel;
2715 
2716  RGBA2Pixels (hdc, &rgb, &pixel, 1);
2717  return pixel;
2718 }
2719 
2734 MG_EXPORT void GUIAPI RGB2Pixels (HDC hdc, const RGB* rgbs,
2735  gal_pixel* pixels, int count);
2736 
2754 static inline gal_pixel RGB2Pixel (HDC hdc, Uint8 r, Uint8 g, Uint8 b)
2755 {
2756  RGB rgb = {r, g, b, 0};
2757  gal_pixel pixel;
2758 
2759  RGB2Pixels (hdc, &rgb, &pixel, 1);
2760  return pixel;
2761 }
2762 
2777 MG_EXPORT void GUIAPI Pixel2RGBs (HDC hdc, const gal_pixel* pixels,
2778  RGB* rgbs, int count);
2779 
2801 static inline void Pixel2RGB (HDC hdc, gal_pixel pixel,
2802  Uint8* r, Uint8* g, Uint8* b)
2803 {
2804  RGB rgb;
2805  Pixel2RGBs (hdc, &pixel, &rgb, 1);
2806  *r = rgb.r; *g = rgb.g, *b = rgb.b;
2807 }
2808 
2823 MG_EXPORT void GUIAPI Pixel2RGBAs (HDC hdc, const gal_pixel* pixels,
2824  RGB* rgbs, int count);
2825 
2849 static inline void Pixel2RGBA (HDC hdc, gal_pixel pixel,
2850  Uint8* r, Uint8* g, Uint8* b, Uint8* a)
2851 {
2852  RGB rgb;
2853  Pixel2RGBAs (hdc, &pixel, &rgb, 1);
2854  *r = rgb.r; *g = rgb.g, *b = rgb.b; *a = rgb.a;
2855 }
2856 
2867 static inline DWORD Pixel2DWORD (HDC hdc, gal_pixel pixel)
2868 {
2869  Uint8 r,g,b,a;
2870  Pixel2RGBA (hdc, pixel, &r, &g, &b, &a);
2871  return MakeRGBA (r, g, b, a);
2872 }
2873 
2874 #define PIXEL2DWORD(hdc, pixel) Pixel2DWORD(hdc, pixel)
2875 
2886 static inline gal_pixel DWORD2Pixel (HDC hdc, DWORD dword)
2887 {
2888  return RGBA2Pixel (hdc,
2889  GetRValue(dword), GetGValue(dword),
2890  GetBValue(dword), GetAValue(dword));
2891 }
2892 
2910 MG_EXPORT void GUIAPI FocusRect (HDC hdc, int x0, int y0, int x1, int y1);
2911 
2929 MG_EXPORT void GUIAPI DrawHVDotLine (HDC hdc, int x, int y, int w_h, BOOL H_V);
2930 
2947 #define DrawHDotLine(hdc, x, y, w) DrawHVDotLine (hdc, x, y, w, TRUE);
2948 
2965 #define DrawVDotLine(hdc, x, y, h) DrawHVDotLine (hdc, x, y, h, FALSE);
2966 
2996 MG_EXPORT BOOL GUIAPI LineClipper (const RECT* cliprc,
2997  int *_x0, int *_y0, int *_x1, int *_y1);
2998 
3003 typedef void (* CB_LINE) (void* context, int stepx, int stepy);
3004 
3027 MG_EXPORT void GUIAPI LineGenerator (void* context,
3028  int x1, int y1, int x2, int y2, CB_LINE cb);
3029 
3034 typedef void (* CB_CIRCLE) (void* context, int x1, int x2, int y);
3035 
3063 MG_EXPORT void GUIAPI CircleGenerator (void* context,
3064  int sx, int sy, int r, CB_CIRCLE cb);
3065 
3070 typedef void (* CB_ELLIPSE) (void* context, int x1, int x2, int y);
3071 
3096 MG_EXPORT void GUIAPI EllipseGenerator (void* context,
3097  int sx, int sy, int rx, int ry, CB_ELLIPSE cb);
3098 
3103 typedef void (* CB_ARC) (void* context, int x, int y);
3104 
3128 MG_EXPORT void GUIAPI CircleArcGenerator (void* context,
3129  int sx, int sy, int r, int ang1, int ang2, CB_ARC cb);
3130 
3135 typedef void (* CB_POLYGON) (void* context, int x1, int x2, int y);
3136 
3175 MG_EXPORT BOOL GUIAPI MonotoneVerticalPolygonGenerator (void* context,
3176  const POINT* pts, int vertices, CB_POLYGON cb);
3177 
3195 MG_EXPORT BOOL GUIAPI PolygonIsMonotoneVertical (const POINT* pts,
3196  int vertices);
3197 
3224 MG_EXPORT BOOL GUIAPI PolygonGeneratorEx (void* context,
3225  const POINT* pts, int vertices, CB_POLYGON cb, RECT* rc_output);
3235 #define PolygonGenerator(context, pts, vertices, cb) \
3236  PolygonGeneratorEx(context, pts, vertices, cb, NULL)
3237 
3242 typedef BOOL (* CB_EQUAL_PIXEL) (void* context, int x, int y);
3243 
3248 typedef void (* CB_FLOOD_FILL) (void* context, int x1, int x2, int y);
3249 
3270 MG_EXPORT BOOL GUIAPI FloodFillGenerator (void* context,
3271  const RECT* src_rc, int x, int y,
3272  CB_EQUAL_PIXEL cb_equal_pixel, CB_FLOOD_FILL cb_flood_fill);
3273 
3274 /* DDA algorithm */
3275 #define BITMAP_SCALER_DDA 0
3276 /* Bilinear interpolation algorithm */
3277 #define BITMAP_SCALER_BILINEAR 1
3278 
3295 MG_EXPORT int GUIAPI SetBitmapScalerType (HDC hdc, int scaler_type);
3296 
3310 MG_EXPORT void GUIAPI MoveTo (HDC hdc, int x, int y);
3311 
3326 MG_EXPORT void GUIAPI LineTo (HDC hdc, int x, int y);
3327 
3343 MG_EXPORT void GUIAPI Rectangle (HDC hdc, int x0, int y0, int x1, int y1);
3344 
3359 MG_EXPORT void GUIAPI PolyLineTo (HDC hdc, const POINT* pts, int vertices);
3360 
3375 MG_EXPORT void GUIAPI SplineTo (HDC hdc, const POINT* pts);
3376 
3391 MG_EXPORT void GUIAPI Circle (HDC hdc, int sx, int sy, int r);
3392 
3409 MG_EXPORT void GUIAPI Ellipse (HDC hdc, int sx, int sy, int rx, int ry);
3410 
3432 MG_EXPORT void GUIAPI CircleArc (HDC hdc, int sx, int sy, int r,
3433  int ang1, int ang2);
3434 
3449 MG_EXPORT void GUIAPI FillBox (HDC hdc, int x, int y, int w, int h);
3450 
3464 MG_EXPORT void GUIAPI FillCircle (HDC hdc, int sx, int sy, int r);
3465 
3482 MG_EXPORT void GUIAPI FillEllipse (HDC hdc, int sx, int sy, int rx, int ry);
3483 
3497 MG_EXPORT BOOL GUIAPI FillPolygon (HDC hdc, const POINT* pts, int vertices);
3498 
3512 MG_EXPORT BOOL GUIAPI FloodFill (HDC hdc, int x, int y);
3513 
3514 #ifdef _MGHAVE_ADV_2DAPI
3515 
3524 typedef enum
3525 {
3543 } PenType;
3544 
3554 #define GetPenType(hdc) \
3555  GetDCAttr (hdc, DC_ATTR_PEN_TYPE)
3556 
3567 #define SetPenType(hdc, type) \
3568  SetDCAttr (hdc, DC_ATTR_PEN_TYPE, (DWORD) type)
3569 
3589 MG_EXPORT void GUIAPI SetPenDashes (HDC hdc, int dash_offset,
3590  const unsigned char* dash_list, int n);
3591 
3595 typedef enum
3596 {
3612 } PTCapStyle;
3613 
3623 #define GetPenCapStyle(hdc) \
3624  GetDCAttr (hdc, DC_ATTR_PEN_CAP_STYLE)
3625 
3636 #define SetPenCapStyle(hdc, style) \
3637  SetDCAttr (hdc, DC_ATTR_PEN_CAP_STYLE, (DWORD) style)
3638 
3642 typedef enum
3643 {
3657 } PTJoinStyle;
3658 
3668 #define GetPenJoinStyle(hdc) GetDCAttr (hdc, DC_ATTR_PEN_JOIN_STYLE)
3669 
3680 #define SetPenJoinStyle(hdc, style) \
3681  SetDCAttr (hdc, DC_ATTR_PEN_JOIN_STYLE, (DWORD) style)
3682 
3692 #define GetPenWidth(hdc) \
3693  GetDCAttr (hdc, DC_ATTR_PEN_WIDTH)
3694 
3705 #define SetPenWidth(hdc, width) \
3706  SetDCAttr (hdc, DC_ATTR_PEN_WIDTH, (DWORD) width)
3707 
3715 typedef enum
3716 {
3739 } BrushType;
3740 
3750 #define GetBrushType(hdc) \
3751  GetDCAttr (hdc, DC_ATTR_BRUSH_TYPE)
3752 
3763 #define SetBrushType(hdc, type) \
3764  SetDCAttr (hdc, DC_ATTR_BRUSH_TYPE, (DWORD) type)
3765 
3767 typedef struct _STIPPLE
3768 {
3770  int width;
3772  int height;
3773 
3775  int pitch;
3776 
3778  size_t size;
3779 
3781  const unsigned char* bits;
3782 } STIPPLE;
3783 
3795 MG_EXPORT void GUIAPI SetBrushInfo (HDC hdc,
3796  const BITMAP* tile, const STIPPLE* stipple);
3797 
3812 MG_EXPORT void GUIAPI SetBrushOrigin (HDC hdc, int x, int y);
3813 
3831 MG_EXPORT void GUIAPI LineEx (HDC hdc, int x1, int y1, int x2, int y2);
3832 
3856 MG_EXPORT void GUIAPI ArcEx (HDC hdc, int x, int y, int width, int height,
3857  int ang1, int ang2);
3858 
3882 MG_EXPORT void GUIAPI FillArcEx (HDC hdc, int x, int y, int width, int height,
3883  int ang1, int ang2);
3884 
3897 MG_EXPORT void GUIAPI PolyLineEx (HDC hdc, const POINT* pts, int nr_pts);
3898 
3902 typedef struct _ARC
3903 {
3905  int x;
3907  int y;
3908 
3910  int width;
3912  int height;
3913 
3918  int angle1;
3922  int angle2;
3923 } ARC;
3924 
3937 MG_EXPORT void GUIAPI PolyArcEx (HDC hdc, const ARC* arcs, int nr_arcs);
3938 
3951 MG_EXPORT void GUIAPI PolyFillArcEx (HDC hdc, const ARC* arcs, int nr_arcs);
3952 
3971 MG_EXPORT BOOL GUIAPI RoundRect (HDC hdc, int x0, int y0, int x1, int y1, int cw, int ch);
3972 
3976 #endif
3977 
4023 #define MM_TEXT 0
4024 #define MM_ANISOTROPIC 1
4025 
4041 #define GetMapMode(hdc) GetDCAttr (hdc, DC_ATTR_MAP_MODE)
4042 
4058 #define SetMapMode(hdc, mapmode) \
4059  SetDCAttr (hdc, DC_ATTR_MAP_MODE, (DWORD)mapmode)
4060 
4085 MG_EXPORT void GUIAPI GetDCLCS (HDC hdc, int which, POINT* pt);
4086 
4111 MG_EXPORT void GUIAPI SetDCLCS (HDC hdc, int which, const POINT* pt);
4112 
4113 #define DC_LCS_VORG 0
4114 #define DC_LCS_VEXT 1
4115 #define DC_LCS_WORG 2
4116 #define DC_LCS_WEXT 3
4117 #define NR_DC_LCS_PTS 4
4118 
4132 #define GetViewportOrg(hdc, pPt) GetDCLCS(hdc, DC_LCS_VORG, pPt)
4133 
4147 #define GetViewportExt(hdc, pPt) GetDCLCS(hdc, DC_LCS_VEXT, pPt)
4148 
4162 #define GetWindowOrg(hdc, pPt) GetDCLCS(hdc, DC_LCS_WORG, pPt)
4163 
4177 #define GetWindowExt(hdc, pPt) GetDCLCS(hdc, DC_LCS_WEXT, pPt)
4178 
4192 #define SetViewportOrg(hdc, pPt) SetDCLCS(hdc, DC_LCS_VORG, pPt)
4193 
4207 #define SetViewportExt(hdc, pPt) SetDCLCS(hdc, DC_LCS_VEXT, pPt)
4208 
4222 #define SetWindowOrg(hdc, pPt) SetDCLCS(hdc, DC_LCS_WORG, pPt)
4223 
4237 #define SetWindowExt(hdc, pPt) SetDCLCS(hdc, DC_LCS_WEXT, pPt)
4238 
4257 MG_EXPORT void GUIAPI DPtoLP (HDC hdc, POINT* pPt);
4258 
4259 
4278 MG_EXPORT void GUIAPI LPtoDP (HDC hdc, POINT* pPt);
4279 
4298 MG_EXPORT void GUIAPI SPtoLP(HDC hdc, POINT* pPt);
4299 
4300 
4319 MG_EXPORT void GUIAPI LPtoSP(HDC hdc, POINT* pPt);
4320 
4341 MG_EXPORT void GUIAPI ExcludeClipRect (HDC hdc, const RECT* prc);
4342 
4356 MG_EXPORT void GUIAPI IncludeClipRect (HDC hdc, const RECT* prc);
4357 
4373 MG_EXPORT BOOL GUIAPI PtVisible (HDC hdc, int x, int y);
4374 
4387 MG_EXPORT void GUIAPI ClipRectIntersect (HDC hdc, const RECT* prc);
4388 
4401 MG_EXPORT void GUIAPI SelectClipRect (HDC hdc, const RECT* prc);
4402 
4403 #define RGN_COPY 0x00
4404 #define RGN_DIFF 0x01
4405 #define RGN_AND 0x02
4406 #define RGN_OR 0x03
4407 #define RGN_XOR 0x04
4408 
4462 MG_EXPORT int GUIAPI SelectClipRegionEx (HDC hdc, const CLIPRGN* pRgn,
4463  int fnMode);
4464 
4477 MG_EXPORT void GUIAPI SelectClipRegion (HDC hdc, const CLIPRGN* pRgn);
4478 
4501 MG_EXPORT int GUIAPI OffsetClipRegion (HDC hdc, int nXOffset, int nYOffset);
4502 
4515 MG_EXPORT void GUIAPI GetBoundsRect (HDC hdc, RECT* pRect);
4516 
4534 MG_EXPORT BOOL GUIAPI RectVisible (HDC hdc, const RECT* pRect);
4535 
4554 MG_EXPORT int GUIAPI GetClipBox (HDC hdc, RECT* clipbox);
4555 
4574 MG_EXPORT int GUIAPI GetClipRegion (HDC hdc, CLIPRGN* cliprgn);
4575 
4611 MG_EXPORT BOOL GUIAPI GetBitmapFromDC (HDC hdc,
4612  int x, int y, int w, int h, BITMAP* bmp);
4613 
4649 MG_EXPORT BOOL GUIAPI FillBoxWithBitmap (HDC hdc, int x, int y, int w, int h,
4650  const BITMAP *bmp);
4651 
4705 MG_EXPORT BOOL GUIAPI FillBoxWithBitmapPart (HDC hdc,
4706  int x, int y, int w, int h,
4707  int bw, int bh, const BITMAP* bmp, int xo, int yo);
4708 
4731 MG_EXPORT BOOL GUIAPI FillBitmapPartInBox (HDC hdc, int box_x, int box_y,
4732  int box_w, int box_h, const BITMAP* pbmp, int bmp_x, int bmp_y,
4733  int bmp_w, int bmp_h);
4734 
4768 MG_EXPORT void GUIAPI BitBlt (HDC hsdc, int sx, int sy, int sw, int sh,
4769  HDC hddc, int dx, int dy, DWORD dwRop);
4770 
4809 MG_EXPORT void GUIAPI StretchBlt (HDC hsdc, int sx, int sy, int sw, int sh,
4810  HDC hddc, int dx, int dy, int dw, int dh, DWORD dwRop);
4811 
4831 MG_EXPORT BOOL GUIAPI ScaleBitmapEx (BITMAP* dst, const BITMAP* src,
4832  HDC ref_dc);
4833 
4834 #define ScaleBitmap(dst, src) ScaleBitmapEx(dst, src, HDC_SCREEN)
4835 
4857 MG_EXPORT gal_pixel GUIAPI GetPixelInBitmapEx (const BITMAP* bmp, int x, int y, Uint8* alpha);
4858 
4876 static inline gal_pixel GUIAPI GetPixelInBitmap (const BITMAP* bmp, int x, int y)
4877 {
4878  return GetPixelInBitmapEx (bmp, x, y, NULL);
4879 }
4880 
4905 MG_EXPORT BOOL GUIAPI SetPixelInBitmapEx (const BITMAP* bmp,
4906  int x, int y, gal_pixel pixel, const Uint8* alpha);
4907 
4928 static inline BOOL GUIAPI SetPixelInBitmap (const BITMAP* bmp,
4929  int x, int y, gal_pixel pixel)
4930 {
4931  return SetPixelInBitmapEx (bmp, x, y, pixel, NULL);
4932 }
4933 
4934 #ifdef _MGMISC_SAVESCREEN
4935 
4954 MG_EXPORT BOOL GUIAPI SaveScreenRectContent (const RECT* rcWin,
4955  const char* filename);
4956 
4974 MG_EXPORT BOOL GUIAPI SaveMainWindowContent (HWND hWnd, const char* filename);
4975 #endif
4976 
5001 MG_EXPORT HICON GUIAPI LoadIconFromFile (HDC hdc, const char* filename,
5002  int which);
5003 
5022 MG_EXPORT HICON GUIAPI LoadIconFromMem (HDC hdc, const void* area, int which);
5023 
5048 MG_EXPORT HICON GUIAPI CreateIconEx (HDC hdc, int w, int h,
5049  const BYTE* AndBits, const BYTE* XorBits, int colornum,
5050  const RGB* pal);
5055 #define CreateIcon(hdc, w, h, AndBits, XorBits, colornum) \
5056  CreateIconEx(hdc, w, h, AndBits, XorBits, colornum, NULL)
5057 
5058 
5070 MG_EXPORT BOOL GUIAPI DestroyIcon (HICON hicon);
5071 
5085 MG_EXPORT BOOL GUIAPI GetIconSize (HICON hicon, int* w, int* h);
5086 
5104 MG_EXPORT void GUIAPI DrawIcon (HDC hdc,
5105  int x, int y, int w, int h, HICON hicon);
5106 
5128 static inline void SetRect (RECT* prc, int left, int top, int right, int bottom)
5129 {
5130  (prc)->left = left; (prc)->top = top;
5131  (prc)->right = right; (prc)->bottom = bottom;
5132 }
5133 
5147 static inline void SetRectEmpty (RECT* prc)
5148 {
5149  (prc)->left = (prc)->top = (prc)->right = (prc)->bottom = 0;
5150 }
5151 
5164 static inline void CopyRect (RECT* pdrc, const RECT* psrc)
5165 {
5166  (pdrc)->left = (psrc)->left; (pdrc)->top = (psrc)->top;
5167  (pdrc)->right = (psrc)->right; (pdrc)->bottom = (psrc)->bottom;
5168 }
5169 
5185 static inline void OffsetRect (RECT* prc, int x, int y)
5186 {
5187  (prc)->left += x; (prc)->top += y; (prc)->right += x; (prc)->bottom += y;
5188 }
5189 
5206 static inline void InflateRect (RECT* prc, int cx, int cy)
5207 {
5208  (prc)->left -= cx; (prc)->top -= cy;
5209  (prc)->right += cx; (prc)->bottom += cy;
5210 }
5211 
5225 static inline void InflateRectToPt (RECT* prc, int x, int y)
5226 {
5227  if ((x) < (prc)->left) (prc)->left = (x);
5228  if ((y) < (prc)->top) (prc)->top = (y);
5229  if ((x) > (prc)->right) (prc)->right = (x);
5230  if ((y) > (prc)->bottom) (prc)->bottom = (y);
5231 }
5232 
5248 static inline BOOL PtInRect(const RECT* prc, int x, int y)
5249 {
5250  if (x >= prc->left && x < prc->right && y >= prc->top && y < prc->bottom)
5251  return TRUE;
5252  return FALSE;
5253 }
5254 
5267 MG_EXPORT BOOL GUIAPI IsRectEmpty (const RECT* prc);
5268 
5281 MG_EXPORT BOOL GUIAPI EqualRect (const RECT* prc1, const RECT* prc2);
5282 
5292 MG_EXPORT void GUIAPI NormalizeRect (RECT* pRect);
5293 
5314 MG_EXPORT BOOL GUIAPI IntersectRect (RECT* pdrc,
5315  const RECT* psrc1, const RECT* psrc2);
5316 
5332 MG_EXPORT BOOL GUIAPI IsCovered (const RECT* prc1, const RECT* prc2);
5333 
5347 MG_EXPORT BOOL GUIAPI DoesIntersect (const RECT* psrc1, const RECT* psrc2);
5348 
5366 MG_EXPORT BOOL GUIAPI UnionRect (RECT* pdrc,
5367  const RECT* psrc1, const RECT* psrc2);
5368 
5384 MG_EXPORT void GUIAPI GetBoundRect (PRECT pdrc,
5385  const RECT* psrc1, const RECT* psrc2);
5386 
5403 MG_EXPORT int GUIAPI SubtractRect (RECT* rc, const RECT* psrc1, const RECT* psrc2);
5404 
5409 #define RECTWP(prc) ((prc)->right - (prc)->left)
5410 
5414 #define RECTHP(prc) ((prc)->bottom - (prc)->top)
5415 
5419 #define RECTW(rc) ((rc).right - (rc).left)
5420 
5424 #define RECTH(rc) ((rc).bottom - (rc).top)
5425 
5439 /* Font-related structures */
5440 #define LEN_FONT_NAME 31
5441 #define LEN_DEVFONT_NAME 79
5442 #define LEN_UNIDEVFONT_NAME 127
5443 
5444 #define FONT_WEIGHT_NIL '\0'
5445 #define FONT_WEIGHT_ALL '*'
5446 #define FONT_WEIGHT_BLACK 'c'
5447 #define FONT_WEIGHT_BOLD 'b'
5448 #define FONT_WEIGHT_BOOK 'k'
5449 #define FONT_WEIGHT_DEMIBOLD 'd'
5450 #define FONT_WEIGHT_LIGHT 'l'
5451 #define FONT_WEIGHT_MEDIUM 'm'
5452 #define FONT_WEIGHT_REGULAR 'r'
5453 #define FONT_WEIGHT_SUBPIXEL 's'
5454 
5455 #define FS_WEIGHT_MASK 0x000000FF
5456 #define FS_WEIGHT_BLACK 0x00000001
5457 #define FS_WEIGHT_BOLD 0x00000002
5458 #define FS_WEIGHT_BOOK 0x00000004
5459 #define FS_WEIGHT_DEMIBOLD 0x00000006 /* BOOK | BOLD */
5460 #define FS_WEIGHT_LIGHT 0x00000010
5461 #define FS_WEIGHT_MEDIUM 0x00000020
5462 #define FS_WEIGHT_SUBPIXEL 0x00000040
5463 #define FS_WEIGHT_REGULAR 0x00000000
5464 
5465 #define FONT_SLANT_NIL '\0'
5466 #define FONT_SLANT_ALL '*'
5467 #define FONT_SLANT_ITALIC 'i'
5468 #define FONT_SLANT_OBLIQUE 'o'
5469 #define FONT_SLANT_ROMAN 'r'
5470 
5471 #define FS_SLANT_MASK 0x00000F00
5472 #define FS_SLANT_ITALIC 0x00000100
5473 #define FS_SLANT_OBLIQUE 0x00000200
5474 #define FS_SLANT_ROMAN 0x00000000
5475 
5476 #define FONT_FLIP_NIL '\0'
5477 #define FONT_FLIP_HORZ 'H'
5478 #define FONT_FLIP_VERT 'V'
5479 #define FONT_FLIP_HORZVERT 'T'
5480 
5481 #define FS_FLIP_MASK 0x0000F000
5482 #define FS_FLIP_HORZ 0x00001000
5483 #define FS_FLIP_VERT 0x00002000
5484 #define FS_FLIP_HORZVERT 0x00003000 /* HORZ | VERT */
5485 
5486 #define FONT_OTHER_NIL '\0'
5487 #define FONT_OTHER_AUTOSCALE 'S'
5488 #define FONT_OTHER_TTFNOCACHE 'N'
5489 #define FONT_OTHER_TTFKERN 'K'
5490 #define FONT_OTHER_TTFNOCACHEKERN 'R'
5491 #define FONT_OTHER_LCDPORTRAIT 'P'
5492 #define FONT_OTHER_LCDPORTRAITKERN 'Q'
5493 
5494 #define FS_OTHER_MASK 0x00FF0000
5495 #define FS_OTHER_AUTOSCALE 0x00010000
5496 #define FS_OTHER_TTFNOCACHE 0x00020000
5497 #define FS_OTHER_TTFKERN 0x00040000
5498 #define FS_OTHER_TTFNOCACHEKERN 0x00060000 /* KERN | NOCACHE */
5499 #define FS_OTHER_LCDPORTRAIT 0x00100000
5500 #define FS_OTHER_LCDPORTRAITKERN 0x00140000
5501 
5502 /*
5503  * Backward compatiblilty definitions.
5504  * All FONT_SETWIDTH_* and FONT_SPACING_* types will
5505  * be treated as FONT_FLIP_NIL and FONT_OTHER_NIL respectively.
5506  */
5507 #define FONT_SETWIDTH_NIL '\0'
5508 #define FONT_SETWIDTH_ALL '*'
5509 #define FONT_SETWIDTH_BOLD 'b'
5510 #define FONT_SETWIDTH_CONDENSED 'c'
5511 #define FONT_SETWIDTH_SEMICONDENSED 's'
5512 #define FONT_SETWIDTH_NORMAL 'n'
5513 #define FONT_SETWIDTH_TTFNOCACHE 'w'
5514 
5515 /*
5516 #define FS_SETWIDTH_MASK 0x0000F000
5517 #define FS_SETWIDTH_BOLD 0x00001000
5518 #define FS_SETWIDTH_CONDENSED 0x00002000
5519 #define FS_SETWIDTH_SEMICONDENSED 0x00004000
5520 #define FS_SETWIDTH_TTFNOCACHE 0x00008000
5521 #define FS_SETWIDTH_NORMAL 0x00000000
5522 */
5523 
5524 #define FONT_SPACING_NIL '\0'
5525 #define FONT_SPACING_ALL '*'
5526 #define FONT_SPACING_MONOSPACING 'm'
5527 #define FONT_SPACING_PROPORTIONAL 'p'
5528 #define FONT_SPACING_CHARCELL 'c'
5529 
5530 /*
5531 #define FS_SPACING_MASK 0x000F0000
5532 #define FS_SPACING_MONOSPACING 0x00010000
5533 #define FS_SPACING_PROPORTIONAL 0x00020000
5534 #define FS_SPACING_CHARCELL 0x00000000
5535 */
5536 
5537 #define FONT_UNDERLINE_NIL '\0'
5538 #define FONT_UNDERLINE_ALL '*'
5539 #define FONT_UNDERLINE_LINE 'u'
5540 #define FONT_UNDERLINE_NONE 'n'
5541 
5542 #define FS_UNDERLINE_MASK 0x00F00000
5543 #define FS_UNDERLINE_LINE 0x00100000
5544 #define FS_UNDERLINE_NONE 0x00000000
5545 
5546 #define FONT_STRUCKOUT_NIL '\0'
5547 #define FONT_STRUCKOUT_ALL '*'
5548 #define FONT_STRUCKOUT_LINE 's'
5549 #define FONT_STRUCKOUT_NONE 'n'
5550 
5551 #define FS_STRUCKOUT_MASK 0x0F000000
5552 #define FS_STRUCKOUT_LINE 0x01000000
5553 #define FS_STRUCKOUT_NONE 0x00000000
5554 
5555 #define FONT_TYPE_NAME_LEN 3
5556 #define FONT_TYPE_NAME_BITMAP_RAW "rbf"
5557 #define FONT_TYPE_NAME_BITMAP_VAR "vbf"
5558 #define FONT_TYPE_NAME_BITMAP_QPF "qpf"
5559 #define FONT_TYPE_NAME_BITMAP_UPF "upf"
5560 #define FONT_TYPE_NAME_BITMAP_BMP "bmp"
5561 #define FONT_TYPE_NAME_SCALE_TTF "ttf"
5562 #define FONT_TYPE_NAME_SCALE_T1F "t1f"
5563 #define FONT_TYPE_NAME_ALL "*"
5564 
5565 #define FONT_ETC_SECTION_NAME_VBF "varbitmapfonts"
5566 #define FONT_ETC_SECTION_NAME_RBF "rawbitmapfonts"
5567 #define FONT_ETC_SECTION_NAME_UPF "upf"
5568 #define FONT_ETC_SECTION_NAME_QPF "qpf"
5569 #define FONT_ETC_SECTION_NAME_TTF "truetypefonts"
5570 
5571 #define FONT_TYPE_BITMAP_RAW 0x0001 /* "rbf" */
5572 #define FONT_TYPE_BITMAP_VAR 0x0002 /* "vbf" */
5573 #define FONT_TYPE_BITMAP_QPF 0x0003 /* "qpf" */
5574 #define FONT_TYPE_BITMAP_BMP 0x0004 /* "bmp" */
5575 #define FONT_TYPE_BITMAP_UPF 0x0005 /* "upf" */
5576 #define FONT_TYPE_SCALE_TTF 0x0010 /* "ttf" */
5577 #define FONT_TYPE_SCALE_T1F 0x0011 /* "t1f" */
5578 #define FONT_TYPE_ALL 0x00FF /* "all" */
5579 
5580 #define FONT_CHARSET_US_ASCII "US-ASCII"
5581 
5582 #define FONT_CHARSET_ISO8859_1 "ISO8859-1"
5583 #define FONT_CHARSET_ISO8859_2 "ISO8859-2"
5584 #define FONT_CHARSET_ISO8859_3 "ISO8859-3"
5585 #define FONT_CHARSET_ISO8859_4 "ISO8859-4"
5586 #define FONT_CHARSET_ISO8859_5 "ISO8859-5"
5587 #define FONT_CHARSET_ISO8859_6 "ISO8859-6"
5588 #define FONT_CHARSET_ISO8859_7 "ISO8859-7"
5589 #define FONT_CHARSET_ISO8859_8 "ISO8859-8"
5590 #define FONT_CHARSET_ISO8859_9 "ISO8859-9"
5591 #define FONT_CHARSET_ISO8859_10 "ISO8859-10"
5592 #define FONT_CHARSET_ISO8859_11 "ISO8859-11"
5593 #define FONT_CHARSET_ISO8859_12 "ISO8859-12"
5594 #define FONT_CHARSET_ISO8859_13 "ISO8859-13"
5595 #define FONT_CHARSET_ISO8859_14 "ISO8859-14"
5596 #define FONT_CHARSET_ISO8859_15 "ISO8859-15"
5597 #define FONT_CHARSET_ISO8859_16 "ISO8859-16"
5598 
5599 #define FONT_CHARSET_EUC_CN "EUC-CN"
5600 
5605 #define FONT_CHARSET_GB1988_0 "GB1988-0"
5606 
5611 #define FONT_CHARSET_GB2312_0 "GB2312-0"
5612 #define FONT_CHARSET_GBK "GBK"
5613 
5618 #define FONT_CHARSET_GB18030_0 "GB18030-0"
5619 #define FONT_CHARSET_BIG5 "BIG5"
5620 
5625 #define FONT_CHARSET_EUCTW "EUC-TW"
5626 #define FONT_CHARSET_EUCKR "EUC-KR"
5627 
5632 #define FONT_CHARSET_KSC5636_0 "KSC5636-0"
5633 
5638 #define FONT_CHARSET_KSC5601_0 "KSC5601-0"
5639 #define FONT_CHARSET_EUCJP "EUC-JP"
5640 
5645 #define FONT_CHARSET_JISX0201_0 "JISX0201-0"
5646 
5651 #define FONT_CHARSET_JISX0208_0 "JISX0208-0"
5652 #define FONT_CHARSET_SHIFTJIS "SHIFT-JIS"
5653 
5658 #define FONT_CHARSET_JISX0201_1 "JISX0201-1"
5659 
5664 #define FONT_CHARSET_JISX0208_1 "JISX0208-1"
5665 
5670 #define FONT_CHARSET_ISO_10646_1 "ISO-10646-1"
5671 
5676 #define FONT_CHARSET_UTF8 "UTF-8"
5677 
5682 #define FONT_CHARSET_UTF16LE "UTF-16LE"
5683 
5688 #define FONT_CHARSET_UTF16BE "UTF-16BE"
5689 
5690 #define FONT_MAX_SIZE 256
5691 #define FONT_MIN_SIZE 4
5692 
5693 struct _DEVFONT;
5694 typedef struct _DEVFONT DEVFONT;
5695 
5697 typedef struct _LOGFONT {
5699  char type [LEN_FONT_NAME + 1];
5701  char family [LEN_FONT_NAME + 1];
5703  char charset [LEN_FONT_NAME + 1];
5707  int size;
5711  int ascent;
5713  int descent;
5715  unsigned short sbc_scale;
5717  unsigned short mbc_scale;
5722 } LOGFONT;
5732 typedef const LOGFONT* CPLOGFONT;
5733 
5734 struct _WORDINFO;
5739 typedef struct _WORDINFO WORDINFO;
5740 
5741 #define MAX_LEN_MCHAR 6
5742 
5743 typedef unsigned short UChar16;
5744 typedef int UChar32;
5745 
5746 #define MCHAR_TYPE_UNKNOWN 0xFFFF
5747 #define MCHAR_TYPE_NUL 0x0000
5748 #define MCHAR_TYPE_CTRL1 0x0100
5749 #define MCHAR_TYPE_BEL 0x0200
5750 #define MCHAR_TYPE_BS 0x0300
5751 #define MCHAR_TYPE_HT 0x0400
5752 #define MCHAR_TYPE_LF 0x0500
5753 #define MCHAR_TYPE_VT 0x0600
5754 #define MCHAR_TYPE_FF 0x0700
5755 #define MCHAR_TYPE_CR 0x0800
5756 #define MCHAR_TYPE_CTRL2 0x0900
5757 #define MCHAR_TYPE_SPACE 0x0A00
5758 #define MCHAR_TYPE_ZEROWIDTH 0x0B00
5759 #define MCHAR_TYPE_GENERIC 0x0C00
5760 #define MCHAR_TYPE_NOSPACING_MARK 0x0001
5761 #define MCHAR_TYPE_LIGATURE (MCHAR_TYPE_NOSPACING_MARK |0x0D00)
5762 #define MCHAR_TYPE_VOWEL (MCHAR_TYPE_NOSPACING_MARK |0x0E00)
5763 #define MCHAR_TYPE_VOWEL_ABOVE (MCHAR_TYPE_VOWEL |0x0002)
5764 #define MCHAR_TYPE_VOWEL_BELLOW (MCHAR_TYPE_VOWEL |0x0004)
5765 
5766 #define MCHAR_TYPE_ASCII 0x0080
5767 #define MCHAR_TYPE_LATIN1 0x0081
5768 #define MCHAR_TYPE_LATIN2 0x0082
5769 #define MCHAR_TYPE_LATIN3 0x0083
5770 #define MCHAR_TYPE_LATIN4 0x0084
5771 #define MCHAR_TYPE_LATIN5 0x0085
5772 #define MCHAR_TYPE_LATIN6 0x0086
5773 #define MCHAR_TYPE_LATIN7 0x0087
5774 #define MCHAR_TYPE_LATIN8 0x0088
5775 #define MCHAR_TYPE_LATIN9 0x0089
5776 #define MCHAR_TYPE_LATIN10 0x008A
5777 #define MCHAR_TYPE_CYRILLIC 0x008B
5778 #define MCHAR_TYPE_ARABIC 0x008C
5779 #define MCHAR_TYPE_GREEK 0x008D
5780 #define MCHAR_TYPE_HEBREW 0x008E
5781 #define MCHAR_TYPE_THAI 0x008F
5782 
5783 #define MCHAR_TYPE_DIGIT 0x0091
5784 #define MCHAR_TYPE_SYMBOL_PUNCT 0x0092
5785 #define MCHAR_TYPE_SYMBOL_MATH 0x0093
5786 #define MCHAR_TYPE_SYMBOL_OTHER 0x0094
5787 #define MCHAR_TYPE_FW_DIGIT 0x0095
5788 #define MCHAR_TYPE_FW_SYM_PUNCT 0x0096
5789 #define MCHAR_TYPE_FW_SYM_MATH 0x0097
5790 #define MCHAR_TYPE_FW_SYM_OTHER 0x0098
5791 
5792 #define MCHAR_TYPE_HANGUL 0x00A1
5793 #define MCHAR_TYPE_KATAKANA 0x00A2
5794 #define MCHAR_TYPE_CJK 0x00A3
5795 
5796 struct _FONTOPS;
5797 struct _CHARSETOPS;
5798 
5799 typedef struct _FONTOPS FONTOPS;
5800 typedef struct _CHARSETOPS CHARSETOPS;
5801 
5802 /* charops fontops devont structure is here. */
5804 struct _DEVFONT
5805 {
5807  char name [LEN_UNIDEVFONT_NAME + 1];
5808 
5811 
5813  FONTOPS* font_ops;
5814 
5816  CHARSETOPS* charset_ops;
5817 
5819  struct _DEVFONT* next;
5820 
5822  void* data;
5823 
5826 
5829 };
5830 
5831 #define SBC_DEVFONT_INFO(logfont) (logfont.sbc_devfont)
5832 #define MBC_DEVFONT_INFO(logfont) (logfont.mbc_devfont)
5833 
5834 #define SBC_DEVFONT_INFO_P(logfont) (logfont->sbc_devfont)
5835 #define MBC_DEVFONT_INFO_P(logfont) (logfont->mbc_devfont)
5836 
5841 #define INV_LOGFONT 0
5842 
5844 typedef struct _FONTMETRICS
5845 {
5849  int ascent;
5851  int descent;
5852 
5857 } FONTMETRICS;
5858 
5873 MG_EXPORT void GUIAPI GetFontMetrics (LOGFONT* log_font,
5874  FONTMETRICS* font_metrics);
5875 
5877 typedef struct _GLYPHBITMAP
5878 {
5880  int bbox_x, bbox_y, bbox_w, bbox_h;
5882  int advance_x, advance_y;
5883 
5885  size_t bmp_size;
5889  const unsigned char* bits;
5890 } GLYPHBITMAP;
5891 
5918 MG_EXPORT void GUIAPI GetGlyphBitmap (LOGFONT* log_font,
5919  const char* mchar, int mchar_len,
5920  GLYPHBITMAP* glyph_bitmap);
5921 
5922 #ifndef _MGRM_THREADS
5923 
5942 MG_EXPORT BOOL GUIAPI InitVectorialFonts (void);
5943 
5944 
5957 MG_EXPORT void GUIAPI TermVectorialFonts (void);
5958 
5959 #endif
5960 
6065 MG_EXPORT PLOGFONT GUIAPI CreateLogFont (const char* type, const char* family,
6066  const char* charset, char weight, char slant, char flip,
6067  char other, char underline, char struckout,
6068  int size, int rotation);
6069 
6083 MG_EXPORT PLOGFONT GUIAPI CreateLogFontByName (const char* font_name);
6084 
6096 MG_EXPORT PLOGFONT GUIAPI CreateLogFontIndirect (LOGFONT* logfont);
6097 
6108 MG_EXPORT void GUIAPI DestroyLogFont (PLOGFONT log_font);
6109 
6123 MG_EXPORT void GUIAPI GetLogFontInfo (HDC hdc, LOGFONT* log_font);
6124 
6137 MG_EXPORT PLOGFONT GUIAPI GetCurFont (HDC hdc);
6138 
6157 MG_EXPORT PLOGFONT GUIAPI SelectFont (HDC hdc, PLOGFONT log_font);
6158 
6169 MG_EXPORT const DEVFONT* GUIAPI GetNextDevFont (const DEVFONT* dev_font);
6170 
6171 
6172 #ifdef _MGFONT_FT2
6173 
6178 typedef enum
6179 {
6189  MG_SMOOTH_MAX /*do not remove*/
6190 } mg_FT_LcdFilter;
6191 
6207 MG_EXPORT BOOL GUIAPI ft2SetLcdFilter (LOGFONT* logfont, mg_FT_LcdFilter filter);
6208 
6209 #endif
6210 
6211 #if defined(_MGFONT_QPF) || defined(_MGFONT_FT2) || defined(_MGFONT_TTF) || defined(_MGFONT_UPF)
6212 
6228 MG_EXPORT DEVFONT* GUIAPI LoadDevFontFromFile (const char *devfont_name,
6229  const char *file_name);
6230 
6240 MG_EXPORT void GUIAPI DestroyDynamicDevFont (DEVFONT **devfont);
6241 #endif
6242 
6261 #define SYSLOGFONT_DEFAULT 0
6262 
6267 #define SYSLOGFONT_WCHAR_DEF 1
6268 
6273 #define SYSLOGFONT_FIXED 2
6274 
6279 #define SYSLOGFONT_CAPTION 3
6280 
6285 #define SYSLOGFONT_MENU 4
6286 
6291 #define SYSLOGFONT_CONTROL 5
6292 
6293 #define NR_SYSLOGFONTS 6
6294 
6295 
6296 extern MG_EXPORT PLOGFONT g_SysLogFont [];
6297 
6321 static inline PLOGFONT GUIAPI GetSystemFont (int font_id)
6322 {
6323  if (font_id >= 0 && font_id < NR_SYSLOGFONTS)
6324  return g_SysLogFont [font_id];
6325  else
6326  return (PLOGFONT)NULL;
6327 }
6328 
6343 MG_EXPORT int GUIAPI GetSysFontMaxWidth (int font_id);
6344 
6359 MG_EXPORT int GUIAPI GetSysFontAveWidth (int font_id);
6360 
6374 MG_EXPORT int GUIAPI GetSysFontHeight (int font_id);
6375 
6390 MG_EXPORT const char* GUIAPI GetSysCharset (BOOL wchar);
6391 
6406 MG_EXPORT int GUIAPI GetSysCharHeight (void);
6407 
6421 MG_EXPORT int GUIAPI GetSysCharWidth (void);
6422 
6434 MG_EXPORT int GUIAPI GetSysCCharWidth (void);
6435 
6450 {
6452  int len;
6454  unsigned char delimiter;
6457 };
6458 
6478 MG_EXPORT int GUIAPI GetTextMCharInfo (PLOGFONT log_font,
6479  const char* mstr, int len, int* pos_chars);
6480 
6504 MG_EXPORT int GUIAPI GetTextWordInfo (PLOGFONT log_font, const char* mstr,
6505  int len, int* pos_words, WORDINFO* info_words);
6506 
6522 MG_EXPORT int GUIAPI GetFirstMCharLen (PLOGFONT log_font,
6523  const char* mstr, int len);
6524 
6545 MG_EXPORT int GUIAPI GetFirstWord (PLOGFONT log_font,
6546  const char* mstr, int len, WORDINFO* word_info);
6547 
6548 #ifdef _MGCHARSET_UNICODE
6549 
6550 #include <stddef.h>
6551 #include <stdlib.h>
6552 
6573 MG_EXPORT int GUIAPI MB2WCEx (PLOGFONT log_font, void* dest, BOOL wc32,
6574  const unsigned char* mstr, int n);
6575 
6582 #define MB2WC(log_font, dest, mstr, n) \
6583  MB2WCEx (log_font, dest, sizeof(wchar_t) == 4, mstr, n)
6584 
6602 MG_EXPORT int GUIAPI WC2MBEx (PLOGFONT log_font, unsigned char *s, UChar32 wc);
6603 
6610 #define WC2MB(log_font, s, wc) \
6611  WC2MBEx (log_font, s, (UChar32)wc)
6612 
6645 MG_EXPORT int GUIAPI MBS2WCSEx (PLOGFONT log_font, void* dest, BOOL wc32,
6646  const unsigned char* mstr, int mstr_len, int n,
6647  int* conved_mstr_len);
6648 
6655 #define MBS2WCS(log_font, dest, mstr, mstr_len, n) \
6656  MBS2WCSEx(log_font, dest, sizeof (wchar_t) == 4, mstr, \
6657  mstr_len, n, NULL)
6658 
6691 MG_EXPORT int GUIAPI WCS2MBSEx (PLOGFONT log_font, unsigned char* dest,
6692  const void *wcs, int wcs_len, BOOL wc32, int n,
6693  int* conved_wcs_len);
6694 
6701 #define WCS2MBS(log_font, dest, wcs, wcs_len, n) \
6702  WCS2MBSEx (log_font, dest, wcs, wcs_len, sizeof (wchar_t) == 4, \
6703  n, NULL)
6704 
6705 #endif /* _MGCHARSET_UNICODE */
6706 
6738 MG_EXPORT int GUIAPI GetTextExtentPoint (HDC hdc, const char* text, int len,
6739  int max_extent, int* fit_chars, int* pos_chars,
6740  int* dx_chars, SIZE* size);
6741 
6750 MG_EXPORT int GUIAPI GetTabbedTextExtentPoint (HDC hdc,
6751  const char* text, int len, int max_extent,
6752  int* fit_chars, int* pos_chars, int* dx_chars, SIZE* size);
6753 
6773 MG_EXPORT int GUIAPI GetFontHeight (HDC hdc);
6774 
6788 MG_EXPORT int GUIAPI GetMaxFontWidth (HDC hdc);
6789 
6790 
6809 MG_EXPORT int GUIAPI GetTextExtent (HDC hdc,
6810  const char* spText, int len, SIZE* pSize);
6811 
6832 MG_EXPORT int GUIAPI GetTabbedTextExtent (HDC hdc,
6833  const char* spText, int len, SIZE* pSize);
6834 
6841 #define GetTextCharacterExtra(hdc) GetDCAttr (hdc, DC_ATTR_CHAR_EXTRA)
6842 
6849 #define GetTextAboveLineExtra(hdc) GetDCAttr (hdc, DC_ATTR_ALINE_EXTRA)
6850 
6857 #define GetTextBellowLineExtra(hdc) GetDCAttr (hdc, DC_ATTR_BLINE_EXTRA)
6858 
6866 #define SetTextCharacterExtra(hdc, extra) \
6867  SetDCAttr (hdc, DC_ATTR_CHAR_EXTRA, (DWORD) extra)
6868 
6875 #define SetTextAboveLineExtra(hdc, extra) \
6876  SetDCAttr (hdc, DC_ATTR_ALINE_EXTRA, (DWORD) extra)
6877 
6884 #define SetTextBellowLineExtra(hdc, extra) \
6885  SetDCAttr (hdc, DC_ATTR_BLINE_EXTRA, (DWORD) extra)
6886 
6887 #define TA_LEFT 0x0000
6888 #define TA_RIGHT 0x0001
6889 #define TA_CENTER 0x0002
6890 #define TA_X_MASK 0x000F
6891 
6892 #define TA_TOP 0x0000
6893 #define TA_BASELINE 0x0010
6894 #define TA_BOTTOM 0x0020
6895 #define TA_Y_MASK 0x00F0
6896 
6897 #define TA_NOUPDATECP 0x0000
6898 #define TA_UPDATECP 0x0100
6899 #define TA_CP_MASK 0x0F00
6900 
6952 #define GetTextAlign(hdc) GetDCAttr (hdc, DC_ATTR_TEXT_ALIGN)
6953 
7010 #define SetTextAlign(hdc, ta_flags) \
7011  SetDCAttr (hdc, DC_ATTR_TEXT_ALIGN, (DWORD)ta_flags)
7012 
7031 MG_EXPORT int GUIAPI TextOutLen (HDC hdc, int x, int y,
7032  const char* spText, int len);
7033 
7034 
7056 MG_EXPORT int GUIAPI TextOutOmitted (HDC hdc, int x, int y,
7057  const char *mtext, int len, int max_extent);
7058 
7080 MG_EXPORT int GUIAPI TabbedTextOutLen (HDC hdc, int x, int y,
7081  const char* spText, int len);
7082 
7109 MG_EXPORT int GUIAPI TabbedTextOutEx (HDC hdc, int x, int y,
7110  const char* spText, int nCount,
7111  int nTabPositions, int *pTabPositions, int nTabOrigin);
7112 
7122 MG_EXPORT void GUIAPI GetLastTextOutPos (HDC hdc, POINT* pt);
7123 
7132 #define TextOut(hdc, x, y, text) TextOutLen (hdc, x, y, text, -1)
7133 
7142 #define TabbedTextOut(hdc, x, y, text) TabbedTextOutLen (hdc, x, y, text, -1)
7143 
7144 #define DT_TOP 0x00000000
7145 #define DT_LEFT 0x00000000
7146 #define DT_CENTER 0x00000001
7147 #define DT_RIGHT 0x00000002
7148 #define DT_VCENTER 0x00000004
7149 #define DT_BOTTOM 0x00000008
7150 #define DT_WORDBREAK 0x00000010
7151 #define DT_SINGLELINE 0x00000020
7152 #define DT_EXPANDTABS 0x00000040
7153 #define DT_TABSTOP 0x00000080
7154 #define DT_NOCLIP 0x00000100
7155 #define DT_EXTERNALLPADING 0x00000200
7156 #define DT_CALCRECT 0x00000400
7157 #define DT_NOPREFIX 0x00000800
7158 #define DT_INTERNAL 0x00001000
7159 #define DT_CHARBREAK 0x00002000
7160 
7164 typedef struct _DTFIRSTLINE
7165 {
7169  int startx;
7171  int starty;
7173  int width;
7175  int height;
7176 } DTFIRSTLINE;
7177 
7253 MG_EXPORT int GUIAPI DrawTextEx2 (HDC hdc, const char* pText, int nCount,
7254  RECT* pRect, int nIndent, UINT nFormat, DTFIRSTLINE *firstline);
7255 
7265 #define DrawText(hdc, text, n, rc, format) \
7266  DrawTextEx2 (hdc, text, n, rc, 0, format, NULL)
7267 
7276 #define DrawTextEx(hdc, text, n, rc, indent, format) \
7277  DrawTextEx2 (hdc, text, n, rc, indent, format, NULL)
7278 
7289 #define MYBMP_TYPE_NORMAL 0x00000000
7290 #define MYBMP_TYPE_RLE4 0x00000001
7291 #define MYBMP_TYPE_RLE8 0x00000002
7292 #define MYBMP_TYPE_RGB 0x00000003
7293 #define MYBMP_TYPE_BGR 0x00000004
7294 #define MYBMP_TYPE_RGBA 0x00000005
7295 #define MYBMP_TYPE_MASK 0x0000000F
7296 
7297 #define MYBMP_FLOW_DOWN 0x00000010
7298 #define MYBMP_FLOW_UP 0x00000020
7299 #define MYBMP_FLOW_MASK 0x000000F0
7300 
7301 #define MYBMP_TRANSPARENT 0x00000100
7302 #define MYBMP_ALPHACHANNEL 0x00000200
7303 #define MYBMP_ALPHA 0x00000400
7304 
7305 #define MYBMP_RGBSIZE_3 0x00001000
7306 #define MYBMP_RGBSIZE_4 0x00002000
7307 
7308 #define MYBMP_LOAD_GRAYSCALE 0x00010000
7309 #define MYBMP_LOAD_ALLOCATE_ONE 0x00020000
7310 #define MYBMP_LOAD_NONE 0x00000000
7311 
7314 {
7346  int frames;
7351  Uint8 reserved [2];
7354 
7363 
7366 };
7367 
7368 #define BMP_TYPE_NORMAL 0x00
7369 #define BMP_TYPE_RLE 0x01
7370 #define BMP_TYPE_ALPHA 0x02
7371 #define BMP_TYPE_ALPHACHANNEL 0x04
7372 #define BMP_TYPE_COLORKEY 0x10
7373 
7374 #define BMP_TYPE_ALPHA_MASK 0x20
7375 #define BMP_TYPE_PRIV_PIXEL 0x00
7376 
7377 #ifdef _FOR_MONOBITMAP
7378  #define BMP_TYPE_MONOKEY 0x40
7379 #endif
7380 
7382 struct _BITMAP
7383 {
7422 #ifdef _FOR_MONOBITMAP
7423  Uint32 bmColorRep;
7424 #endif
7425 
7434 
7436  /*void* bmAlphaPixelFormat;*/
7439 
7442 };
7443 
7455 #include <stdio.h>
7456 #include "endianrw.h"
7457 
7462 typedef void (* CB_ONE_SCANLINE) (void* context, MYBITMAP* my_bmp, int y);
7463 
7498 MG_EXPORT BOOL GUIAPI RegisterBitmapFileType (const char *ext,
7499  void* (*init) (MG_RWops* fp, MYBITMAP *my_bmp, RGB *pal),
7500  int (*load) (MG_RWops* fp, void* init_info, MYBITMAP *my_bmp,
7501  CB_ONE_SCANLINE cb, void* context),
7502  void (*cleanup) (void* init_info),
7503  int (*save) (MG_RWops* fp, MYBITMAP *my_bmp, RGB *pal),
7504  BOOL (*check) (MG_RWops* fp));
7505 
7521 MG_EXPORT const char* GUIAPI CheckBitmapType (MG_RWops* fp);
7522 
7564 #define MLS_BLENDMODE_NONE 0x00
7565 #define MLS_BLENDMODE_COLORKEY 0x01
7566 #define MLS_BLENDMODE_ALPHA 0x02
7567 
7568 #define MLS_INFOMASK_OFFSET 0x01
7569 #define MLS_INFOMASK_BLEND 0x02
7570 #define MLS_INFOMASK_ZORDER 0x04
7571 #define MLS_INFOMASK_ALL 0x07
7572 #define MLS_INFOMASK_ENABLE 0x08
7573 
7574 MG_EXPORT BOOL GUIAPI mlsSetSlaveScreenInfo (HDC dc_mls, DWORD mask, int offset_x, int offset_y,
7575  DWORD blend_flags, gal_pixel color_key, int alpha, int z_order);
7576 
7577 MG_EXPORT BOOL GUIAPI mlsGetSlaveScreenInfo (HDC dc_mls, DWORD mask, int* offset_x, int* offset_y,
7578  DWORD blend_flags, gal_pixel* color_key, int* alpha, int* z_order);
7592 MG_EXPORT BOOL GUIAPI mlsEnableSlaveScreen (HDC dc_mls, BOOL enable);
7593 
7594 
7595 #define ERR_BMP_OK 0
7596 #define ERR_BMP_IMAGE_TYPE -1
7597 #define ERR_BMP_UNKNOWN_TYPE -2
7598 #define ERR_BMP_CANT_READ -3
7599 #define ERR_BMP_CANT_SAVE -4
7600 #define ERR_BMP_NOT_SUPPORTED -5
7601 #define ERR_BMP_MEM -6
7602 #define ERR_BMP_LOAD -7
7603 #define ERR_BMP_FILEIO -8
7604 #define ERR_BMP_OTHER -9
7605 #define ERR_BMP_ERROR_SOURCE -10
7606 
7633 MG_EXPORT int GUIAPI LoadBitmapEx (HDC hdc, PBITMAP pBitmap,
7634  MG_RWops* area, const char* ext);
7635 
7643 MG_EXPORT int GUIAPI LoadBitmapFromFile (HDC hdc, PBITMAP pBitmap,
7644  const char* spFileName);
7645 
7652 #define LoadBitmap LoadBitmapFromFile
7653 
7661 MG_EXPORT int GUIAPI LoadBitmapFromMem (HDC hdc, PBITMAP pBitmap,
7662  const void* mem, int size, const char* ext);
7663 
7675 MG_EXPORT void GUIAPI UnloadBitmap (PBITMAP pBitmap);
7676 
7695 MG_EXPORT int GUIAPI SetBitmapKeyColor (HDC hdc, PBITMAP bmp, Uint8 r, Uint8 g, Uint8 b);
7696 
7711 MG_EXPORT void GUIAPI ReplaceBitmapColor (HDC hdc, PBITMAP pBitmap,
7712  gal_pixel iOColor, gal_pixel iNColor);
7713 
7723 MG_EXPORT void GUIAPI HFlipBitmap (BITMAP* bmp, unsigned char* inter_buff);
7724 
7734 MG_EXPORT void GUIAPI VFlipBitmap (BITMAP* bmp, unsigned char* inter_buff);
7735 
7754 MG_EXPORT void* GUIAPI InitMyBitmapSL (MG_RWops* area,
7755  const char* ext, MYBITMAP* my_bmp, RGB* pal);
7756 
7775 MG_EXPORT int GUIAPI LoadMyBitmapSL (MG_RWops* area, void* load_info,
7776  MYBITMAP* my_bmp, CB_ONE_SCANLINE cb, void* context);
7777 
7792 MG_EXPORT int GUIAPI CleanupMyBitmapSL (MYBITMAP* my_bmp, void* load_info);
7793 
7809 MG_EXPORT int GUIAPI LoadMyBitmapEx (PMYBITMAP my_bmp, RGB* pal,
7810  MG_RWops* area, const char* ext);
7811 
7819 MG_EXPORT int GUIAPI LoadMyBitmapFromFile (PMYBITMAP my_bmp, RGB* pal,
7820  const char* file_name);
7821 
7828 #define LoadMyBitmap LoadMyBitmapFromFile
7829 
7845 MG_EXPORT int GUIAPI LoadMyBitmapFromMem (PMYBITMAP my_bmp, RGB* pal,
7846  const void* mem, int size, const char* ext);
7847 
7859 MG_EXPORT void GUIAPI UnloadMyBitmap (PMYBITMAP my_bmp);
7860 
7861 #ifdef _MGMISC_SAVEBITMAP
7862 
7879 MG_EXPORT int GUIAPI SaveMyBitmapToFile (PMYBITMAP my_bmp, RGB* pal,
7880  const char* spFileName);
7881 
7897 MG_EXPORT int GUIAPI SaveBitmapToFile (HDC hdc, PBITMAP pBitmap,
7898  const char* spFileName);
7899 #define SaveBitmap SaveBitmapToFile
7900 #endif
7901 
7923 MG_EXPORT BOOL GUIAPI InitBitmap (HDC hdc, Uint32 w, Uint32 h, Uint32 pitch,
7924  BYTE* bits, PBITMAP bmp);
7925 
7935 MG_EXPORT HDC GUIAPI InitSlaveScreen (const char* name, const char* mode);
7936 
7944 MG_EXPORT void GUIAPI TerminateSlaveScreen (HDC hdc);
7960 MG_EXPORT BOOL GUIAPI InitBitmapPixelFormat (HDC hdc, PBITMAP bmp);
7961 
7971 MG_EXPORT void GUIAPI DeleteBitmapAlphaPixel (PBITMAP bmp);
7972 
7973 /* Everything in the pixel format structure is read-only */
7974 typedef struct GAL_PixelFormat {
7975  GAL_Palette *palette;
7976 
7977  Uint8 BitsPerPixel;
7978  Uint8 BytesPerPixel;
7979  /* The flag indicating dithered palette */
7980  Uint8 DitheredPalette;
7981  /* The flag indicating the Most Significant Bits (MSB)
7982  * is left when depth is less than 8. */
7983  Uint8 MSBLeft;
7984 
7985  Uint8 Rloss;
7986  Uint8 Gloss;
7987  Uint8 Bloss;
7988  Uint8 Aloss;
7989  Uint8 Rshift;
7990  Uint8 Gshift;
7991  Uint8 Bshift;
7992  Uint8 Ashift;
7993  Uint32 Rmask;
7994  Uint32 Gmask;
7995  Uint32 Bmask;
7996  Uint32 Amask;
7997 
7998  /* RGB color key information */
7999  gal_pixel colorkey;
8000  /* Alpha value information (per-surface alpha) */
8001  gal_uint8 alpha;
8002 } GAL_PixelFormat;
8003 
8004 #define _FILL_MYBITMAP
8005 
8006 #ifndef MYBITMAP_CONTXT
8007 typedef struct _MYBITMAP_CONTXT{
8008  Uint32 colorKey;
8009  Uint32 pitch;
8010  GAL_PixelFormat* AlphaPixelFormat;
8011  MYBITMAP* mybmp;
8012 }MYBITMAP_CONTXT;
8013 #endif
8014 
8015 typedef BYTE* (* CB_DRAW_PIXEL) (HDC hdc, MYBITMAP_CONTXT* mybmp, Uint32 pixel, BYTE* dest);
8016 
8032 MG_EXPORT int GUIAPI ExpandMyBitmap (HDC hdc, PBITMAP bmp,
8033  const MYBITMAP* my_bmp, const RGB* pal, int frame);
8034 
8057 MG_EXPORT void GUIAPI ExpandMonoBitmap (HDC hdc, BYTE* bits, Uint32 pitch,
8058  const BYTE* my_bits, Uint32 my_pitch,
8059  Uint32 w, Uint32 h, DWORD flags, Uint32 bg, Uint32 fg);
8060 
8061 MG_EXPORT void GUIAPI Expand16CBitmapEx (HDC hdc, BYTE* bits, Uint32 pitch,
8062  const BYTE* my_bits, Uint32 my_pitch,
8063  Uint32 w, Uint32 h, DWORD flags,
8064  const RGB* pal, BYTE use_pal_alpha, BYTE alpha);
8065 
8087 static inline void GUIAPI Expand16CBitmap (HDC hdc, BYTE* bits, Uint32 pitch,
8088  const BYTE* my_bits, Uint32 my_pitch,
8089  Uint32 w, Uint32 h, DWORD flags, const RGB* pal)
8090 {
8091  Expand16CBitmapEx (hdc, bits, pitch, my_bits, my_pitch,
8092  w, h, flags, pal, FALSE, 0xFF);
8093 }
8094 
8095 MG_EXPORT void GUIAPI Expand256CBitmapEx (HDC hdc, BYTE* bits, Uint32 pitch,
8096  const BYTE* my_bits, Uint32 my_pitch,
8097  Uint32 w, Uint32 h, DWORD flags,
8098  const RGB* pal, BYTE use_pal_alpha, BYTE alpha,
8099  CB_DRAW_PIXEL cb_draw, MYBITMAP_CONTXT* mybmp);
8124 static inline void GUIAPI Expand256CBitmap (HDC hdc, BYTE* bits, Uint32 pitch,
8125  const BYTE* my_bits, Uint32 my_pitch,
8126  Uint32 w, Uint32 h, DWORD flags, const RGB* pal,
8127  CB_DRAW_PIXEL cb_draw, MYBITMAP_CONTXT* mybmp)
8128 {
8129  Expand256CBitmapEx (hdc, bits, pitch, my_bits, my_pitch,
8130  w, h, flags, pal, FALSE, 0xFF, cb_draw, mybmp);
8131 }
8132 
8156 MG_EXPORT void GUIAPI CompileRGBABitmap (HDC hdc, BYTE* bits, Uint32 pitch,
8157  const BYTE* my_bits, Uint32 my_pitch,
8158  Uint32 w, Uint32 h, DWORD flags, void* pixel_format,
8159  CB_DRAW_PIXEL cb_draw, MYBITMAP_CONTXT* mybmp);
8160 
8173 MG_EXPORT void GUIAPI CompileRGBABitmapEx (HDC hdc, BYTE* bits, Uint32 pitch,
8174  const BYTE* my_bits, Uint32 my_pitch,
8175  Uint32 w, Uint32 h, DWORD flags, void* pixel_format,
8176  CB_DRAW_PIXEL cb_draw, MYBITMAP_CONTXT* mybmp,
8177  BYTE* alpha_mask);
8178 
8179 #ifdef _FILL_MYBITMAP
8180 MG_EXPORT int GUIAPI FillBoxWithMyBitmap (HDC hdc, int x, int y, MYBITMAP* mybmp, RGB* pal);
8181 
8182 MG_EXPORT void GUIAPI ExpandPartMonoBitmap (HDC hdc, BYTE* bits, Uint32 pitch,
8183  const BYTE* my_bits, Uint32 my_pitch,
8184  Uint32 w, Uint32 h, DWORD flags, Uint32 bg, Uint32 fg,
8185  int stepx, CB_DRAW_PIXEL cb_draw, MYBITMAP_CONTXT* mybmp);
8186 
8187 MG_EXPORT void GUIAPI ExpandPart16CBitmapEx (HDC hdc, BYTE* bits, Uint32 pitch,
8188  const BYTE* my_bits, Uint32 my_pitch,
8189  Uint32 w, Uint32 h, DWORD flags,
8190  const RGB* pal, BYTE use_pal_alpha, BYTE alpha,
8191  int stepx, CB_DRAW_PIXEL cb_draw, MYBITMAP_CONTXT* mybmp);
8192 
8193 static inline void GUIAPI ExpandPart16CBitmap (HDC hdc, BYTE* bits, Uint32 pitch,
8194  const BYTE* my_bits, Uint32 my_pitch,
8195  Uint32 w, Uint32 h, DWORD flags, const RGB* pal,
8196  int stepx, CB_DRAW_PIXEL cb_draw, MYBITMAP_CONTXT* mybmp)
8197 {
8198  ExpandPart16CBitmapEx (hdc, bits, pitch, my_bits, my_pitch,
8199  w, h, flags, pal, FALSE, 0xFF, stepx, cb_draw, mybmp);
8200 }
8201 
8202 #endif
8203 
8204 #define CompileRGBBitmap CompileRGBABitmap
8205 
8234 MG_EXPORT int GUIAPI PaintImageEx (HDC hdc, int x, int y,
8235  MG_RWops* area, const char* ext);
8236 
8251 MG_EXPORT int GUIAPI PaintImageFromFile (HDC hdc, int x, int y,
8252  const char* spFileName);
8253 
8270 MG_EXPORT int GUIAPI PaintImageFromMem (HDC hdc, int x, int y,
8271  const void* mem, int size, const char* ext);
8272 
8304 MG_EXPORT int GUIAPI StretchPaintImageEx (HDC hdc, int x, int y, int w, int h,
8305  MG_RWops* area, const char* ext);
8306 
8323 MG_EXPORT int GUIAPI StretchPaintImageFromFile (HDC hdc, int x, int y,
8324  int w, int h, const char* spFileName);
8325 
8344 MG_EXPORT int GUIAPI StretchPaintImageFromMem (HDC hdc, int x, int y,
8345  int w, int h, const void* mem, int size, const char* ext);
8346 
8347 #ifdef _MGHAVE_FIXED_MATH
8348 
8364 MG_EXPORT void GUIAPI RotateBitmap (HDC hdc, const BITMAP *bmp,
8365  int lx, int ty, int angle);
8366 
8377 MG_EXPORT void GUIAPI RotateBitmapVFlip (HDC hdc, const BITMAP *bmp,
8378  int lx, int ty, int angle);
8379 
8388 MG_EXPORT void GUIAPI RotateBitmapHFlip (HDC hdc, const BITMAP *bmp,
8389  int lx, int ty, int angle);
8390 
8399 MG_EXPORT void GUIAPI RotateScaledBitmap (HDC hdc, const BITMAP *bmp,
8400  int lx, int ty, int angle, int w, int h);
8401 
8413 MG_EXPORT void GUIAPI RotateScaledBitmapVFlip (HDC hdc, const BITMAP *bmp,
8414  int lx, int ty, int angle, int w, int h);
8415 
8427 MG_EXPORT void GUIAPI RotateScaledBitmapHFlip (HDC hdc, const BITMAP *bmp,
8428  int lx, int ty, int angle, int w, int h);
8429 
8441 MG_EXPORT void GUIAPI PivotBitmap(HDC hdc, const BITMAP *bmp,
8442  int lx, int ty, int cx, int cy, int angle);
8443 
8470 MG_EXPORT void GUIAPI PivotScaledBitmapFlip (HDC hdc, const BITMAP *bmp,
8471  fixed x, fixed y, fixed cx, fixed cy, int angle, fixed scale_x,
8472  fixed scale_y, BOOL h_flip, BOOL v_flip);
8473 
8474 #endif /*_MGHAVE_FIXED_MATH*/
8475 
8482 #ifdef _MGFONT_BMPF
8483 
8501 MG_EXPORT DEVFONT* GUIAPI CreateBMPDevFont (const char *bmpfont_name,
8502  const BITMAP* glyph_bmp, const char* start_mchar, int nr_glyphs,
8503  int glyph_width);
8504 
8520 MG_EXPORT BOOL GUIAPI AddGlyphsToBMPFont (DEVFONT* dev_font, BITMAP* glyph_bmp,
8521  const char* start_mchar, int nr_glyphs, int glyph_width);
8522 
8533 MG_EXPORT void GUIAPI DestroyBMPFont (DEVFONT* dev_font);
8534 
8535 #ifdef _DEBUG
8536 /*
8537  * Dump avl tree info
8538  */
8539 void dump_tree (DEVFONT *dev_font);
8540 
8541 /*
8542  * look up a node in bitmap font avl tree.
8543  */
8544 int avl_look_up (DEVFONT *dev_font, char *start_mchar, int n);
8545 
8546 /*
8547  * destroy bitmap font avl tree.
8548  */
8549 void destroy_avl_tree (DEVFONT *dev_font);
8550 
8551 #endif /* end of _DEBUG */
8552 
8553 #endif /* end of _MGFONT_BMPF */
8554 
8568 typedef int Glyph32;
8572 #define INV_GLYPH_VALUE -1
8573 
8580 #define IS_MBC_GLYPH(glyph) ((glyph) & 0x80000000)
8581 
8588 #define SET_MBC_GLYPH(glyph) ((glyph) | 0x80000000)
8589 
8596 #define REAL_GLYPH(glyph) ((glyph) & 0x7FFFFFFF)
8597 
8598 
8607 #define SELECT_DEVFONT(plogfont, glyph) \
8608  ((glyph) & 0x80000000 ? \
8609  (plogfont)->mbc_devfont : \
8610  (plogfont)->sbc_devfont)
8611 
8616 typedef enum {
8617  GLYPH_ISOLATED,
8618  GLYPH_FINAL,
8619  GLYPH_INITIAL,
8620  GLYPH_MEDIAL
8621 }SHAPETYPE;
8622 
8627 typedef struct _GLYPHMAPINFO{
8628  int byte_index;
8629  int char_len;
8630  BOOL is_rtol;
8631 }GLYPHMAPINFO;
8632 
8633 
8634 #define GLYPH_INFO_TYPE 1
8635 #define GLYPH_INFO_METRICS 2
8636 #define GLYPH_INFO_BMP 4
8637 
8638 /*the type of glyph bitmap*/
8639 #define GLYPHBMP_TYPE_MONO 0
8640 #define GLYPHBMP_TYPE_GREY 1
8641 #define GLYPHBMP_TYPE_SUBPIXEL 2
8642 #define GLYPHBMP_TYPE_PRERENDER 3
8643 
8644 /*the glyph info structure. */
8649 typedef struct _GLYPHINFO
8650 {
8652  char mask;
8654  char glyph_type;
8656  char bmp_type;
8657 
8658  Uint8 padding;
8659 
8661  int height;
8663  int descent;
8664 
8666  int advance_x, advance_y;
8668  int bbox_x, bbox_y;
8669  int bbox_w, bbox_h;
8670 
8672  size_t bmp_size;
8673  /* The pitch of the glyph bitmap. */
8674  int bmp_pitch;
8676  const unsigned char* bits;
8677 
8679  BITMAP prbitmap;
8680 } GLYPHINFO;
8681 
8695 MG_EXPORT Glyph32 GUIAPI GetGlyphValue (LOGFONT* logfont, const char* mchar,
8696  int mchar_len, const char* pre_mchar, int pre_len);
8697 
8710 MG_EXPORT Glyph32 GUIAPI GetGlyphShape (LOGFONT* logfont, const char* mchar,
8711  int mchar_len, SHAPETYPE shape_type);
8712 
8731 MG_EXPORT int GUIAPI DrawGlyph (HDC hdc, int x, int y, Glyph32 glyph_value,
8732  int* adv_x, int* adv_y);
8733 
8734 /*
8735  * \fn int GUIAPI DrawGlyphString (HDC hdc, int x, int y, \
8736  * Glyph32* glyph_string, int len, int* adv_x, int* adv_y);
8737  * \brief Draw a glyph string.
8738  *
8739  * This function draws a glyph string to the specific postion of a DC.
8740  *
8741  * \param hdc The device context.
8742  * \param x The output start x position.
8743  * \param y The output start y position.
8744  * \param glyph_string The pointer to the glyph string.
8745  * \param len The length of the glyph string.
8746  * \param adv_x The pointer used to return the advance in x-coordinate of
8747  * the glyph string, can be NULL.
8748  * \param adv_y The pointer used to return the advance in y-coordinate of
8749  * the glyph string, can be NULL.
8750  *
8751  * \return The advance on baseline.
8752  */
8753 MG_EXPORT int GUIAPI DrawGlyphString (HDC hdc, int x, int y, Glyph32* glyph_string,
8754  int len, int* adv_x, int* adv_y);
8755 
8773 MG_EXPORT int GUIAPI GetGlyphInfo (LOGFONT* logfont, Glyph32 glyph_value,
8774  GLYPHINFO* glyph_info);
8775 
8790 MG_EXPORT int GUIAPI GetGlyphsExtent(HDC hdc, Glyph32* glyphs, int nr_glyphs,
8791  SIZE* size);
8792 
8808 MG_EXPORT int GUIAPI GetGlyphsExtentPoint(HDC hdc, Glyph32* glyphs,
8809  int nr_glyphs, int max_extent, SIZE* size);
8810 
8827 MG_EXPORT int GUIAPI BIDIGetTextLogicalGlyphs(LOGFONT* log_font,
8828  const char* text, int text_len, Glyph32** glyphs,
8829  GLYPHMAPINFO** glyphs_map);
8830 
8846 MG_EXPORT int GUIAPI BIDIGetTextVisualGlyphs (LOGFONT* log_font,
8847  const char* text, int text_len, Glyph32** glyphs,
8848  GLYPHMAPINFO** glyphs_map);
8849 
8866 MG_EXPORT Glyph32* GUIAPI BIDILogGlyphs2VisGlyphs (LOGFONT* log_font,
8867  Glyph32* glyphs, int nr_glyphs, GLYPHMAPINFO* glyphs_map);
8868 
8885 MG_EXPORT void GUIAPI GetTextRangesLog2Vis (LOGFONT* log_font, char* text,
8886  int text_len, int start_index, int end_index, int** ranges,
8887  int* nr_ranges);
8888 
8903 MG_EXPORT void GUIAPI BIDIGetLogicalEmbeddLevels (LOGFONT* log_font,
8904  Glyph32* glyphs, int nr_glyphs, Uint8** embedding_level_list);
8905 
8919 MG_EXPORT void GUIAPI BIDIGetVisualEmbeddLevels (LOGFONT* log_font,
8920  Glyph32* glyphs, int nr_glyphs, Uint8** embedding_level_list);
8921 
8923 /*
8924  * \var typedef struct _COMP_CTXT COMP_CTXT
8925  * \brief The context information of user defined color composition operators.
8926  *
8927  * \sa SetUserCompositionOps
8928  *
8929  */
8930 typedef struct _COMP_CTXT {
8932  gal_uint8* cur_dst;
8933 
8935  void* user_comp_ctxt;
8936 
8938  gal_pixel skip_pixel;
8939 
8941  gal_pixel cur_pixel;
8942 
8944  int step;
8945 } COMP_CTXT;
8946 
8947 /*
8948  * \var typedef struct _SPAN_CTXT SPAN_CTXT
8949  * \brief span context
8950  */
8951 typedef struct _SPAN_CTXT {
8952  GAL_PixelFormat* dst_format; /* The pixel format of the destination pixels */
8953  GAL_PixelFormat* src_format; /* The pixel format of the source pixels */
8954  void * user_context; /* The user context passed to SetColorCompositeFunc */
8955 } SPAN_CTXT;
8956 
8957 /*
8958  * \var typedef struct _COMPOSITE_CTXT COMPOSITE_CTXT
8959  * \brief composite context
8960  */
8961 typedef struct _COMPOSITE_CTXT {
8962  HDC dst_dc;
8963  int comp_mode;
8964  const int *far_bkmode;
8965  const int *far_step;
8966  const gal_pixel *far_skip_pixel;
8967 } COMPOSITE_CTXT;
8968 
8969 /*
8970  * \var typedef struct _RASTER_CTXT RASTER_CTXT
8971  * \brief raster context
8972  */
8973 typedef struct _RASTER_CTXT {
8974  HDC dst_dc;
8975 } RASTER_CTXT;
8976 
8977 /*
8978  * \var typedef void (*CB_COMP_SETPIXEL) (COMP_CTXT* comp_ctxt)
8979  * \brief The prototype of the user defined color composition setpixel.
8980  *
8981  * This operator sets a pixel on the \a cur_dst defined in \a comp_ctxt with
8982  * the cur_pixel defined in \a comp_ctxt.
8983  *
8984  * \sa SetUserCompositionOps, COMP_CTXT
8985  */
8986 typedef void (*CB_COMP_SETPIXEL) (COMP_CTXT* comp_ctxt);
8987 
8988 /*
8989  * \var typedef void (*CB_COMP_SETHLINE) (COMP_CTXT* comp_ctxt, int w)
8990  * \brief The prototype of the user defined color composition sethline.
8991  *
8992  * This operator sets a horizital line on the \a cur_dst defined in \a comp_ctxt
8993  * with the \a cur_pixel defined in \a comp_ctxt, totally \a w pixels.
8994  *
8995  * \sa SetUserCompositionOps, COMP_CTXT
8996  */
8997 typedef void (*CB_COMP_SETHLINE) (COMP_CTXT* comp_ctxt, int w);
8998 
8999 /*
9000  * \var typedef void (*CB_COMP_PUTHLINE) (COMP_CTXT* comp_ctxt, gal_uint8* src, int w)
9001  * \brief The prototype of the user defined color composition puthline.
9002  *
9003  * This operator puts the pixels in \a src to a horizital line on the \a cur_dst
9004  * defined in \a comp_ctxt, totally \a w pixels.
9005  *
9006  * \sa SetUserCompositionOps, COMP_CTXT
9007  */
9008 typedef void (*CB_COMP_PUTHLINE) (COMP_CTXT* comp_ctxt, gal_uint8* src, int bkmode, int w);
9009 
9031 MG_EXPORT int GUIAPI SetUserCompositionOps (HDC hdc, CB_COMP_SETPIXEL comp_setpixel,
9032  CB_COMP_SETHLINE comp_sethline, CB_COMP_PUTHLINE comp_puthline, void* user_comp_ctxt);
9033 
9036 #ifdef _MGGAL_HI3560
9037 
9038 //#include <hi_api.h>
9039 
9040 /* API speicific to Hi3560 GAL engines */
9041 MG_EXPORT int hi3560GetVideoFD (void);
9042 MG_EXPORT void* hi3560GetFBAddress (void);
9043 MG_EXPORT int hi3560SetScreenAttr (Uint8 siAttr, void* pValue);
9044 
9045 #endif /* _MGGAL_HI3560 */
9046 
9047 MG_EXPORT int GUIAPI GetTextMCharInfo (PLOGFONT log_font, const char* mstr, int len,
9048  int* pos_chars);
9049 MG_EXPORT int GUIAPI GetTextWordInfo (PLOGFONT log_font, const char* mstr, int len,
9050  int* pos_words, WORDINFO* info_words);
9051 MG_EXPORT int GUIAPI GetFirstMCharLen (PLOGFONT log_font, const char* mstr, int len);
9052 MG_EXPORT int GUIAPI GetLastMCharLen (PLOGFONT log_font, const char* mstr, int len);
9053 MG_EXPORT int GUIAPI GetFirstWord (PLOGFONT log_font, const char* mstr, int len,
9054  WORDINFO* word_info);
9055 MG_EXPORT int GUIAPI MB2WCEx (PLOGFONT log_font, void* dest, BOOL wc32,
9056  const unsigned char* mchar, int n);
9057 MG_EXPORT int GUIAPI WC2MBEx (PLOGFONT log_font, unsigned char *s, UChar32 wc);
9058 MG_EXPORT int GUIAPI MBS2WCSEx (PLOGFONT log_font, void* dest, BOOL wc32,
9059  const unsigned char* mstr, int mstr_len, int n,
9060  int* conved_mstr_len);
9061 MG_EXPORT int GUIAPI WCS2MBSEx (PLOGFONT log_font, unsigned char* dest,
9062  const void *wcs, int wcs_len, BOOL wc32, int n,
9063  int* conved_wcs_len);
9064 
9065 #ifdef __cplusplus
9066 }
9067 #endif /* __cplusplus */
9068 
9069 #endif /* _MGUI_GDI_H */
9070 
9071 
MG_EXPORT void GUIAPI PivotScaledBitmapFlip(HDC hdc, const BITMAP *bmp, fixed x, fixed y, fixed cx, fixed cy, int angle, fixed scale_x, fixed scale_y, BOOL h_flip, BOOL v_flip)
Rotates, stretches or shrinks, flips a bitmap object.
static BOOL PtInRect(const RECT *prc, int x, int y)
Determines whether a point lies within an rectangle.
Definition: gdi.h:5248
MG_EXPORT BOOL GUIAPI AddGlyphsToBMPFont(DEVFONT *dev_font, BITMAP *glyph_bmp, const char *start_mchar, int nr_glyphs, int glyph_width)
Add a new segment in device font.
MG_EXPORT int GUIAPI GetSysFontHeight(int font_id)
Gets the height of a single-byte character of a system font.
static gal_pixel DWORD2Pixel(HDC hdc, DWORD dword)
An inline function to convert DWORD color to gal_pixel.
Definition: gdi.h:2886
MG_EXPORT int GUIAPI PaintImageFromFile(HDC hdc, int x, int y, const char *spFileName)
Paints an image from file on device directly.
MG_EXPORT BOOL GUIAPI RealizePalette(HDC hdc)
This function maps palette entries from the current logical palette to the system palette...
MG_EXPORT int GUIAPI StretchPaintImageEx(HDC hdc, int x, int y, int w, int h, MG_RWops *area, const char *ext)
Paints an image from data source on device directly.
MG_EXPORT BOOL GUIAPI RestoreDC(HDC hdc, int saved_dc)
Restores a device context (DC) to the specified state.
MG_EXPORT BOOL GUIAPI DestroyIcon(HICON hicon)
Destroys an icon object.
MG_EXPORT void GUIAPI LPtoSP(HDC hdc, POINT *pPt)
Converts logical coordinates into screen coordinates.
struct _ARC ARC
PTCapStyle
Definition: gdi.h:3595
int height
Definition: gdi.h:3772
unsigned char delimiter
Definition: gdi.h:6454
Uint32 bmHeight
Definition: gdi.h:7429
MG_EXPORT void GUIAPI GetDCLCS(HDC hdc, int which, POINT *pt)
Retrieves mapping parameters of a device context.
MG_EXPORT void GUIAPI UnloadMyBitmap(PMYBITMAP my_bmp)
Unloads a bitmap.
int x
Definition: gdi.h:3905
int size
Definition: gdi.h:5707
Definition: common.h:874
int starty
Definition: gdi.h:7171
MG_EXPORT int GUIAPI MBS2WCSEx(PLOGFONT log_font, void *dest, BOOL wc32, const unsigned char *mstr, int mstr_len, int n, int *conved_mstr_len)
Converts a multibyte string to a wide character string in UC16 according to the charset/encoding of t...
Definition: gdi.h:3902
int descent
Definition: gdi.h:5713
void(* CB_ONE_SCANLINE)(void *context, MYBITMAP *my_bmp, int y)
The type of scanline loaded callback.
Definition: gdi.h:7462
static void GUIAPI Expand16CBitmap(HDC hdc, BYTE *bits, Uint32 pitch, const BYTE *my_bits, Uint32 my_pitch, Uint32 w, Uint32 h, DWORD flags, const RGB *pal)
Convert a 16 color MYBITMAP pixel data to a BITMAP pixel data.
Definition: gdi.h:8087
MG_EXPORT BOOL GUIAPI IsCovered(const RECT *prc1, const RECT *prc2)
Determines whether one rectangle is covered by another.
int BOOL
A type definition for boolean value.
Definition: common.h:294
MG_EXPORT HDC GUIAPI GetPrivateClientDC(HWND hwnd)
Returns the private client DC of a window.
#define GetAValue(rgba)
Gets the alpha component from a RGBA triple value rgba.
Definition: common.h:807
MG_EXPORT int GUIAPI PaintImageFromMem(HDC hdc, int x, int y, const void *mem, int size, const char *ext)
Paints an image from memory on device directly.
#define GetBValue(rgba)
Gets the blue component from a RGBA triple value rgba.
Definition: common.h:798
MG_EXPORT const char *GUIAPI CheckBitmapType(MG_RWops *fp)
Checks the type of the bitmap in a data source.
Uint32 bmPitch
Definition: gdi.h:7431
MG_EXPORT int GUIAPI GetGlyphsExtentPoint(HDC hdc, Glyph32 *glyphs, int nr_glyphs, int max_extent, SIZE *size)
Get the visual extent value of a glyph string.
unsigned char BYTE
A type definition for an 8-bit unsigned character (byte).
Definition: common.h:411
MG_EXPORT int GUIAPI GetRasterOperation(HDC hdc)
Gets the raster operation of a DC.
MG_EXPORT BOOL GUIAPI InitVectorialFonts(void)
Initializes vectorial font renderer.
struct _CLIPRECT * next
Definition: gdi.h:575
MG_EXPORT BOOL GUIAPI SetMemDCAlpha(HDC mem_dc, DWORD flags, Uint8 alpha)
Sets the alpha value for the entire surface of a DC, as opposed to using the alpha component of each ...
MG_EXPORT void GUIAPI LineGenerator(void *context, int x1, int y1, int x2, int y2, CB_LINE cb)
A line generator based-on Breshenham algorithm.
struct _LOGFONT LOGFONT
MG_EXPORT BOOL GUIAPI DoesIntersect(const RECT *psrc1, const RECT *psrc2)
Determines whether two rectangles intersect.
struct _DTFIRSTLINE DTFIRSTLINE
MG_EXPORT void GUIAPI Circle(HDC hdc, int sx, int sy, int r)
Draws a circle.
struct _GLYPHINFO GLYPHINFO
Data type of struct _GLYPHINFO.
MG_EXPORT void GUIAPI StretchBlt(HDC hsdc, int sx, int sy, int sw, int sh, HDC hddc, int dx, int dy, int dw, int dh, DWORD dwRop)
Copies a bitmap from a source rectangle into a destination rectangle, streches the bitmap if necessar...
MG_EXPORT BOOL GUIAPI UnionRect(RECT *pdrc, const RECT *psrc1, const RECT *psrc2)
Unions two source rectangles.
MG_EXPORT void GUIAPI MoveTo(HDC hdc, int x, int y)
Moves the current zero pen position.
int y
Definition: gdi.h:3907
MG_EXPORT void GUIAPI ClipRectIntersect(HDC hdc, const RECT *prc)
Intersects the specified rectangle with the visible region of the DC.
MG_EXPORT BOOL GUIAPI SetClipRgn(PCLIPRGN pRgn, const RECT *pRect)
Sets a region to contain only one rect.
Definition: gdi.h:3720
struct _DEVFONT * next
Definition: gdi.h:5819
MG_EXPORT BOOL GUIAPI InitCircleRegion(PCLIPRGN dst, int x, int y, int r)
Initializes a region to be an enclosed circle.
MG_EXPORT HDC GUIAPI CreateSecondaryDC(HWND hwnd)
Creates a secondary window DC of a window.
MG_EXPORT void GUIAPI DestroyBMPFont(DEVFONT *dev_font)
Destroy the bitmap device font.
MG_EXPORT BOOL GUIAPI FillBoxWithBitmap(HDC hdc, int x, int y, int w, int h, const BITMAP *bmp)
Fills a box with a BITMAP object.
MG_EXPORT HDC GUIAPI CreatePrivateClientDC(HWND hwnd)
Creates a private client DC of a window.
MG_EXPORT BOOL GUIAPI SetColorfulPalette(HDC hdc)
Sets a DC with colorfule palette.
MG_EXPORT int GUIAPI GetFirstWord(PLOGFONT log_font, const char *mstr, int len, WORDINFO *word_info)
Retrieves the length and info of the first multi-byte word in a string.
MG_EXPORT int GUIAPI MB2WCEx(PLOGFONT log_font, void *dest, BOOL wc32, const unsigned char *mstr, int n)
Converts a multibyte character to a wide character in UCS according to the charset/encoding of the lo...
static void CopyRect(RECT *pdrc, const RECT *psrc)
Copies one rectangle to another.
Definition: gdi.h:5164
MG_EXPORT BOOL GUIAPI SaveMainWindowContent(HWND hWnd, const char *filename)
Saves content of a main window to a file.
MG_EXPORT void GUIAPI RotateBitmapVFlip(HDC hdc, const BITMAP *bmp, int lx, int ty, int angle)
Flips vertically and rotates a bitmap object.
Uint32 h
Definition: gdi.h:7358
MG_EXPORT void GUIAPI SPtoLP(HDC hdc, POINT *pPt)
Converts screen coordinates into logical coordinates.
MG_EXPORT BOOL GUIAPI SetPalette(HDC hdc, int start, int len, GAL_Color *cmap)
Sets palette entries of a DC.
MG_EXPORT Uint32 GUIAPI GetDCAttr(HDC hdc, int attr)
Gets a specified attribute value of a DC.
MG_EXPORT int GUIAPI BIDIGetTextLogicalGlyphs(LOGFONT *log_font, const char *text, int text_len, Glyph32 **glyphs, GLYPHMAPINFO **glyphs_map)
Get logical glyphs string of the text.
static gal_pixel GUIAPI GetPixelInBitmap(const BITMAP *bmp, int x, int y)
Returns the pixel value in a BITMAP object.
Definition: gdi.h:4876
MG_EXPORT void GUIAPI SetBrushOrigin(HDC hdc, int x, int y)
Set the origin when using tiles or stipples with the DC.
BYTE g
Definition: common.h:929
RECT rcBound
Definition: gdi.h:610
unsigned short sbc_scale
Definition: gdi.h:5715
Uint8 bmType
Definition: gdi.h:7413
MG_EXPORT BOOL GUIAPI IsEmptyClipRgn(const CLIPRGN *pRgn)
Determines whether a region is an empty region.
MG_EXPORT BOOL GUIAPI AddClipRect(PCLIPRGN pRgn, const RECT *pRect)
Unions one rectangle to a region.
MG_EXPORT int GUIAPI GetSysCCharWidth(void)
Gets the width of a multi-byte character of the default system font.
HDC GUIAPI CreatePrivateSubDC(HDC hdc, int off_x, int off_y, int width, int height)
Creates a private SubDC of a window.
DEVFONT * mbc_devfont
Definition: gdi.h:5721
Uint32 bmColorKey
Definition: gdi.h:7421
DWORD flags
Definition: gdi.h:7344
MG_EXPORT void GUIAPI LPtoDP(HDC hdc, POINT *pPt)
Converts logical coordinates into device coordinates.
CLIPRGN * PCLIPRGN
Data type of the pointer to a CLIPRGN.
Definition: gdi.h:632
void * heap
Definition: gdi.h:412
MG_EXPORT void GUIAPI FillArcEx(HDC hdc, int x, int y, int width, int height, int ang1, int ang2)
Fills an arc with the current brush in a DC.
MG_EXPORT HWND GUIAPI WindowFromDC(HDC hdc)
Get the window handle from DC.
MG_EXPORT int GUIAPI StretchPaintImageFromMem(HDC hdc, int x, int y, int w, int h, const void *mem, int size, const char *ext)
Paints an image from memory on device directly.
int(* ON_UPDATE_SECONDARYDC)(HWND hwnd, HDC secondary_dc, HDC real_dc, const RECT *secondary_rc, const RECT *real_rc, const RECT *main_update_rc)
The callback type of on updating secondary DC.
Definition: gdi.h:1892
MG_EXPORT void GUIAPI CompileRGBABitmapEx(HDC hdc, BYTE *bits, Uint32 pitch, const BYTE *my_bits, Uint32 my_pitch, Uint32 w, Uint32 h, DWORD flags, void *pixel_format, CB_DRAW_PIXEL cb_draw, MYBITMAP_CONTXT *mybmp, BYTE *alpha_mask)
Compile a MYBITMAP pixel data to a BITMAP pixel data.
struct _GLYPHBITMAP GLYPHBITMAP
void * data
Definition: gdi.h:5822
MG_EXPORT BOOL GUIAPI ConvertMemDC(HDC mem_dc, HDC ref_dc, DWORD flags)
Converts a memory DC to have a same format as a reference DC.
MG_EXPORT void GUIAPI DeleteBitmapAlphaPixel(PBITMAP bmp)
Deletes the bitmap alpha pixel format information of a BITMAP object.
MG_EXPORT int GUIAPI GetPaletteEntries(HPALETTE hpal, int start, int len, GAL_Color *cmap)
Gets palette entries of a logical palette.
MG_EXPORT HPALETTE GUIAPI CreatePalette(GAL_Palette *pal)
Creates a logical palette.
MG_EXPORT int GUIAPI SetPaletteEntries(HPALETTE hpal, int start, int len, GAL_Color *cmap)
Sets palette entries of a logical palette.
MG_EXPORT BOOL GUIAPI RectInRegion(PCLIPRGN region, const RECT *rect)
Determines whether a rectangle is intersected with a region.
struct _CLIPRGN CLIPRGN
MG_EXPORT HDC GUIAPI GetSecondaryDC(HWND hwnd)
Retrives and returns the secondary DC of a specific window.
Uint8 bmBitsPerPixel
Definition: gdi.h:7415
MG_EXPORT void * BlockDataAlloc(PBLOCKHEAP heap)
Allocates a data block from private heap.
MG_EXPORT int GUIAPI GetTextWordInfo(PLOGFONT log_font, const char *mstr, int len, int *pos_words, WORDINFO *info_words)
Retrieves information of multi-byte words in a string.
DEVFONT * sbc_devfont
Definition: gdi.h:5719
struct _BLOCKHEAP BLOCKHEAP
Definition: common.h:843
int frames
Definition: gdi.h:7346
int len
Definition: gdi.h:6452
MG_EXPORT int GUIAPI LoadMyBitmapEx(PMYBITMAP my_bmp, RGB *pal, MG_RWops *area, const char *ext)
Loads a MYBITMAP object from a data source.
MG_EXPORT gal_pixel GUIAPI SetPixelRGBA(HDC hdc, int x, int y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
Sets the pixel by a RGBA quarter at the specified position on a DC.
MG_EXPORT UINT GUIAPI GetNearestPaletteIndex(HPALETTE hpal, Uint8 red, Uint8 green, Uint8 blue)
Gets the nearest palette index in the logical palette for a spefici color.
PTJoinStyle
Definition: gdi.h:3642
MG_EXPORT int GUIAPI OffsetClipRegion(HDC hdc, int nXOffset, int nYOffset)
Moves the clipping region of a device context by the specified offsets.
int height
Definition: gdi.h:3912
MG_EXPORT int GUIAPI SubtractRect(RECT *rc, const RECT *psrc1, const RECT *psrc2)
Obtains the rectangles when substracting one rectangle from another.
MG_EXPORT BOOL GUIAPI RoundRect(HDC hdc, int x0, int y0, int x1, int y1, int cw, int ch)
Draw and fill a rectangle with rounded corners in a DC.
Uint32 gal_pixel
Data type of pixel value.
Definition: common.h:1014
MG_EXPORT int GUIAPI TextOutOmitted(HDC hdc, int x, int y, const char *mtext, int len, int max_extent)
Outputs a string of text with omitted format.
MG_EXPORT BOOL GUIAPI IsCompatibleDC(HDC hdc1, HDC hdc2)
Check whether a given DC is compliant to a specific DC.
static void SetRect(RECT *prc, int left, int top, int right, int bottom)
Sets a rectangle.
Definition: gdi.h:5128
Uint32 bmAlphaPitch
Definition: gdi.h:7441
MG_EXPORT void GUIAPI CircleArcGenerator(void *context, int sx, int sy, int r, int ang1, int ang2, CB_ARC cb)
An arc generator.
MG_EXPORT int GUIAPI SetRasterOperation(HDC hdc, int rop)
Sets the raster operation of a DC to a new value.
MG_EXPORT void InitBlockDataHeap(PBLOCKHEAP heap, size_t bd_size, size_t heap_size)
Initializes a private block data heap.
MG_EXPORT void GUIAPI ExpandMonoBitmap(HDC hdc, BYTE *bits, Uint32 pitch, const BYTE *my_bits, Uint32 my_pitch, Uint32 w, Uint32 h, DWORD flags, Uint32 bg, Uint32 fg)
Convert a mono color MYBITMAP pixel data to a BITMAP pixel data.
MG_EXPORT void GUIAPI GetBoundRect(PRECT pdrc, const RECT *psrc1, const RECT *psrc2)
Gets the bound rectangle of two source rectangles.
MG_EXPORT void GUIAPI FillBox(HDC hdc, int x, int y, int w, int h)
Fills a rectangle box.
MG_EXPORT HDC GUIAPI CreateMemDCFromBitmap(HDC hdc, const BITMAP *bmp)
Creates a memory DC from a reference DC and a BITMAP object.
MG_EXPORT void GUIAPI GetFontMetrics(LOGFONT *log_font, FONTMETRICS *font_metrics)
Gets metrics information of a logical font.
MG_EXPORT Glyph32 GUIAPI GetGlyphShape(LOGFONT *logfont, const char *mchar, int mchar_len, SHAPETYPE shape_type)
Get the glyph shape of a character.
MG_EXPORT BOOL GUIAPI IntersectClipRect(PCLIPRGN pRgn, const RECT *pRect)
Intersects a rectangle with a region.
MG_EXPORT void GUIAPI Rectangle(HDC hdc, int x0, int y0, int x1, int y1)
Draws a rectangle.
MG_EXPORT int GUIAPI SaveDC(HDC hdc)
Saves the current state of a device context.
MG_EXPORT BOOL GUIAPI LineClipper(const RECT *cliprc, int *_x0, int *_y0, int *_x1, int *_y1)
The line clipper using Cohen-Sutherland algorithm.
int angle1
Definition: gdi.h:3918
MG_EXPORT int GUIAPI StretchPaintImageFromFile(HDC hdc, int x, int y, int w, int h, const char *spFileName)
Paints an image from file on device directly.
Uint8 bmAlpha
Definition: gdi.h:7419
static DWORD Pixel2DWORD(HDC hdc, gal_pixel pixel)
An inline function to convert pixel value to DWORD color.
Definition: gdi.h:2867
MG_EXPORT int GUIAPI GetGlyphInfo(LOGFONT *logfont, Glyph32 glyph_value, GLYPHINFO *glyph_info)
Retriev the information of a glyph.
MG_EXPORT void GUIAPI SelectClipRect(HDC hdc, const RECT *prc)
Sets the visible region of a DC to be a rectangle.
DWORD32 RGBCOLOR
A type definition for a RGB color.
Definition: common.h:770
MG_EXPORT int GUIAPI GetMaxFontWidth(HDC hdc)
Retrieves the maximal character width of the current logical font in a DC.
MG_EXPORT int GUIAPI LoadBitmapEx(HDC hdc, PBITMAP pBitmap, MG_RWops *area, const char *ext)
Loads a device-dependent bitmap from a general data source.
MG_EXPORT int GUIAPI GetFontHeight(HDC hdc)
Retrieves the height of the current logical font in a DC.
MG_EXPORT const char *GUIAPI GetSysCharset(BOOL wchar)
Gets the current system charset.
void(* CB_ARC)(void *context, int x, int y)
The type of arc generator callback.
Definition: gdi.h:3103
static void GUIAPI Expand256CBitmap(HDC hdc, BYTE *bits, Uint32 pitch, const BYTE *my_bits, Uint32 my_pitch, Uint32 w, Uint32 h, DWORD flags, const RGB *pal, CB_DRAW_PIXEL cb_draw, MYBITMAP_CONTXT *mybmp)
Convert a 256 color MYBITMAP pixel data to a BITMAP pixel data.
Definition: gdi.h:8124
MG_EXPORT void GUIAPI RotateScaledBitmapHFlip(HDC hdc, const BITMAP *bmp, int lx, int ty, int angle, int w, int h)
Flip horizontaly, rotates, stretch or shrinks a bitmap object.
int ave_width
Definition: gdi.h:5856
MG_EXPORT int GUIAPI BIDIGetTextVisualGlyphs(LOGFONT *log_font, const char *text, int text_len, Glyph32 **glyphs, GLYPHMAPINFO **glyphs_map)
Get visual glyphs and glyph_map info relative with logical string byte index.
MG_EXPORT BOOL GUIAPI UnionRegion(PCLIPRGN dst, const CLIPRGN *src1, const CLIPRGN *src2)
Unions two regions.
void(* CB_ELLIPSE)(void *context, int x1, int x2, int y)
The type of ellipse generator callback.
Definition: gdi.h:3070
MG_EXPORT BOOL GUIAPI ClipRgnIntersect(PCLIPRGN pRstRgn, const CLIPRGN *pRgn1, const CLIPRGN *pRgn2)
Intersects two region.
MG_EXPORT BOOL GUIAPI GetIconSize(HICON hicon, int *w, int *h)
Gets the size of an icon object.
Uint8 depth
Definition: gdi.h:7348
MG_EXPORT int GUIAPI PaintImageEx(HDC hdc, int x, int y, MG_RWops *area, const char *ext)
Paints an image from data source on device directly.
MG_EXPORT void GUIAPI DestroyDynamicDevFont(DEVFONT **devfont)
Destroy device font loaded dynamically from font file.
MG_EXPORT BOOL GUIAPI FillBoxWithBitmapPart(HDC hdc, int x, int y, int w, int h, int bw, int bh, const BITMAP *bmp, int xo, int yo)
Fills a box with a part of a bitmap oject.
MG_EXPORT void BlockDataFree(PBLOCKHEAP heap, void *data)
Frees an allocated data block.
MG_EXPORT void GUIAPI RotateScaledBitmap(HDC hdc, const BITMAP *bmp, int lx, int ty, int angle, int w, int h)
Stretches or shrinks a bitmap object at the same as rotating it.
MG_EXPORT void GUIAPI GetLogFontInfo(HDC hdc, LOGFONT *log_font)
Gets logical font information of a DC.
MG_EXPORT void GUIAPI ReleaseSecondaryDC(HWND hwnd, HDC hdc)
Release the DC returned by GetSecondaryDC or GetSecondaryClientDC.
MG_EXPORT int GUIAPI DrawTextEx2(HDC hdc, const char *pText, int nCount, RECT *pRect, int nIndent, UINT nFormat, DTFIRSTLINE *firstline)
Draws a formatted text in a rectangle.
GHANDLE HDC
Handle to device context.
Definition: common.h:363
MG_EXPORT BOOL GUIAPI FillBitmapPartInBox(HDC hdc, int box_x, int box_y, int box_w, int box_h, const BITMAP *pbmp, int bmp_x, int bmp_y, int bmp_w, int bmp_h)
Fills a part of bitmap into a box, and the parts bitmap will be scaled if needed. ...
MG_EXPORT void GUIAPI SelectClipRegion(HDC hdc, const CLIPRGN *pRgn)
Sets the visible region of a DC to be a region.
MG_EXPORT void GUIAPI FocusRect(HDC hdc, int x0, int y0, int x1, int y1)
Draws a focus rectangle.
MG_EXPORT PLOGFONT GUIAPI CreateLogFontIndirect(LOGFONT *logfont)
Creates a logical font indirectly from a LOGFONT structure.
struct _STIPPLE STIPPLE
MG_EXPORT BOOL GUIAPI SaveScreenRectContent(const RECT *rcWin, const char *filename)
Saves content of a rectangle in the screen to a file.
MG_EXPORT int GUIAPI WCS2MBSEx(PLOGFONT log_font, unsigned char *dest, const void *wcs, int wcs_len, BOOL wc32, int n, int *conved_wcs_len)
Converts a wide character string in UC16 to a multibyte string according to the charset/encoding of t...
MG_EXPORT DEVFONT *GUIAPI CreateBMPDevFont(const char *bmpfont_name, const BITMAP *glyph_bmp, const char *start_mchar, int nr_glyphs, int glyph_width)
Create a bitmap device font.
int rotation
Definition: gdi.h:5709
MG_EXPORT void GUIAPI SetPenDashes(HDC hdc, int dash_offset, const unsigned char *dash_list, int n)
Sets the way dashed-lines are drawn.
MG_EXPORT BOOL GUIAPI GetBitmapFromDC(HDC hdc, int x, int y, int w, int h, BITMAP *bmp)
Gets image box on a DC and saves it into a BITMAP object.
struct _GLYPHMAPINFO GLYPHMAPINFO
Data type of struct _GLYPHMAPINFO.
MG_EXPORT void GUIAPI LineEx(HDC hdc, int x1, int y1, int x2, int y2)
Draws a line with the current pen in the DC hdc.
MG_EXPORT int GUIAPI LoadMyBitmapSL(MG_RWops *area, void *load_info, MYBITMAP *my_bmp, CB_ONE_SCANLINE cb, void *context)
Loads MYBITMAP scanlines from a data source one by one.
MG_EXPORT DEVFONT *GUIAPI LoadDevFontFromFile(const char *devfont_name, const char *file_name)
Load device font from font file.
MG_EXPORT HDC GUIAPI InitSlaveScreen(const char *name, const char *mode)
Initializes slave screen.
MG_EXPORT void GUIAPI DPtoLP(HDC hdc, POINT *pPt)
Converts device coordinates into logical coordinates.
MG_EXPORT PLOGFONT GUIAPI CreateLogFont(const char *type, const char *family, const char *charset, char weight, char slant, char flip, char other, char underline, char struckout, int size, int rotation)
Creates a logical font.
void(* CB_CIRCLE)(void *context, int x1, int x2, int y)
The type of circle generator callback.
Definition: gdi.h:3034
MG_EXPORT int GUIAPI WC2MBEx(PLOGFONT log_font, unsigned char *s, UChar32 wc)
Converts a wide character in UCS to a multibyte character according to the charset/encoding of the lo...
MG_EXPORT BOOL GUIAPI PolygonIsMonotoneVertical(const POINT *pts, int vertices)
Checks a polygon is monotone vertical or not.
MG_EXPORT Glyph32 GUIAPI GetGlyphValue(LOGFONT *logfont, const char *mchar, int mchar_len, const char *pre_mchar, int pre_len)
Get the glyph value of a multi-byte character.
MG_EXPORT void GUIAPI DeleteSecondaryDC(HWND hwnd)
Deletes the secondary DC of the window.
MG_EXPORT int GUIAPI TabbedTextOutLen(HDC hdc, int x, int y, const char *spText, int len)
Outputs a formatted text.
MG_EXPORT void GUIAPI EmptyClipRgn(PCLIPRGN pRgn)
Empties a clipping region.
#define TRUE
TRUE value, defined as 1 by MiniGUI.
Definition: common.h:309
DWORD style
Definition: gdi.h:5705
MG_EXPORT void GUIAPI SetBrushInfo(HDC hdc, const BITMAP *tile, const STIPPLE *stipple)
Set the tile or stipple with the DC.
MG_EXPORT BOOL GUIAPI mlsEnableSlaveScreen(HDC dc_mls, BOOL enable)
Enable or Disable a MLShadow slave screen.
DWORD style
Definition: gdi.h:5810
MG_EXPORT void GUIAPI CircleGenerator(void *context, int sx, int sy, int r, CB_CIRCLE cb)
A circle generator.
MG_EXPORT int GUIAPI GetFirstMCharLen(PLOGFONT log_font, const char *mstr, int len)
Retrieves the length of the first multi-byte character in a string.
const unsigned char * bits
Definition: gdi.h:3781
MG_EXPORT void GUIAPI GetLastTextOutPos(HDC hdc, POINT *pt)
Retrieves the last text output position.
MG_EXPORT BOOL GUIAPI ResizePalette(HPALETTE hpal, int len)
Resizes a logical palette.
static void Pixel2RGBA(HDC hdc, gal_pixel pixel, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
Gets the color in RGBA quarter from a pixel value under a DC.
Definition: gdi.h:2849
MG_EXPORT void GUIAPI DestroyClipRgn(PCLIPRGN pRgn)
Empties and destroys a clipping region.
Uint8 gal_uint8
Data type of 8-bit unsigned integer.
Definition: common.h:967
BYTE type
Definition: gdi.h:602
int descent
Definition: gdi.h:5851
GHANDLE HWND
Handle to main window or control.
Definition: common.h:358
static void SetRectEmpty(RECT *prc)
Empties a rectangle.
Definition: gdi.h:5147
MG_EXPORT gal_pixel GUIAPI SetPixelRGB(HDC hdc, int x, int y, Uint8 r, Uint8 g, Uint8 b)
Sets the pixel by a RGB triple at the specified position on a DC.
void * relationship
Definition: gdi.h:5825
MG_EXPORT void GUIAPI ReplaceBitmapColor(HDC hdc, PBITMAP pBitmap, gal_pixel iOColor, gal_pixel iNColor)
Replaces a specific pixels in a bitmap with another pixel.
MG_EXPORT BOOL GUIAPI ClipRgnCopy(PCLIPRGN pDstRgn, const CLIPRGN *pSrcRgn)
Copies one region to another.
MG_EXPORT void GUIAPI GetClipRgnBoundRect(PCLIPRGN pRgn, PRECT pRect)
Gets the bounding rectangle of a region.
MG_EXPORT const DEVFONT *GUIAPI GetNextDevFont(const DEVFONT *dev_font)
Get next devfont information.
MG_EXPORT BOOL GUIAPI SelectPalette(HDC hdc, HPALETTE hpal, BOOL reserved)
Selects a palette for a DC.
Definition: gdi.h:3767
int width
Definition: gdi.h:3910
MG_EXPORT void GUIAPI OffsetRegionEx(PCLIPRGN region, const RECT *rcClient, const RECT *rcScroll, int x, int y)
Offsets the region in the specified window&#39;s scroll area.
BrushType
Definition: gdi.h:3715
int free
Definition: gdi.h:408
MG_EXPORT int GUIAPI GetSysCharHeight(void)
Gets the height of a character of the default system font.
MG_EXPORT BOOL GUIAPI FloodFillGenerator(void *context, const RECT *src_rc, int x, int y, CB_EQUAL_PIXEL cb_equal_pixel, CB_FLOOD_FILL cb_flood_fill)
A flood filling generator.
MG_EXPORT BOOL GUIAPI InitPolygonRegion(PCLIPRGN dst, const POINT *pts, int vertices)
Initializes a region to be an enclosed polygon.
MG_EXPORT void GUIAPI RGB2Pixels(HDC hdc, const RGB *rgbs, gal_pixel *pixels, int count)
Gets the pixel values from a color array in RGB triple under a DC.
Uint32 pitch
Definition: gdi.h:7360
MG_EXPORT int GUIAPI GetTabbedTextExtent(HDC hdc, const char *spText, int len, SIZE *pSize)
Computes the output extent of a formatted text.
void(* CB_DIRECT_DRAW_RECT)(HDC hdc, Uint8 *pixels, int pitch, int bytesPerPixel, const RECT *rc, void *context)
Type of directly access pixels hook function.
Definition: gdi.h:1707
Uint8 * bmBits
Definition: gdi.h:7433
MG_EXPORT void GUIAPI GetGlyphBitmap(LOGFONT *log_font, const char *mchar, int mchar_len, GLYPHBITMAP *glyph_bitmap)
Gets the glyph bitmap information when uses a logical font to output a character. ...
MG_EXPORT gal_pixel GUIAPI GetPixelInBitmapEx(const BITMAP *bmp, int x, int y, Uint8 *alpha)
Returns the pixel value in a BITMAP object.
Definition: common.h:897
MG_EXPORT int GUIAPI GetTabbedTextExtentPoint(HDC hdc, const char *text, int len, int max_extent, int *fit_chars, int *pos_chars, int *dx_chars, SIZE *size)
Computes the extent of a string when output the formatted string in a limited space.
MG_EXPORT void GUIAPI PivotBitmap(HDC hdc, const BITMAP *bmp, int lx, int ty, int cx, int cy, int angle)
Pivot a bitmap object.
MG_EXPORT void GUIAPI ReleaseDC(HDC hdc)
Releases a DC from DC pool.
void(* CB_LINE)(void *context, int stepx, int stepy)
The type of line generator callback.
Definition: gdi.h:3003
#define MakeRGBA(r, g, b, a)
Makes a RGBA triple value from red r, green g, blue b and alpha components.
Definition: common.h:819
struct _FONTMETRICS FONTMETRICS
BOOL(* CB_EQUAL_PIXEL)(void *context, int x, int y)
Flodd filling generator&#39;s equation callback.
Definition: gdi.h:3242
MG_EXPORT BOOL GUIAPI IntersectRect(RECT *pdrc, const RECT *psrc1, const RECT *psrc2)
Calculates the intersection of two rectangles.
MG_EXPORT void GUIAPI LineTo(HDC hdc, int x, int y)
Draws a zero line to a position.
MG_EXPORT BOOL GUIAPI InitBitmapPixelFormat(HDC hdc, PBITMAP bmp)
Initializes the bitmap pixel format information of a BITMAP object.
MG_EXPORT void GUIAPI EllipseGenerator(void *context, int sx, int sy, int rx, int ry, CB_ELLIPSE cb)
An ellipse generator.
static void OffsetRect(RECT *prc, int x, int y)
Moves a rectangle by offsets.
Definition: gdi.h:5185
int ascent
Definition: gdi.h:5711
MG_EXPORT void GUIAPI PolyLineTo(HDC hdc, const POINT *pts, int vertices)
Draws a polyline.
MG_EXPORT int GUIAPI LoadBitmapFromMem(HDC hdc, PBITMAP pBitmap, const void *mem, int size, const char *ext)
Loads a device-dependent bitmap from memory.
MG_EXPORT gal_pixel SysPixelIndex[]
The pre-defined system pixel values.
RECT rc
Definition: gdi.h:571
MG_EXPORT void GUIAPI InitClipRgn(PCLIPRGN pRgn, PBLOCKHEAP pFreeList)
Initializes a clipping region.
MG_EXPORT BOOL GUIAPI SubtractRegion(CLIPRGN *rgnD, const CLIPRGN *rgnM, const CLIPRGN *rgnS)
Substrcts a region from another.
MG_EXPORT int GUIAPI LoadMyBitmapFromFile(PMYBITMAP my_bmp, RGB *pal, const char *file_name)
Loads a MYBITMAP object from a file.
MG_EXPORT void GUIAPI Ellipse(HDC hdc, int sx, int sy, int rx, int ry)
Draws a ellipse.
const LOGFONT * CPLOGFONT
Data type of pointer to a const LOGFONT.
Definition: gdi.h:5732
MG_EXPORT void GUIAPI RGBA2Pixels(HDC hdc, const RGB *rgbs, gal_pixel *pixels, int count)
Gets the pixel values from a color array in RGBA quarter under a DC.
MG_EXPORT gal_pixel GUIAPI GetPixel(HDC hdc, int x, int y)
Gets the pixel value at the specified position on a DC.
#define NULL
A value indicates null pointer.
Definition: common.h:320
MG_EXPORT void GUIAPI UnlockDC(HDC hdc)
Unlocks a locked DC.
MG_EXPORT int GUIAPI GetPalette(HDC hdc, int start, int len, GAL_Color *cmap)
Gets palette entries of a DC.
PenType
Definition: gdi.h:3524
MG_EXPORT HDC GUIAPI CreateMemDCFromMyBitmap(const MYBITMAP *my_bmp, const RGB *pal)
Creates a memory DC from a device independent MYBITMAP object.
MG_EXPORT BOOL GUIAPI InitBitmap(HDC hdc, Uint32 w, Uint32 h, Uint32 pitch, BYTE *bits, PBITMAP bmp)
Initializes a BITMAP object as a normal bitmap.
void(* CB_FLOOD_FILL)(void *context, int x1, int x2, int y)
Flodd filling generator&#39;s scan line callback.
Definition: gdi.h:3248
MG_EXPORT HDC GUIAPI GetClientDC(HWND hwnd)
Gets a client DC of a window.
MG_EXPORT int GUIAPI DrawGlyph(HDC hdc, int x, int y, Glyph32 glyph_value, int *adv_x, int *adv_y)
Draw a glyph.
MG_EXPORT BOOL GUIAPI MonotoneVerticalPolygonGenerator(void *context, const POINT *pts, int vertices, CB_POLYGON cb)
A monotone vertical polygon generator.
Uint32 w
Definition: gdi.h:7356
#define GetRValue(rgba)
Gets the red component from a RGBA triple value rgba.
Definition: common.h:780
MG_EXPORT void GUIAPI FillCircle(HDC hdc, int sx, int sy, int r)
Fills a circle.
#define GetGValue(rgba)
Gets the green component from a RGBA triple value rgba.
Definition: common.h:789
MG_EXPORT void GUIAPI RotateBitmapHFlip(HDC hdc, const BITMAP *bmp, int lx, int ty, int angle)
Flips horizontally and rotates a bitmap object.
MG_EXPORT int GUIAPI GetClipRegion(HDC hdc, CLIPRGN *cliprgn)
Gets the current clipping region of a DC.
Definition: gdi.h:591
unsigned char Uint8
A type definition for an 8-bit unsigned character.
Definition: common.h:142
int bmp_pitch
Definition: gdi.h:5887
int advance_x
Definition: gdi.h:5882
static gal_pixel RGB2Pixel(HDC hdc, Uint8 r, Uint8 g, Uint8 b)
Gets the pixel value from a color in RGB triple under a DC.
Definition: gdi.h:2754
Uint32 bmWidth
Definition: gdi.h:7427
Uint8 alpha
Definition: gdi.h:7350
MG_EXPORT BOOL GUIAPI XorRegion(CLIPRGN *dst, const CLIPRGN *src1, const CLIPRGN *src2)
Does the XOR operation between two regions.
mg_FT_LcdFilter
Definition: gdi.h:6178
GHANDLE HPALETTE
Handle to a logical palette.
Definition: common.h:368
MG_EXPORT void GUIAPI PolyLineEx(HDC hdc, const POINT *pts, int nr_pts)
Draws a polyline with the current pen in a DC.
static gal_pixel RGBA2Pixel(HDC hdc, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
Gets the pixel value from a color in RGBA quarter under a DC.
Definition: gdi.h:2710
int bbox_x
Definition: gdi.h:5880
Uint32 transparent
Definition: gdi.h:7353
size_t bmp_size
Definition: gdi.h:5885
Definition: common.h:920
MG_EXPORT void GUIAPI FillEllipse(HDC hdc, int sx, int sy, int rx, int ry)
Fills an ellipse.
MG_EXPORT void GUIAPI BitBlt(HDC hsdc, int sx, int sy, int sw, int sh, HDC hddc, int dx, int dy, DWORD dwRop)
Performs a bit-block transfer from a device context into another device context.
MG_EXPORT HDC GUIAPI CreateCompatibleDCEx(HDC hdc, int width, int height)
Creates a memory DC which is compatible with the specified reference DC.
MG_EXPORT BOOL GUIAPI PolygonGeneratorEx(void *context, const POINT *pts, int vertices, CB_POLYGON cb, RECT *rc_output)
A general polygon generator.
int angle2
Definition: gdi.h:3922
MG_EXPORT int GUIAPI GetTextExtentPoint(HDC hdc, const char *text, int len, int max_extent, int *fit_chars, int *pos_chars, int *dx_chars, SIZE *size)
Computes the extent of a string when output the string in a limited space.
MG_EXPORT unsigned int GUIAPI GetGDCapability(HDC hdc, int iItem)
Returns a capability of a DC.
MG_EXPORT void GUIAPI DestroyPalette(HPALETTE hpal)
Destroy a logical palette.
SHAPETYPE
Data type of enum.
Definition: gdi.h:8616
struct _CLIPRECT * prev
Definition: gdi.h:579
MG_EXPORT int GUIAPI GetClipBox(HDC hdc, RECT *clipbox)
Retrieves the bounding rectangle of the current clipping region of a DC.
MG_EXPORT void GUIAPI DrawIcon(HDC hdc, int x, int y, int w, int h, HICON hicon)
Draws an icon into a box.
MG_EXPORT int GUIAPI SelectClipRegionEx(HDC hdc, const CLIPRGN *pRgn, int fnMode)
Combines the specified region with the current clipping region using the specified mode...
Uint8 bmBytesPerPixel
Definition: gdi.h:7417
int width
Definition: gdi.h:3770
CHARSETOPS * charset_ops
Definition: gdi.h:5816
PCLIPRECT head
Definition: gdi.h:614
MG_EXPORT HDC GUIAPI CreateMemDCEx(int width, int height, int depth, DWORD flags, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask, void *bits, int pitch)
Creates a memory DC.
int pitch
Definition: gdi.h:3775
const MG_EXPORT RGB SysPixelColor[]
The pre-defined system RGB colors.
MG_EXPORT void GUIAPI HFlipBitmap(BITMAP *bmp, unsigned char *inter_buff)
Horizontal Flip the special Bitmap object.
MG_EXPORT void GUIAPI Pixel2RGBAs(HDC hdc, const gal_pixel *pixels, RGB *rgbs, int count)
Gets the colors in RGBA quarter from a array of pixel values under a DC.
FONTOPS * font_ops
Definition: gdi.h:5813
PBLOCKHEAP heap
Definition: gdi.h:623
MG_EXPORT PCLIPRGN GUIAPI CreateClipRgn(void)
Creates a clipping region.
MG_EXPORT void GUIAPI SetDCLCS(HDC hdc, int which, const POINT *pt)
Sets mapping parameters of a device context.
static void InflateRectToPt(RECT *prc, int x, int y)
Inflates a rectangle to contain a point.
Definition: gdi.h:5225
BYTE * bits
Definition: gdi.h:7365
MG_EXPORT void GUIAPI OffsetRegion(PCLIPRGN region, int x, int y)
Offsets the region.
MG_EXPORT void GUIAPI RotateBitmap(HDC hdc, const BITMAP *bmp, int lx, int ty, int angle)
Rotate a bitmap object.
MG_EXPORT void GUIAPI SetPixel(HDC hdc, int x, int y, gal_pixel pixel)
Sets the pixel with a new pixel value at the specified position on a DC.
MG_EXPORT void GUIAPI GetBoundsRect(HDC hdc, RECT *pRect)
Retrieves the bounding rectangle of the current visible region of a DC.
MG_EXPORT BOOL GUIAPI LockDCEx(HDC hdc, const PCLIPRGN region, void *context, CB_DIRECT_DRAW_RECT cb)
directly access the pixels in a DC.
MG_EXPORT int GUIAPI TabbedTextOutEx(HDC hdc, int x, int y, const char *spText, int nCount, int nTabPositions, int *pTabPositions, int nTabOrigin)
Writes a character string at a specified location, expanding tabs to the values specified in an anrry...
MG_EXPORT PLOGFONT GUIAPI CreateLogFontByName(const char *font_name)
Creates a logical font by a font name.
MG_EXPORT void GUIAPI DeletePrivateDC(HDC hdc)
Deletes the DC returned by CreatePrivateDC or CreatePrivateClientDC or CreatePrivateSubDC.
struct _MYBITMAP * PMYBITMAP
Data type of pointer to a struct _MYBITMAP.
Definition: gdi.h:527
MG_EXPORT int GUIAPI SetBitmapKeyColor(HDC hdc, PBITMAP bmp, Uint8 r, Uint8 g, Uint8 b)
Set the bitmap color key.
const unsigned char * bits
Definition: gdi.h:5889
long fixed
Data type of fixed point.
Definition: common.h:1025
Uint8 * bmAlphaMask
Definition: gdi.h:7438
unsigned int Uint32
A type definition for a 32-bit unsigned integer.
Definition: common.h:162
MG_EXPORT void GUIAPI ArcEx(HDC hdc, int x, int y, int width, int height, int ang1, int ang2)
Draws an arc with the current pen in a DC.
MG_EXPORT void GUIAPI ExcludeClipRect(HDC hdc, const RECT *prc)
Excludes the specified rectangle from the current visible region of a DC.
int nr_chars
Definition: gdi.h:7167
unsigned short mbc_scale
Definition: gdi.h:5717
size_t size
Definition: gdi.h:3778
MG_EXPORT HPALETTE GUIAPI GetDefaultPalette(void)
Gets the system default logical palette.
DWORD_PTR DWORD
A unsigned long type definition for pointer precision.
Definition: common.h:555
LOGFONT * PLOGFONT
Data type of pointer to a LOGFONT.
Definition: gdi.h:5727
Uint32 size
Definition: gdi.h:7362
MG_EXPORT int GUIAPI SaveMyBitmapToFile(PMYBITMAP my_bmp, RGB *pal, const char *spFileName)
Saves a MYBITMAP object to a bitmap file.
MG_EXPORT int GUIAPI LoadMyBitmapFromMem(PMYBITMAP my_bmp, RGB *pal, const void *mem, int size, const char *ext)
Loads a MYBITMAP object from memory.
MG_EXPORT gal_pixel GUIAPI GetPixelRGBA(HDC hdc, int x, int y, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
Gets the pixel value at the specified position on a DC in RGBA quarter.
This file includes functions for reading and writing data from general sources, such as file...
MG_EXPORT int GUIAPI LoadBitmapFromFile(HDC hdc, PBITMAP pBitmap, const char *spFileName)
Loads a device-dependent bitmap from a file.
int startx
Definition: gdi.h:7169
int left
Definition: common.h:848
MG_EXPORT RGBCOLOR GUIAPI GetNearestColor(HDC hdc, Uint8 red, Uint8 green, Uint8 blue)
Gets the nearest color compliant to a DC for a spefici color.
Definition: gdi.h:7382
MG_EXPORT void GUIAPI BIDIGetLogicalEmbeddLevels(LOGFONT *log_font, Glyph32 *glyphs, int nr_glyphs, Uint8 **embedding_level_list)
Get the logical embedding levels for the logical glyph string and generate runs by embedding levels...
MG_EXPORT Glyph32 *GUIAPI BIDILogGlyphs2VisGlyphs(LOGFONT *log_font, Glyph32 *glyphs, int nr_glyphs, GLYPHMAPINFO *glyphs_map)
Reorder the logical glyphs string to visual glyphs string.
Definition: gdi.h:5804
static PLOGFONT GUIAPI GetSystemFont(int font_id)
Gets the system logical font through an font identifier.
Definition: gdi.h:6321
MG_EXPORT HDC GUIAPI GetDC(HWND hwnd)
Gets a window DC of a window.
MG_EXPORT void *GUIAPI InitMyBitmapSL(MG_RWops *area, const char *ext, MYBITMAP *my_bmp, RGB *pal)
Initializes scanline loader of the MYBITMAP object from a data source.
MG_EXPORT PLOGFONT GUIAPI SelectFont(HDC hdc, PLOGFONT log_font)
Selects a logical font into a DC.
MG_EXPORT void GUIAPI NormalizeRect(RECT *pRect)
Normalizes a rectangle.
int height
Definition: gdi.h:7175
static BOOL GUIAPI SetPixelInBitmap(const BITMAP *bmp, int x, int y, gal_pixel pixel)
Sets pixel value in a BITMAP object.
Definition: gdi.h:4928
MG_EXPORT void GUIAPI TermVectorialFonts(void)
Terminates vectorial font renderer.
int width
Definition: gdi.h:7173
MG_EXPORT BOOL GUIAPI SubtractClipRect(PCLIPRGN pRgn, const RECT *pRect)
Subtracts a rectangle from a region.
MG_EXPORT int GUIAPI GetGlyphsExtent(HDC hdc, Glyph32 *glyphs, int nr_glyphs, SIZE *size)
Get visual extent value of a glyph string.
MG_EXPORT void GUIAPI GetTextRangesLog2Vis(LOGFONT *log_font, char *text, int text_len, int start_index, int end_index, int **ranges, int *nr_ranges)
Get a list of visual ranges corresponding to a given logical range.
MG_EXPORT void GUIAPI TerminateSlaveScreen(HDC hdc)
Terminates slave screen.
int max_width
Definition: gdi.h:5854
MG_EXPORT gal_pixel GUIAPI GetPixelRGB(HDC hdc, int x, int y, Uint8 *r, Uint8 *g, Uint8 *b)
Gets the pixel value at the specified position on a DC in RGB triple.
MG_EXPORT BOOL GUIAPI IsRectEmpty(const RECT *prc)
Determines whether an rectangle is empty.
MG_EXPORT BOOL GUIAPI EqualRect(const RECT *prc1, const RECT *prc2)
Determines whether two rectangles are equal.
MG_EXPORT void GUIAPI PolyFillArcEx(HDC hdc, const ARC *arcs, int nr_arcs)
Fill a polyarc with the current brush in a DC.
#define FALSE
FALSE value, defined as 0 by MiniGUI.
Definition: common.h:302
MG_EXPORT int GUIAPI GetTextMCharInfo(PLOGFONT log_font, const char *mstr, int len, int *pos_chars)
Retrieves positions of multi-byte characters in a string.
MG_EXPORT void DestroyBlockDataHeap(PBLOCKHEAP heap)
Destroys a private block data heap.
MG_EXPORT int GUIAPI GetSysCharWidth(void)
Gets the width of a single-byte character of the default system font.
Definition: gdi.h:5697
MG_EXPORT HDC GUIAPI SetSecondaryDC(HWND hwnd, HDC secondary_dc, ON_UPDATE_SECONDARYDC on_update_secondarydc)
Set a window&#39;s secondary DC and the callback procedure for the secondary DC update.
Definition: gdi.h:3530
MG_EXPORT void GUIAPI PolyArcEx(HDC hdc, const ARC *arcs, int nr_arcs)
Draws a polyarc with the current pen in a DC.
unsigned int UINT
A type definition for unsigned integer.
Definition: common.h:594
int font_height
Definition: gdi.h:5847
struct _CLIPRECT CLIPRECT
MG_EXPORT BOOL GUIAPI ScaleBitmapEx(BITMAP *dst, const BITMAP *src, HDC ref_dc)
Scales a BITMAP object into another BITMAP object by specify algorithm.
MG_EXPORT void GUIAPI CircleArc(HDC hdc, int sx, int sy, int r, int ang1, int ang2)
Draws an arc.
BOOL need_unload
Definition: gdi.h:5828
int top
Definition: common.h:852
MG_EXPORT HDC GUIAPI CreatePrivateDC(HWND hwnd)
Creates a private window DC of a window.
MG_EXPORT void GUIAPI UnloadBitmap(PBITMAP pBitmap)
Unloads a bitmap.
MG_EXPORT HICON GUIAPI LoadIconFromMem(HDC hdc, const void *area, int which)
Loads an icon from a memory area.
MG_EXPORT HDC GUIAPI GetSubDC(HDC hdc, int off_x, int off_y, int width, int height)
This function gets a sub DC which is compliant to the specified client DC.
size_t heap_size
Definition: gdi.h:404
MG_EXPORT BOOL GUIAPI FillPolygon(HDC hdc, const POINT *pts, int vertices)
Fills an polygon.
BYTE b
Definition: common.h:933
MG_EXPORT HDC GUIAPI GetSecondaryClientDC(HWND hwnd)
Retrives and returns the client secondary DC of a specific window.
MG_EXPORT Uint32 GUIAPI SetDCAttr(HDC hdc, int attr, Uint32 value)
Sets a specified attribute value of a DC.
Definition: gdi.h:566
static void Pixel2RGB(HDC hdc, gal_pixel pixel, Uint8 *r, Uint8 *g, Uint8 *b)
Gets the color in RGB triple from a pixel value under a DC.
Definition: gdi.h:2801
MG_EXPORT HDC GUIAPI CreateSubMemDC(HDC parent, int off_x, int off_y, int width, int height, BOOL comp_to_parent)
Creates a sub memory DC in the given memory DC.
int nr_delimiters
Definition: gdi.h:6456
MG_EXPORT void GUIAPI VFlipBitmap(BITMAP *bmp, unsigned char *inter_buff)
Vertical Flip the special Bitmap object.
MG_EXPORT int GUIAPI CleanupMyBitmapSL(MYBITMAP *my_bmp, void *load_info)
Cleanups the scanline loader.
MG_EXPORT void GUIAPI IncludeClipRect(HDC hdc, const RECT *prc)
Includes the specified rectangle to the current visible region of a DC.
size_t bd_size
Definition: gdi.h:400
BLOCKHEAP * PBLOCKHEAP
Data type of the pointer to a BLOCKHEAP.
Definition: gdi.h:421
MG_EXPORT void GUIAPI DeleteMemDC(HDC mem_dc)
Deletes a memory DC.
MG_EXPORT Uint8 *GUIAPI LockDC(HDC hdc, const RECT *rw_rc, int *width, int *height, int *pitch)
Locks a dc to get direct access to pixels in the DC.
MG_EXPORT int GUIAPI ExpandMyBitmap(HDC hdc, PBITMAP bmp, const MYBITMAP *my_bmp, const RGB *pal, int frame)
Expands a MYBITMAP object to a BITMAP object.
MG_EXPORT int GUIAPI TextOutLen(HDC hdc, int x, int y, const char *spText, int len)
Outputs a string of text.
MG_EXPORT HICON GUIAPI LoadIconFromFile(HDC hdc, const char *filename, int which)
Loads an icon from a Windows ICO file.
MG_EXPORT void GUIAPI BIDIGetVisualEmbeddLevels(LOGFONT *log_font, Glyph32 *glyphs, int nr_glyphs, Uint8 **embedding_level_list)
Get the visual embedding levels for the given logical glyph string, then you can get the edge for vis...
MG_EXPORT BOOL GUIAPI PtVisible(HDC hdc, int x, int y)
Checks whether a point is visible.
MG_EXPORT void GUIAPI Pixel2RGBs(HDC hdc, const gal_pixel *pixels, RGB *rgbs, int count)
Gets the colors in RGB triple from a pixel value array under a DC.
MG_EXPORT BOOL GUIAPI SetMemDCColorKey(HDC mem_dc, DWORD flags, Uint32 color_key)
Sets the color key (transparent pixel) of a memory DC.
MG_EXPORT PLOGFONT GUIAPI GetCurFont(HDC hdc)
Gets the pointer to the current logical font of a DC.
MG_EXPORT BOOL GUIAPI PtInRegion(PCLIPRGN region, int x, int y)
Determines whether a point is in a region.
MG_EXPORT BOOL GUIAPI FloodFill(HDC hdc, int x, int y)
Fills an enclosed area starting at point (x,y).
MG_EXPORT BOOL GUIAPI RegisterBitmapFileType(const char *ext, void *(*init)(MG_RWops *fp, MYBITMAP *my_bmp, RGB *pal), int(*load)(MG_RWops *fp, void *init_info, MYBITMAP *my_bmp, CB_ONE_SCANLINE cb, void *context), void(*cleanup)(void *init_info), int(*save)(MG_RWops *fp, MYBITMAP *my_bmp, RGB *pal), BOOL(*check)(MG_RWops *fp))
Registers a bitmap file loader, saver, and checker.
MG_EXPORT BOOL GUIAPI RectVisible(HDC hdc, const RECT *pRect)
Checks whether the specified rectangle is visible.
MG_EXPORT void GUIAPI SplineTo(HDC hdc, const POINT *pts)
Draws a bezier spline.
int ascent
Definition: gdi.h:5849
MG_EXPORT void GUIAPI DrawHVDotLine(HDC hdc, int x, int y, int w_h, BOOL H_V)
Draws a horizontal or vertical dot dash line.
BYTE r
Definition: common.h:925
Definition: gdi.h:3724
MG_EXPORT BOOL GUIAPI InitEllipseRegion(PCLIPRGN dst, int x, int y, int rx, int ry)
Initializes a region to be an enclosed ellipse.
MG_EXPORT int GUIAPI GetTextExtent(HDC hdc, const char *spText, int len, SIZE *pSize)
Computes the output extent of a string of text.
static HDC GUIAPI CreateMemDC(int width, int height, int depth, DWORD flags, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
Creates a memory DC.
Definition: gdi.h:1455
BYTE a
Definition: common.h:937
static void InflateRect(RECT *prc, int cx, int cy)
Increases or decreases the width and height of an rectangle.
Definition: gdi.h:5206
BITMAP * PBITMAP
Data type of pointer to a BITMAP.
Definition: gdi.h:512
void(* CB_POLYGON)(void *context, int x1, int x2, int y)
The type of polygon generator callback.
Definition: gdi.h:3135
MG_EXPORT BOOL GUIAPI ft2SetLcdFilter(LOGFONT *logfont, mg_FT_LcdFilter filter)
Set freetype2 smooth mode.
MG_EXPORT int GUIAPI GetSysFontAveWidth(int font_id)
Gets the average width of a single-byte character of a system font.
MG_EXPORT int GUIAPI SaveBitmapToFile(HDC hdc, PBITMAP pBitmap, const char *spFileName)
Saves a BITMAP object to a bitmap file.
MG_EXPORT void GUIAPI CompileRGBABitmap(HDC hdc, BYTE *bits, Uint32 pitch, const BYTE *my_bits, Uint32 my_pitch, Uint32 w, Uint32 h, DWORD flags, void *pixel_format, CB_DRAW_PIXEL cb_draw, MYBITMAP_CONTXT *mybmp)
Convert a MYBITMAP pixel data to a BITMAP pixel data.
MG_EXPORT HICON GUIAPI CreateIconEx(HDC hdc, int w, int h, const BYTE *AndBits, const BYTE *XorBits, int colornum, const RGB *pal)
Creates an icon object from the memory.
MG_EXPORT int GUIAPI SetBitmapScalerType(HDC hdc, int scaler_type)
set bitmap scaler algorithm callback of DC according by scaler_type.
MG_EXPORT void GUIAPI DestroyLogFont(PLOGFONT log_font)
Destroys a logical font.
GHANDLE HICON
Handle to icon.
Definition: common.h:378
PCLIPRECT tail
Definition: gdi.h:618
MG_EXPORT int GUIAPI GetSysFontMaxWidth(int font_id)
Gets the maximal width of a single-byte character of a system font.
MG_EXPORT void GUIAPI RotateScaledBitmapVFlip(HDC hdc, const BITMAP *bmp, int lx, int ty, int angle, int w, int h)
Flip vertically, rotates, stretch or shrinks a bitmap object.