gdi.h
资源名称:GPRS_work.rar [点击查看]
上传用户:sdaoma
上传日期:2013-08-07
资源大小:3838k
文件大小:218k
源码类别:
GPS编程
开发平台:
C/C++
- /**
- * file gdi.h
- * author Wei Yongming <ymwei@minigui.org>
- * date 2002/01/06
- *
- * This file includes graphics device interfaces of MiniGUI.
- *
- verbatim
- Copyright (C) 1998-2002 Wei Yongming.
- Copyright (C) 2002-2004 Feynman Software.
- This file is part of MiniGUI, a compact cross-platform Graphics
- User Interface (GUI) support system for real-time embedded systems.
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- endverbatim
- */
- /*
- * $Id: gdi.h,v 1.191 2004/10/20 02:06:00 weiym Exp $
- *
- * MiniGUI for Linux/uClinux, eCos, uC/OS-II, and VxWorks version 1.6.x
- * Copyright (C) 1998-2002 Wei Yongming.
- * Copyright (C) 2002-2004 Feynman Software.
- */
- #ifndef _MGUI_GDI_H
- #define _MGUI_GDI_H
- /* include necessary headers */
- #ifndef _LITE_VERSION
- #include "pthread.h"
- #endif /* !LITE_VERSION */
- #ifdef __cplusplus
- extern "C" {
- #endif /* __cplusplus */
- /**
- * addtogroup global_vars Global variables
- * @{
- */
- /**
- * defgroup color_vars System colors and pixel values.
- * @{
- */
- /**
- * var gal_pixel SysPixelIndex []
- * brief The pre-defined system pixel values.
- *
- * MiniGUI defines some system pixel values when initializing
- * graphics sub-system. You can access the arrary to get the
- * system pixel values, or just use the following macros:
- *
- * - PIXEL_blackn
- * black
- * - PIXEL_darkredn
- * dark red
- * - PIXEL_darkgreenn
- * dark green
- * - PIXEL_darkyellown
- * dark yellow
- * - PIXEL_darkbluen
- * dark blue
- * - PIXEL_darkmagentan
- * dark magenta
- * - PIXEL_darkcyann
- * dark cyan
- * - PIXEL_lightgrayn
- * light gray
- * - PIXEL_darkgrayn
- * dark gray
- * - PIXEL_redn
- * red
- * - PIXEL_greenn
- * green
- * - PIXEL_yellown
- * yellow
- * - PIXEL_bluen
- * blue
- * - PIXEL_magentan
- * magenta
- * - PIXEL_cyann
- * cyan
- * - PIXEL_lightwhiten
- * light white
- */
- extern gal_pixel SysPixelIndex [];
- /**
- * var RGB SysPixelColor []
- * brief The pre-defined system RGB colors.
- *
- * The elements in this array are system colors in RGB triples.
- */
- extern const RGB SysPixelColor [];
- #define PIXEL_invalid 0
- #define PIXEL_transparent SysPixelIndex[0]
- #define PIXEL_darkblue SysPixelIndex[1]
- #define PIXEL_darkgreen SysPixelIndex[2]
- #define PIXEL_darkcyan SysPixelIndex[3]
- #define PIXEL_darkred SysPixelIndex[4]
- #define PIXEL_darkmagenta SysPixelIndex[5]
- #define PIXEL_darkyellow SysPixelIndex[6]
- #define PIXEL_darkgray SysPixelIndex[7]
- #define PIXEL_lightgray SysPixelIndex[8]
- #define PIXEL_blue SysPixelIndex[9]
- #define PIXEL_green SysPixelIndex[10]
- #define PIXEL_cyan SysPixelIndex[11]
- #define PIXEL_red SysPixelIndex[12]
- #define PIXEL_magenta SysPixelIndex[13]
- #define PIXEL_yellow SysPixelIndex[14]
- #define PIXEL_lightwhite SysPixelIndex[15]
- #define PIXEL_black SysPixelIndex[16]
- /* Compatiblity definitions */
- #define COLOR_invalid PIXEL_invalid
- #define COLOR_transparent PIXEL_transparent
- #define COLOR_darkred PIXEL_darkred
- #define COLOR_darkgreen PIXEL_darkgreen
- #define COLOR_darkyellow PIXEL_darkyellow
- #define COLOR_darkblue PIXEL_darkblue
- #define COLOR_darkmagenta PIXEL_darkmagenta
- #define COLOR_darkcyan PIXEL_darkcyan
- #define COLOR_lightgray PIXEL_lightgray
- #define COLOR_darkgray PIXEL_darkgray
- #define COLOR_red PIXEL_red
- #define COLOR_green PIXEL_green
- #define COLOR_yellow PIXEL_yellow
- #define COLOR_blue PIXEL_blue
- #define COLOR_magenta PIXEL_magenta
- #define COLOR_cyan PIXEL_cyan
- #define COLOR_lightwhite PIXEL_lightwhite
- #define COLOR_black PIXEL_black
- #define SysColorIndex SysPixelIndex
- /** @} end of color_vars */
- /** @} end of global_vars */
- /**
- * addtogroup fns Functions
- * @{
- */
- /**
- * addtogroup global_fns Global/general functions
- * @{
- */
- /**
- * defgroup block_heap_fns Block data heap operations
- *
- * MiniGUI maintains some private block data heaps to allocate
- * data blocks which have fixed size, such as the clipping rectangles
- * in a region. By using the private heap, we can avoiding calling
- * a malloc and a free function frequently, so will have a slight
- * performance enhancement.
- *
- * @{
- */
- /**
- * MiniGUI's private block data heap.
- *
- * sa InitBlockDataHeap, DestroyBlockDataHeap
- */
- typedef struct _BLOCKHEAP
- {
- #ifndef _LITE_VERSION
- pthread_mutex_t lock;
- #endif
- /**
- * size of one block element.
- */
- size_t bd_size;
- /**
- * size of the heap in blocks.
- */
- size_t heap_size;
- /**
- * the first free element in the heap.
- */
- int free;
- /**
- * pointer to the pre-allocated heap.
- */
- void* heap;
- } BLOCKHEAP;
- /**
- * var typedef BLOCKHEAP* PBLOCKHEAP
- * brief Data type of the pointer to a BLOCKHEAP.
- *
- * sa BLOCKHEAP
- */
- typedef BLOCKHEAP* PBLOCKHEAP;
- /**
- * fn void InitBlockDataHeap (PBLOCKHEAP heap, size_t bd_size, size_t heap_size)
- * brief Initializes a private block data heap.
- *
- * This function initializes a block data heap pointed to by a heap.
- * It will allocate the buffer used by the heap from system heap by using a malloc(3).
- * Initially, the heap has a heap_size blocks free, and each is a bd_size bytes long.
- *
- * param heap The pointer to the heap structure.
- * param bd_size The size of one block in bytes.
- * param heap_size The size of the heap in blocks.
- * return a heap->heap will contains a valid pointer on success, NULL on error.
- *
- * note This function does not return anything. You should check the a heap
- * field of the a heap structure.
- *
- * sa BLOCKHEAP
- */
- void InitBlockDataHeap (PBLOCKHEAP heap, size_t bd_size, size_t heap_size);
- /**
- * fn void* BlockDataAlloc (PBLOCKHEAP heap)
- * brief Allocates a data block from private heap.
- *
- * This function allocates a data block from an initialized
- * block data heap. The allocated block will have the size of a heap->bd_size.
- * If there is no free block in the heap, this function will try to allocate
- * the block from the system heap by using a malloc(3) function.
- *
- * param heap The pointer to the initialized heap.
- * return Pointer to the allocated data block, NULL on error.
- *
- * sa InitBlockDataHeap, BlockDataFree
- */
- void* BlockDataAlloc (PBLOCKHEAP heap);
- /**
- * fn void BlockDataFree (PBLOCKHEAP heap, void* data)
- * brief Frees an allocated data block.
- *
- * This function frees the specified data block pointed to by a data to the heap a heap.
- * If the block was allocated by using a malloc function, this function will
- * free the element by using a free(3) function.
- *
- * param heap The pointer to the heap.
- * param data The pointer to the element to be freed.
- *
- * sa InitBlockDataHeap, BlockDataAlloc
- */
- void BlockDataFree (PBLOCKHEAP heap, void* data);
- /**
- * fn void DestroyBlockDataHeap (PBLOCKHEAP heap)
- * brief Destroies a private block data heap.
- *
- * param heap The pointer to the heap to be destroied.
- *
- * sa InitBlockDataHeap, BLOCKHEAP
- */
- void DestroyBlockDataHeap (PBLOCKHEAP heap);
- /** @} end of block_heap_fns */
- /** @} end of global_fns */
- /**
- * defgroup gdi_fns GDI functions
- * @{
- */
- struct _BITMAP;
- typedef struct _BITMAP BITMAP;
- typedef BITMAP* PBITMAP;
- struct _MYBITMAP;
- typedef struct _MYBITMAP MYBITMAP;
- typedef struct _MYBITMAP* PMYBITMAP;
- /**
- * defgroup region_fns Region operations
- *
- * A Region is simply an area, as the name implies, and is implemented as
- * a "y-x-banded" array of rectangles. To explain: Each Region is made up
- * of a certain number of rectangles sorted by y coordinate first,
- * and then by x coordinate.
- *
- * Furthermore, the rectangles are banded such that every rectangle with a
- * given upper-left y coordinate (y1) will have the same lower-right y
- * coordinate (y2) and vice versa. If a rectangle has scanlines in a band, it
- * will span the entire vertical distance of the band. This means that some
- * areas that could be merged into a taller rectangle will be represented as
- * several shorter rectangles to account for shorter rectangles to its left
- * or right but within its "vertical scope".
- *
- * An added constraint on the rectangles is that they must cover as much
- * horizontal area as possible. E.g. no two rectangles in a band are allowed
- * to touch.
- *
- * Whenever possible, bands will be merged together to cover a greater vertical
- * distance (and thus reduce the number of rectangles). Two bands can be merged
- * only if the bottom of one touches the top of the other and they have
- * rectangles in the same places (of the same width, of course). This maintains
- * the y-x-banding that's so nice to have...
- *
- * Example:
- *
- * include region.c
- *
- * @{
- */
- /**
- * Clipping rectangle structure.
- */
- typedef struct _CLIPRECT
- {
- /**
- * the clipping rectangle itself.
- */
- RECT rc;
- /**
- * the next clipping rectangle.
- */
- struct _CLIPRECT* next;
- #ifdef _USE_NEWGAL
- /**
- * the previous clipping rectangle.
- * note only defined for _USE_NEWGAL.
- */
- struct _CLIPRECT* prev;
- #endif
- } CLIPRECT;
- typedef CLIPRECT* PCLIPRECT;
- /* Clipping Region */
- #ifdef _USE_NEWGAL
- #define NULLREGION 0x00
- #define SIMPLEREGION 0x01
- #define COMPLEXREGION 0x02
- #endif
- /**
- * Clipping region structure, alos used for general regions.
- */
- typedef struct _CLIPRGN
- {
- #ifdef _USE_NEWGAL
- /**
- * type of the region, can be one of the following:
- * - NULLREGIONn
- * a null region.
- * - SIMPLEREGIONn
- * a simple region.
- * - COMPLEXREGION
- * a complex region.
- *
- * note only defined for _USE_NEWGAL.
- */
- BYTE type; /* type of region */
- /**
- * reserved for alignment.
- *
- * note only defined for _USE_NEWGAL.
- */
- BYTE reserved[3];
- #endif
- /**
- * The bounding rect of the region.
- */
- RECT rcBound;
- /**
- * head of the clipping rectangle list.
- */
- PCLIPRECT head;
- /**
- * tail of the clipping rectangle list.
- */
- PCLIPRECT tail;
- /**
- * The private block data heap used to allocate clipping rectangles.
- * sa BLOCKHEAP
- */
- PBLOCKHEAP heap;
- } CLIPRGN;
- /**
- * var typedef CLIPRGN* PCLIPRGN
- * brief Data type of the pointer to a CLIPRGN.
- *
- * sa CLIPRGN
- */
- typedef CLIPRGN* PCLIPRGN;
- /**
- * def InitFreeClipRectList(heap, size)
- * brief Initializes the private block data heap used to allocate clipping rectangles.
- * param heap The pointer to a BLOCKHEAP structure.
- * param size The size of the heap.
- *
- * note This macro is defined to call a InitBlockDataHeap function with a bd_size set to
- * a sizeof(CLIPRECT).
- *
- * sa InitBlockDataHeap
- */
- #define InitFreeClipRectList(heap, size) InitBlockDataHeap (heap, sizeof (CLIPRECT), size)
- /**
- * def ClipRectAlloc(heap)
- * brief Allocates a clipping rectangles from the private block data heap.
- * param heap The pointer to the initialized BLOCKHEAP structure.
- *
- * note This macro is defined to call a BlockDataAlloc function.
- *
- * sa BlockDataAlloc
- */
- #define ClipRectAlloc(heap) BlockDataAlloc (heap)
- /**
- * def FreeClipRect(heap, cr)
- * brief Frees a clipping rectangle which is allocated from the private block data heap.
- * param heap The pointer to the initialized BLOCKHEAP structure.
- * param cr The pointer to the clipping rectangle to be freed.
- *
- * note This macro is defined to call a BlockDataFree function.
- *
- * sa BlockDataFree
- */
- #define FreeClipRect(heap, cr) BlockDataFree (heap, cr);
- /**
- * def DestroyFreeClipRectList(heap)
- * brief Destroies the private block data heap used to allocate clipping rectangles.
- * param heap The pointer to the BLOCKHEAP structure.
- *
- * note This macro is defined to call a DestroyBlockDataHeap function.
- *
- * sa DestroyBlockDataHeap
- */
- #define DestroyFreeClipRectList(heap) DestroyBlockDataHeap (heap);
- /**
- * fn void GUIAPI InitClipRgn (PCLIPRGN pRgn, PBLOCKHEAP pFreeList)
- * brief Initializes a clipping region.
- *
- * Before intializing a clipping region, you should initialize a private
- * block data heap first. The region operations, such as a UnionRegion function,
- * will allocate/free the clipping rectangles from/to the heap.
- * This function will set the a heap field of a pRgn to be a pFreeList,
- * and empty the region.
- *
- * param pRgn The pointer to the CLIPRGN structure to be initialized.
- * param pFreeList The pointer to the initialized private block data heap.
- *
- * sa InitFreeClipRectList, EmptyClipRgn.
- *
- * Example:
- *
- * include initcliprgn.c
- */
- void GUIAPI InitClipRgn (PCLIPRGN pRgn, PBLOCKHEAP pFreeList);
- /**
- * fn void GUIAPI EmptyClipRgn (PCLIPRGN pRgn)
- * brief Empties a clipping region.
- *
- * This function empties a clipping region pointed to by a pRgn.
- *
- * param pRgn The pointer to the region.
- *
- * sa InitClipRgn
- */
- void GUIAPI EmptyClipRgn (PCLIPRGN pRgn);
- /**
- * fn BOOL GUIAPI ClipRgnCopy (PCLIPRGN pDstRgn, const CLIPRGN* pSrcRgn)
- * brief Copies one region to another.
- *
- * This function copies the region pointed to by a pSrcRgn to the region pointed to by a pDstRgn.
- *
- * param pDstRgn The destination region.
- * param pSrcRgn The source region.
- * return TRUE on success, otherwise FALSE.
- *
- * note This function will empty the region a pDstRgn first.
- *
- * sa EmptyClipRgn, ClipRgnIntersect, UnionRegion, SubtractRegion, XorRegion
- */
- BOOL GUIAPI ClipRgnCopy (PCLIPRGN pDstRgn, const CLIPRGN* pSrcRgn);
- /**
- * fn BOOL GUIAPI ClipRgnIntersect (PCLIPRGN pRstRgn, const CLIPRGN* pRgn1, const CLIPRGN* pRgn2)
- * brief Intersects two region.
- *
- * This function gets the intersection of two regions pointed to by a pRgn1 and a pRgn2
- * respectively and puts the result to the region pointed to by a pRstRgn.
- *
- * param pRstRgn The intersected result region.
- * param pRgn1 The first region.
- * param pRgn2 The second region.
- * return TRUE on success, otherwise FALSE.
- *
- * note If a pRgn1 does not intersected with a pRgn2, the result region will be
- * a emgty region.
- *
- * sa EmptyClipRgn, ClipRgnCopy, UnionRegion, SubtractRegion, XorRegion
- */
- BOOL GUIAPI ClipRgnIntersect (PCLIPRGN pRstRgn,
- const CLIPRGN* pRgn1, const CLIPRGN* pRgn2);
- /**
- * fn void GUIAPI GetClipRgnBoundRect (PCLIPRGN pRgn, PRECT pRect)
- * brief Gets the bounding rectangle of a region.
- *
- * This function gets the bounding rect of the region pointed to by a pRgn,
- * and returns the rect in the rect pointed to by a pRect.
- *
- * param pRgn The pointer to the region.
- * param pRect The pointer to the result rect.
- *
- * sa IsEmptyClipRgn
- */
- void GUIAPI GetClipRgnBoundRect (PCLIPRGN pRgn, PRECT pRect);
- /**
- * fn BOOL GUIAPI SetClipRgn (PCLIPRGN pRgn, const RECT* pRect)
- * brief Sets a region to contain only one rect.
- *
- * This function sets the region a pRgn to contain only a rect pointed to by a pRect.
- *
- * param pRgn The pointer to the region.
- * param pRect The pointer to the rect.
- * return TRUE on success, otherwise FALSE.
- *
- * note This function will empty the region a pRgn first.
- *
- * sa EmptyClipRgn
- */
- BOOL GUIAPI SetClipRgn (PCLIPRGN pRgn, const RECT* pRect);
- /**
- * fn BOOL GUIAPI IsEmptyClipRgn (const CLIPRGN* pRgn)
- * brief Determines whether a region is an empty region.
- *
- * This function determines whether the region pointed to by a pRgn is an empty region.
- *
- * param pRgn The pointer to the region.
- * return TRUE for empty one, else for not empty region.
- *
- * sa EmptyClipRgn
- */
- BOOL GUIAPI IsEmptyClipRgn (const CLIPRGN* pRgn);
- /**
- * fn BOOL GUIAPI AddClipRect (PCLIPRGN pRgn, const RECT* pRect)
- * brief Unions one rectangle to a region.
- *
- * This function unions a rectangle to the region pointed to by a pRgn.
- *
- * param pRgn The pointer to the region.
- * param pRect The pointer to the rectangle.
- * return TRUE on success, otherwise FALSE.
- *
- * sa IntersectClipRect, SubtractClipRect
- */
- BOOL GUIAPI AddClipRect (PCLIPRGN pRgn, const RECT* pRect);
- /**
- * fn BOOL GUIAPI IntersectClipRect (PCLIPRGN pRgn, const RECT* pRect)
- * brief Intersects a rectangle with a region.
- *
- * This function intersects the region pointed to by a pRgn with a rect pointed to by a pRect.
- *
- * param pRgn The pointer to the region.
- * param pRect The pointer to the rectangle.
- * return TRUE on success, otherwise FALSE.
- *
- * sa AddClipRect, SubtractClipRect
- */
- BOOL GUIAPI IntersectClipRect (PCLIPRGN pRgn, const RECT* pRect);
- /**
- * fn BOOL GUIAPI SubtractClipRect (PCLIPRGN pRgn, const RECT* pRect)
- * brief Subtracts a rectangle from a region.
- *
- * This function subtracts a rect pointed to by a pRect from the region pointed to by a pRgn.
- *
- * param pRgn The pointer to the region.
- * param pRect The pointer to the rect.
- * return TRUE on success, otherwise FALSE.
- *
- * sa AddClipRect, IntersectClipRect
- */
- BOOL GUIAPI SubtractClipRect (PCLIPRGN pRgn, const RECT* pRect);
- /**
- * fn BOOL GUIAPI PtInRegion (PCLIPRGN region, int x, int y)
- * brief Determines whether a point is in a region.
- *
- * This function determines whether a point a (x,y) is in the region pointed to by a region.
- *
- * param region The pointer to the region.
- * param x x,y: The point.
- * param y x,y: The point.
- * return TRUE for in the region, otherwise FALSE.
- *
- * note This fucntion defined only for _USE_NEWGAL.
- *
- * sa RectInRegion
- */
- BOOL GUIAPI PtInRegion (PCLIPRGN region, int x, int y);
- /**
- * fn BOOL GUIAPI RectInRegion (PCLIPRGN region, const RECT* rect)
- * brief Determines whether a rectangle is intersected with a region.
- *
- * This function determines whether the rect a rect is intersected with the region
- * pointed to by a region.
- *
- * param region The pointer to the region.
- * param rect The pointer to the rect.
- * return TRUE for in the region, otherwise FALSE.
- *
- * note This fucntion defined only for _USE_NEWGAL.
- *
- * sa PtInRegion
- */
- BOOL GUIAPI RectInRegion (PCLIPRGN region, const RECT* rect);
- /**
- * fn void GUIAPI OffsetRegion (PCLIPRGN region, int x, int y)
- * brief Offsets the region.
- *
- * This function offsets a given region pointed to by region.
- *
- * param region The pointer to the region.
- * param x x,y: Offsets on x and y coodinates.
- * param y x,y: Offsets on x and y coodinates.
- *
- * note This fucntion defined only for _USE_NEWGAL.
- */
- void GUIAPI OffsetRegion (PCLIPRGN region, int x, int y);
- #ifdef _USE_NEWGAL
- /**
- * fn BOOL GUIAPI UnionRegion (PCLIPRGN dst, const CLIPRGN* src1, const CLIPRGN* src2)
- * brief Unions two regions.
- *
- * This function unions two regions pointed to by a src1 and a src2 respectively and
- * puts the result to the region pointed to by a dst.
- *
- * param dst The pointer to the result region.
- * param src1 src1,src2: Two regions will be unioned.
- * param src2 src1,src2: Two regions will be unioned.
- * return TRUE on success, otherwise FALSE.
- *
- * note This fucntion defined only for _USE_NEWGAL.
- *
- * sa SubtractRegion, XorRegion
- */
- BOOL GUIAPI UnionRegion (PCLIPRGN dst, const CLIPRGN* src1, const CLIPRGN* src2);
- /**
- * fn BOOL GUIAPI SubtractRegion (CLIPRGN* rgnD, const CLIPRGN* rgnM, const CLIPRGN* rgnS)
- * brief Substrcts a region from another.
- *
- * This function subtracts a rgnS from a rgnM and leave the result in a rgnD.
- *
- * param rgnD The pointer to the difference region.
- * param rgnM The pointer to the minuend region.
- * param rgnS The pointer to the subtrahend region.
- * return TRUE on success, otherwise FALSE.
- *
- * note This fucntion defined only for _USE_NEWGAL.
- *
- * sa UnionRegion, XorRegion
- */
- BOOL GUIAPI SubtractRegion (CLIPRGN* rgnD, const CLIPRGN* rgnM, const CLIPRGN* rgnS);
- /**
- * fn BOOL GUIAPI XorRegion (CLIPRGN *dst, const CLIPRGN *src1, const CLIPRGN *src2)
- * brief Does the XOR operation between two regions.
- *
- * This function does the XOR operation between two regions pointed to by
- * a src1 and a src2 and puts the result to the region pointed to by a dst.
- *
- * param dst The pointer to the result region.
- * param src1 src1,src2: Two regions will be xor'ed.
- * param src2 src1,src2: Two regions will be xor'ed.
- * return TRUE on success, otherwise FALSE.
- *
- * note This fucntion defined only for _USE_NEWGAL.
- *
- * sa UnionRegion, SubtractRegion
- */
- BOOL GUIAPI XorRegion (CLIPRGN *dst, const CLIPRGN *src1, const CLIPRGN *src2);
- /**
- * def UnionRectWithRegion
- * brief Is an alias of a AddClipRect
- * sa AddClipRect
- */
- #define UnionRectWithRegion AddClipRect
- /**
- * def CopyRegion
- * brief Is an alias of a ClipRgnCopy
- * sa ClipRgnCopy
- */
- #define CopyRegion ClipRgnCopy
- /**
- * def IntersectRegion
- * brief Is an alias of a ClipRgnIntersect
- * sa ClipRgnIntersect
- */
- #define IntersectRegion ClipRgnIntersect
- /**
- * fn BOOL GUIAPI InitCircleRegion (PCLIPRGN dst, int x, int y, int r)
- * brief Initializes a region to be an enclosed circle.
- *
- * param dst The pointer to the region to be initialized.
- * param x x,y: The center of the circle.
- * param y x,y: The center of the circle.
- * param r The radius of the circle.
- * return TRUE on success, otherwise FALSE.
- *
- * note This fucntion defined only for _USE_NEWGAL.
- *
- * sa InitEllipseRegion, InitPolygonRegion
- */
- BOOL GUIAPI InitCircleRegion (PCLIPRGN dst, int x, int y, int r);
- /**
- * fn BOOL GUIAPI InitEllipseRegion (PCLIPRGN dst, int x, int y, int rx, int ry)
- * brief Initializes a region to be an enclosed ellipse.
- *
- * param dst The pointer to the region to be initialized.
- * param x x,y: The center of the ellipse.
- * param y x,y: The center of the ellipse.
- * param rx The x-radius of the ellipse.
- * param ry The y-radius of the ellipse.
- * return TRUE on success, otherwise FALSE.
- *
- * note This fucntion defined only for _USE_NEWGAL.
- *
- * sa InitCircleRegion, InitPolygonRegion
- */
- BOOL GUIAPI InitEllipseRegion (PCLIPRGN dst, int x, int y, int rx, int ry);
- /**
- * fn BOOL GUIAPI InitPolygonRegion (PCLIPRGN dst, const POINT* pts, int vertices)
- * brief Initializes a region to be an enclosed polygon.
- *
- * param dst The pointer to the region to be initialized.
- * param pts The vertex array of the polygon.
- * param vertices The number of the vertices.
- * return TRUE on success, otherwise FALSE.
- *
- * note This fucntion defined only for _USE_NEWGAL.
- *
- * sa InitCircleRegion, InitEllipseRegion
- */
- BOOL GUIAPI InitPolygonRegion (PCLIPRGN dst, const POINT* pts, int vertices);
- #endif
- /** @} end of region_fns */
- /**
- * defgroup dc_fns General DC operations
- *
- * DC means Device Context, just like Graphics Context (GC) of X Lib.
- * DC represents a rectangle area on the actual screen or a virtual screen
- * created in memory. We call the rectangle area as "surface" of the DC.
- *
- * You can call a GDI function and pass a DC to the function to
- * draw lines, circles, or text. Commonly, you should call a function
- * like a GetClientDC or a CreateCompatibleDC to get or create a
- * DC, then call GDI functions to draw objects, e.g. a MoveTo and a LineTo.
- * After finishing drawing, you should call a ReleaseDC or a DeleteMemDC function
- * to release or destroy the DC.
- *
- * MiniGUI reserved an global DC called a HDC_SCREEN. You can
- * use this DC directly without getting/creating or releasing/destroying.
- *
- * For main windows or controls, MiniGUI will send a MSG_PAINT message to
- * the window when the whole or part of window area have been invalidated.
- * You should call a BegainPaint function to get the DC, then repaint the window,
- * and call a EndPaint function to release the DC at the last.
- *
- * Example:
- *
- * include msg_paint.c
- *
- * @{
- */
- /**
- * def HDC_SCREEN
- * brief Handle to the device context of the whole screen.
- *
- * This DC is a special one. MiniGUI uses it to draw popup menus and other global
- * objects. You can also use this DC to draw lines or text on the screen
- * directly, and there is no need to get or release it.
- *
- * If you do not want to create any main window, but you want to draw on
- * the screen, you can use this DC.
- *
- * note MiniGUI does not do any clipping operation for this DC, so use this DC
- * may make a mess of other windows.
- */
- #define HDC_SCREEN 0
- /**
- * def HDC_INVALID
- * brief Indicates an invalid handle to device context.
- */
- #define HDC_INVALID 0
- #define GDCAP_COLORNUM 0
- #define GDCAP_HPIXEL 1
- #define GDCAP_VPIXEL 2
- #define GDCAP_MAXX 3
- #define GDCAP_MAXY 4
- #define GDCAP_DEPTH 5
- #define GDCAP_BPP 6
- /**
- * fn unsigned int GUIAPI GetGDCapability (HDC hdc, int iItem)
- * brief Returns a capability of a DC.
- *
- * This function returns the capability of the specified item a iItem of the DC a hdc.
- *
- * param hdc The handle to the DC.
- * param iItem An integer presents the capablity, can be one of the following values:
- *
- * - GDCAP_COLORNUMn
- * Tell a GetGDCapability to return the colors number of the DC. Note the for a DC
- * with 32-bit depth, the function will return 0xFFFFFFFF, not 0x100000000.
- * - GDCAP_HPIXELn
- * Tell a GetGCapability to return the horizontal resolution of the DC.
- * - GDCAP_VPIXELn
- * Tell a GetGDCapability to return the vertical resolution of the DC.
- * - GDCAP_MAXXn
- * Tell a GetGDCapability to return the maximal visible x value of the DC.
- * - GDCAP_MAXYn
- * Tell a GetGDCapability to return the maximal visible y value of the DC.
- * - GDCAP_DEPTHn
- * Tell a GetGDCapability to return the color depth of the DC. The returned value can be
- * 1, 4, 8, 15, 16, 24, or 32.
- * - GDCAP_BPPn
- * Tell a GetGDCapability to return the bytes number for storing a pixle in the DC.
- *
- * return The capbility.
- */
- unsigned int GUIAPI GetGDCapability (HDC hdc, int iItem);
- /**
- * fn HDC GUIAPI GetDC (HWND hwnd)
- * brief Gets a window DC of a window.
- *
- * This function gets a window DC of the specified a hwnd, and returns the handle to the DC.
- * MiniGUI will try to return an unused DC from the internal DC pool, rather than
- * allocate a new one from the system heap. Thus, you should release the DC when
- * you finish drawing as soon as possible.
- *
- * param hwnd The handle to the window.
- * return The handle to the DC, HDC_INVALID indicates an error.
- *
- * note You should call a ReleaseDC to release the DC when you are done.
- *
- * sa GetClientDC, ReleaseDC
- */
- HDC GUIAPI GetDC (HWND hwnd);
- /**
- * fn HDC GUIAPI GetClientDC (HWND hwnd)
- * brief Gets a client DC of a window.
- *
- * This function gets a client DC of the specified a hwnd, and returns the handle to the DC.
- * MiniGUI will try to return an unused DC from the internal DC pool, rather than
- * allocate a new one from the system heap. Thus, you should release the DC when
- * you finish drawing as soon as possible.
- *
- * param hwnd The handle to the window.
- * return The handle to the DC, HDC_INVALID indicates an error.
- *
- * note You should call a ReleaseDC to release the DC when you are done.
- *
- * sa GetDC, ReleaseDC
- */
- HDC GUIAPI GetClientDC (HWND hwnd);
- /**
- * fn void GUIAPI ReleaseDC (HDC hdc)
- * brief Releases a DC from DC pool.
- *
- * This function releases the DC returned by a GetDC or a GetClientDC.
- *
- * param hdc The handle to the DC.
- *
- * sa GetDC, GetClientDC
- */
- void GUIAPI ReleaseDC (HDC hdc);
- /**
- * fn HDC GUIAPI CreatePrivateDC (HWND hwnd)
- * brief Creates a private window DC of a window.
- *
- * This function creates a private window DC of the window a hwnd and returns the handle to the DC.
- *
- * When you calling a CreatePrivateDC function to create a private DC, MiniGUI will create
- * the DC in the system heap, rather than allocate one from the DC pool. Thus, you can
- * keep up the private DC in the life cycle of the window, and are not needed to release it for
- * using by other windows.
- *
- * param hwnd The handle to the window.
- * return The handle to the DC, HDC_INVALID indicates an error.
- *
- * sa DeletePrivateDC
- */
- HDC GUIAPI CreatePrivateDC (HWND hwnd);
- /**
- * fn HDC GUIAPI CreatePrivateClientDC (HWND hwnd)
- * brief Creates a private client DC of a window.
- *
- * This function creates a private client DC of the window a hwnd
- * and returns the handle to the DC.
- *
- * When you calling a CreatePrivateClientDC function to create a private client DC,
- * MiniGUI will create the DC in the system heap, rather than allocate one from the DC pool.
- * Thus, you can keep up the DC in the life cycle of the window, and are not needed to release
- * it for using by other windows.
- *
- * param hwnd The handle to the window.
- * return The handle to the DC, HDC_INVALID indicates an error.
- *
- * sa DeletePrivateDC
- */
- HDC GUIAPI CreatePrivateClientDC (HWND hwnd);
- /**
- * fn HDC GUIAPI GetPrivateClientDC (HWND hwnd)
- * brief Returns the private client DC of a window.
- *
- * This function returns the private client DC of the window a hwnd which
- * have extended style a WS_EX_USEPRIVATECDC.
- *
- * When a main window have the extended style a WS_EX_USEPRIVATECDC, or a
- * control class have the style a CS_OWNDC, MiniGUI will create a private client DC
- * for this window in the creation progress of the window, and destroy the DC when you
- * destroy the window, and use this private client DC in default message handlers.
- * So there will be some improvments on drawing/repaint performance.
- * You can alos call this function to get the private client DC, and use it to
- * draw anything in your window.
- *
- * param hwnd The handle to the window.
- * return The handle to the private client DC, HDC_INVALID indicates an error.
- *
- * sa CreatePrivateClientDC
- */
- HDC GUIAPI GetPrivateClientDC (HWND hwnd);
- /**
- * fn void GUIAPI DeletePrivateDC (HDC hdc)
- * brief Deletes the DC returned by a CreatePrivateDC or a CreatePrivateClientDC.
- *
- * param hdc The handle to the DC.
- *
- * sa CreatePrivateDC, CreatePrivateClientDC
- */
- void GUIAPI DeletePrivateDC (HDC hdc);
- #ifdef _USE_NEWGAL
- #define MEMDC_FLAG_NONE 0x00000000 /* None. */
- #define MEMDC_FLAG_SWSURFACE 0x00000000 /* DC is in system memory */
- #define MEMDC_FLAG_HWSURFACE 0x00000001 /* DC is in video memory */
- #define MEMDC_FLAG_SRCCOLORKEY 0x00001000 /* Blit uses a source color key */
- #define MEMDC_FLAG_SRCALPHA 0x00010000 /* Blit uses source alpha blending */
- #define MEMDC_FLAG_RLEACCEL 0x00004000 /* Surface is RLE encoded */
- /**
- * fn HDC GUIAPI CreateCompatibleDCEx (HDC hdc, int width, int height)
- * brief Creates a memory DC which is compatible with the specified reference DC.
- *
- * This function creates a memory DC which have the same pixel format
- * as the specified reference DC a hdc. The same pixel format means that the memory DC will have
- * the same pixel depth, the same RGB composition, or the same palette as the reference DC.
- *
- * param hdc The handle to the reference DC.
- * param width The expected width of the result memory DC. If it is zero, the width will
- * be equal to the width of the reference DC.
- * param height The expected height of the result memory DC. If it is zero, the height will
- * be equal to the height of the reference DC.
- * return The handle to the memory DC, HDC_INVALID indicates an error.
- *
- * note Only defined for _USE_NEWGAL.
- *
- * sa CreateCompatibleDC
- */
- HDC GUIAPI CreateCompatibleDCEx (HDC hdc, int width, int height);
- /**
- * fn HDC GUIAPI CreateMemDC (int width, int height, int depth, DWORD flags, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
- * brief Creates a memory DC.
- *
- * This function creates a memory DC which have the specified flags and pixel format.
- *
- * param width The expected width of the result memory DC.
- * param height The expected height of the result memory DC.
- * param depth The expected color depth of the memory DC.
- * param flags The memory DC flags, can be or'ed values of the following flags:
- *
- * - MEMDC_FLAG_SWSURFACEn
- * Creates the surface of memory DC in the system memory.
- * - MEMDC_FLAG_HWSURFACEn
- * Creates the surface of memory DC in the video memory.
- * - MEMDC_FLAG_SRCCOLORKEYn
- * The created memory DC will use a source color key to blit to other DC.
- * - MEMDC_FLAG_SRCALPHAn
- * The created memory DC will use a source alpha blending to blit to other DC.
- * - MEMDC_FLAG_RLEACCELn
- * The memory DC will be RLE encoded
- *
- * param Rmask The bit-masks of the red components in a pixel value.
- * param Gmask The bit-masks of the green components in a pixel value.
- * param Bmask The bit-masks of the blue components in a pixel value.
- * param Amask The bit-masks of the alpha components in a pixel value.
- * return The handle to the memory DC, HDC_INVALID indicates an error.
- *
- * note Only defined for _USE_NEWGAL.
- *
- * sa CreateMemDCFromBitmap, CreateMemDCFromMyBitmap, CreateCompatibleDCEx
- */
- HDC GUIAPI CreateMemDC (int width, int height, int depth, DWORD flags,
- Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
- /**
- * fn HDC GUIAPI CreateMemDCFromBitmap (HDC hdc, BITMAP* bmp)
- * brief Creates a memory DC from a reference DC and a BITMAP object.
- *
- * This function creates a memory DC compatible with the
- * specified DC, and use the bits of the BITMAP object as the surface of
- * the memory DC. The created memory DC will have the same geometry as the
- * BITMAP object.
- *
- * param hdc The reference DC.
- * param bmp The BITMAP object.
- * return The handle to the memory DC, HDC_INVALID indicates an error.
- *
- * note Only defined for _USE_NEWGAL.
- *
- * sa CreateMemDCFromMyBitmap, DeleteMemDC, BITMAP
- */
- HDC GUIAPI CreateMemDCFromBitmap (HDC hdc, BITMAP* bmp);
- /**
- * fn HDC GUIAPI CreateMemDCFromMyBitmap (const MYBITMAP* my_bmp, RGB* pal)
- * brief Creates a memory DC from a device independent MYBITMAP object.
- *
- * This function creates a memory DC which have the same
- * pixel format as the MYBITMAP object a my_bmp, and use the bits of
- * the MYBITMAP object as the surface of the memory DC. The created memory DC
- * will have the same geometry as the MYBITMAP object. If the depth of a my_bmp
- * is 8-bit, the function will use a pal to initialize the palette of
- * the memory DC.
- *
- * param my_bmp The device independent MYBITMAP object.
- * param pal The palette of the MYBITMAP object. If the depth of a my_bmp
- * is larger than 8-bit, this argument can be NULL.
- * return The handle to the memory DC, HDC_INVALID indicates an error.
- *
- * note Only defined for _USE_NEWGAL.
- *
- * sa CreateMemDCFromBitmap, DeleteMemDC, MYBITMAP
- */
- HDC GUIAPI CreateMemDCFromMyBitmap (const MYBITMAP* my_bmp, RGB* pal);
- /**
- * fn BOOL GUIAPI ConvertMemDC (HDC mem_dc, HDC ref_dc, DWORD flags)
- * brief Converts a memory DC to have a same format as a reference DC.
- *
- * This function converts a memory DC a mem_dc in order to
- * let it have the same pixel format as the reference DC a ref_dc.
- * This function will try to create a new surface for a mem_dc,
- * and then copies and maps the surface of a ref_dc to it so the blit of
- * the converted memory DC will be as fast as possible.
- *
- * The a flags parameter has the same semantics as a CreateMemDC.
- * You can also pass MEMDC_FLAG_RLEACCEL in the flags parameter and
- * MiniGUI will try to RLE accelerate colorkey and alpha blits in the
- * resulting memory DC.
- *
- * param mem_dc The device context to be converted.
- * param ref_dc The reference device context.
- * param flags The memory DC flags, has the same semantics as a CreateMemDC.
- * return TRUE on success, otherwise FALSE.
- *
- * note Only defined for _USE_NEWGAL.
- *
- * sa CreateMemDC, DeleteMemDC
- */
- BOOL GUIAPI ConvertMemDC (HDC mem_dc, HDC ref_dc, DWORD flags);
- /**
- * fn BOOL GUIAPI SetMemDCAlpha (HDC mem_dc, DWORD flags, Uint8 alpha)
- * brief Sets the alpha value for the entire surface of a DC, as opposed to
- * using the alpha component of each pixel.
- *
- * This function sets the alpha value for the entire surface of the DC a mem_dc,
- * as opposed to using the alpha component of each pixel. This value measures
- * the range of transparency of the surface, 0 being completely transparent to 255
- * being completely opaque. An a alpha value of 255 causes blits to be
- * opaque, the source pixels copied to the destination (the default). Note
- * that per-surface alpha can be combined with colorkey transparency.
- *
- * If a flags is 0, alpha blending is disabled for the surface.
- * If a flags is MEMDC_FLAG_SRCALPHA, alpha blending is enabled for the surface.
- * OR'ing the flag with MEMDC_FLAG_RLEACCEL requests RLE acceleration for the
- * surface; if MEMDC_FLAG_RLEACCEL is not specified, the RLE acceleration
- * will be removed.
- *
- * param mem_dc The device context.
- * param flags The alpha value specific memory DC flags.
- * param alpha the alpha value for the entire surface of the DC a mem_dc.
- * return TRUE on success, otherwise FALSE.
- *
- * note Only defined for _USE_NEWGAL.
- *
- * sa SetMemDCColorKey
- */
- BOOL GUIAPI SetMemDCAlpha (HDC mem_dc, DWORD flags, Uint8 alpha);
- /**
- * fn BOOL GUIAPI SetMemDCColorKey (HDC mem_dc, DWORD flags, Uint32 color_key)
- * brief Sets the color key (transparent pixel) of a memory DC.
- *
- * This function sets the color key (transparent pixel) of the memory DC a mem_dc.
- * If a flags is MEMDC_FLAG_SRCCOLORKEY (optionally OR'ed with MEMDC_FLAG_RLEACCEL),
- * a color_key will be the transparent pixel in the source DC of a blit.
- * MEMDC_FLAG_RLEACCEL requests RLE acceleration for the source of the DC if present,
- * and removes RLE acceleration if absent. If a flags is 0, this function clears
- * any current color key.
- *
- * param mem_dc The device context.
- * param flags The color key specific memory DC flags.
- * param color_key the color_key of the memory DC.
- * return TRUE on success, otherwise FALSE.
- *
- * note Only defined for _USE_NEWGAL.
- *
- * sa SetMemDCAlpha
- */
- BOOL GUIAPI SetMemDCColorKey (HDC mem_dc, DWORD flags, Uint32 color_key);
- /**
- * fn void GUIAPI DeleteMemDC (HDC mem_dc)
- * brief Deletes a memory DC.
- *
- * This function deletes the memory DC a mem_dc, and frees the surface of the DC.
- * For the memory DC created from BITMAP object or MYBITMAP object, the bits used
- * by the surface of the DC will be reserved.
- *
- * param mem_dc The device context to be deleted.
- *
- * note Only defined for _USE_NEWGAL.
- *
- * sa CreateMemDC, CreateMemDCFromBitmap, CreateMemDCFromMyBitmap
- */
- void GUIAPI DeleteMemDC (HDC mem_dc);
- /**
- * def CreateCompatibleDC(hdc)
- * brief Creates a memory DC which is compatible with a given DC.
- *
- * This function creates a memory DC fully compatible with the reference
- * DC a hdc, including pixel format and geomatry.
- *
- * param hdc The reference DC.
- * return The handle to the memory DC, HDC_INVALID indicates an error.
- *
- * note Only defined as macro calling a CreateCompatibleDCEx for _USE_NEWGAL.
- * If _USE_NEWGAL is not defined, a CreateCompatibleDC is defined as
- * a function, and have the same semantics as this macro.
- *
- * sa CreateCompatibleDCEx, DeleteMemDC
- */
- #define CreateCompatibleDC(hdc) CreateCompatibleDCEx(hdc, 0, 0);
- /**
- * def DeleteCompatibleDC(hdc)
- * brief Deletes a memory DC.
- *
- * This function deletes a memory DC created by a CreateCompatibleDC.
- *
- * param hdc The device context to be deleted.
- *
- * note Only defined as macro calling a DeleteMemDC for _USE_NEWGAL.
- * If _USE_NEWGAL is not defined, a DeleteCompatibleDC is defined
- * as a function, and have the same semantics as this macro.
- *
- * sa CreateCompatibleDC, DeleteMemDC
- */
- #define DeleteCompatibleDC(hdc) DeleteMemDC(hdc)
- /**
- * fn Uint8* GUIAPI LockDC (HDC hdc, const RECT* rw_rc, int* width, int* height, int* pitch)
- * brief Locks a dc to get direct access to pixels in the DC.
- *
- * Calling this function will try to lock the DC a hdc to directly access the pixels
- * of the DC. You should tell this function the rectangle to be accessed, and the function
- * will return the effective a width, a height and a pitch of the DC. The access
- * beyond effective width and height will be invalid.
- *
- * Locking a DC which uses screen surface will lock some global objects, such as mouse
- * cursor, and so on. All GDI calls of other threads (in MiniGUI-Threads) or other process
- * (in MiniGUI-Lite) will be blocked as well. So you should call a UnlockDC to unlock
- * the DC as soon as possible, and should not call any system function in the duration of
- * locking the DC.
- *
- * param hdc The handle to the device context.
- * param rw_rc The rectangle in device coordinate system to be accessed in the DC.
- * param width The width of the effective rectangle can access will be returned through
- * this pointer.
- * param height The height of the effective rectangle can access will be returned through
- * this pointer.
- * param pitch The pitch of the scan line of the DC will be returned through this pointer.
- * Pitch means the length of the scan line in bytes.
- * return The bits pointer to the upper-left corner of the effective rectangle, NULL on error.
- *
- * note Only defined for _USE_NEWGAL.
- *
- * sa UnlockDC
- *
- * Example:
- *
- * include lockdc.c
- */
- Uint8* GUIAPI LockDC (HDC hdc, const RECT* rw_rc, int* width, int* height, int* pitch);
- /**
- * fn void GUIAPI UnlockDC (HDC hdc)
- * brief Unlocks a locked DC.
- *
- * param hdc The locked DC.
- *
- * note Only defined for _USE_NEWGAL.
- *
- * sa LockDC
- */
- void GUIAPI UnlockDC (HDC hdc);
- /**
- * defgroup yuv_fns YUV overlay operations
- *
- * For an explanation of common video overlay formats, see:
- *
- * http://www.webartz.com/fourcc/indexyuv.htm
- *
- * For information on the relationship between color spaces, see:
- *
- * http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html
- *
- * @{
- */
- #define GAL_YV12_OVERLAY 0x32315659 /* Planar mode: Y + V + U (3 planes) */
- #define GAL_IYUV_OVERLAY 0x56555949 /* Planar mode: Y + U + V (3 planes) */
- #define GAL_YUY2_OVERLAY 0x32595559 /* Packed mode: Y0+U0+Y1+V0 (1 plane) */
- #define GAL_UYVY_OVERLAY 0x59565955 /* Packed mode: U0+Y0+V0+Y1 (1 plane) */
- #define GAL_YVYU_OVERLAY 0x55595659 /* Packed mode: Y0+V0+Y1+U0 (1 plane) */
- /**
- * The YUV hardware video overlay
- */
- typedef struct GAL_Overlay {
- /** The overlay format, read-only */
- Uint32 format;
- /** The width of the overlay, read-only */
- int w;
- /** The height of the overlay, read-only */
- int h;
- /** The number of the planes of the overlay, read-only */
- int planes;
- /** The pitches of planes, read-only */
- Uint16 *pitches;
- /** The YUV pixels of planse, read-write */
- Uint8 **pixels;
- /* Hardware-specific surface info */
- struct private_yuvhwfuncs *hwfuncs;
- struct private_yuvhwdata *hwdata;
- /** Does This overlay hardware accelerated? */
- Uint32 hw_overlay :1;
- Uint32 UnusedBits :31;
- } GAL_Overlay;
- /**
- * fn GAL_Overlay* GUIAPI CreateYUVOverlay (int width, int height, Uint32 format, HDC hdc)
- * brief Creates a video output overlay on a DC.
- *
- * This function creates a video output overlay on the given DC a hdc.
- * Calling the returned surface an a overlay is something of a misnomer because
- * the contents of the display DC a hdc underneath the area where the overlay
- * is shown is undefined - it may be overwritten with the converted YUV data.
- *
- * param width The expected width of the video overlay.
- * param height The expected height of the video overlay.
- * param format The expected video overlay format, can be one of the following values:
- *
- * - GAL_YV12_OVERLAYn
- * Planar mode: Y + V + U (3 planes)
- * - GAL_IYUV_OVERLAYn
- * Planar mode: Y + U + V (3 planes)
- * - GAL_YUY2_OVERLAYn
- * Packed mode: Y0+U0+Y1+V0 (1 plane)
- * - GAL_UYVY_OVERLAYn
- * Packed mode: U0+Y0+V0+Y1 (1 plane)
- * - GAL_YVYU_OVERLAYn
- * Packed mode: Y0+V0+Y1+U0 (1 plane)
- *
- * param hdc The device context.
- * return A GAL_Overlay object on success, NULL on error.
- *
- * note Only defined for _USE_NEWGAL.
- *
- * sa GAL_LockYUVOverlay, GAL_FreeYUVOverlay, http://www.webartz.com/fourcc/indexyuv.htm
- */
- GAL_Overlay* GUIAPI CreateYUVOverlay (int width, int height,
- Uint32 format, HDC hdc);
- /**
- * fn int GAL_LockYUVOverlay (GAL_Overlay *overlay)
- * brief Locks an overlay for direct access.
- *
- * note Only defined for _USE_NEWGAL.
- *
- * sa GAL_UnlockYUVOverlay
- */
- int GAL_LockYUVOverlay (GAL_Overlay *overlay);
- /**
- * fn void GAL_UnlockYUVOverlay (GAL_Overlay *overlay)
- * brief Unlocks a locked overlay when you are done
- *
- * note Only defined for _USE_NEWGAL.
- *
- * sa GAL_LockYUVOverlay
- */
- void GAL_UnlockYUVOverlay (GAL_Overlay *overlay);
- /**
- * def LockYUVOverlay
- * brief Is an alias of a GAL_LockYUVOverlay
- * sa GAL_LockYUVOverlay
- */
- #define LockYUVOverlay GAL_LockYUVOverlay
- /**
- * def UnlockYUVOverlay
- * brief Is an alias of a GAL_UnlockYUVOverlay
- * sa GAL_UnlockYUVOverlay
- */
- #define UnlockYUVOverlay GAL_UnlockYUVOverlay
- /**
- * fn void GAL_FreeYUVOverlay (GAL_Overlay *overlay)
- * brief Frees a YUV overlay.
- *
- * This function frees a YUV overlay created by a GAL_CreateYUVOverlay.
- *
- * param overlay The video overlay to be freed.
- *
- * note Only defined for _USE_NEWGAL.
- *
- * sa GAL_CreateYUVOverlay
- */
- void GAL_FreeYUVOverlay (GAL_Overlay *overlay);
- /**
- * def FreeYUVOverlay
- * brief Is an alias of a GAL_FreeYUVOverlay
- * sa GAL_FreeYUVOverlay
- */
- #define FreeYUVOverlay GAL_FreeYUVOverlay
- /**
- * fn void GUIAPI DisplayYUVOverlay (GAL_Overlay* overlay, const RECT* dstrect)
- * brief Blits a video overlay to the screen.
- *
- * Calling this function will blit the video overly a overlay to the screen.
- * The contents of the video surface underneath the blit destination are
- * not defined. The width and height of the destination rectangle may be
- * different from that of the overlay, but currently only 2x scaling is supported.
- * And note that the a dstrect is in screen coordinate system.
- *
- * param overlay The video overlay to be displayed.
- * param dstrect The destination rectangle. It may be different from that of
- * the overlay, but currently only 2x scaling is supported
- *
- * note Only defined for _USE_NEWGAL.
- *
- * sa GAL_CreateYUVOverlay, GAL_LockYUVOverlay
- */
- void GUIAPI DisplayYUVOverlay (GAL_Overlay* overlay, const RECT* dstrect);
- /** @} end of yuv_fns */
- /**
- * defgroup gamma_fns Gamma correction functions
- * @{
- */
- /**
- * fn int GAL_SetGamma (float red, float green, float blue)
- * brief Sets the gamma correction for each of the color channels.
- *
- * This function sets the gamma correction for each of the color channels.
- * The gamma values range (approximately) between 0.1 and 10.0.
- * If this function isn't supported directly by the hardware, it will
- * be emulated using gamma ramps, if available.
- *
- * param red The gamma correction value of red channel.
- * param green The gamma correction value of green channel.
- * param blue The gamma correction value of blue channel.
- * return If successful, this function returns 0, otherwise it returns -1.
- *
- * note Only defined for _USE_NEWGAL.
- *
- * sa GAL_SetGammaRamp
- */
- int GAL_SetGamma (float red, float green, float blue);
- /**
- * def SetGamma
- * brief Is an alias of a GAL_SetGamma
- * sa GAL_SetGamma
- */
- #define SetGamma GAL_SetGamma
- /**
- * fn int GAL_SetGammaRamp (Uint16 *red, Uint16 *green, Uint16 *blue)
- * brief Sets the gamma translation table for the red, green, and blue channels of the video hardware.
- *
- * This function sets the gamma translation table for the red, green, and blue channels of the video hardware.
- * Each table is an array of 256 16-bit quantities, representing a mapping
- * between the input and output for that channel. The input is the index into
- * the array, and the output is the 16-bit gamma value at that index, scaled
- * to the output color precision.
- *
- * You may pass NULL for any of the channels to leave it unchanged.
- *
- * param red The gamma translation table for the red channel.
- * param green The gamma translation table for the green channel.
- * param blue The gamma translation table for the blue channel.
- * return If the call succeeds, it will return 0. If the display driver or hardware does
- * not support gamma translation, or otherwise fails, this function will return -1.
- *
- * note Only defined for _USE_NEWGAL.
- *
- * sa GAL_GetGammaRamp, GAL_SetGamma
- */
- int GAL_SetGammaRamp (Uint16 *red, Uint16 *green, Uint16 *blue);
- /**
- * def SetGammaRamp
- * brief Is an alias of a GAL_SetGammaRamp
- * sa GAL_SetGammaRamp
- */
- #define SetGammaRamp GAL_SetGammaRamp
- /**
- * fn int GAL_GetGammaRamp (Uint16 *red, Uint16 *green, Uint16 *blue)
- * brief Retrieves the current values of the gamma translation tables.
- *
- * This function retrives the current values of the gamma translationn tables.
- * You must pass in valid pointers to arrays of 256 16-bit quantities.
- * Any of the pointers may be NULL to ignore that channel.
- *
- * param red Pointers to the array of gamma translation tables for the red channel.
- * param green Pointers to the array of gamma translation tables for the green channel.
- * param blue Pointers to the array of gamma translation tables for the blue channel.
- * return If the call succeeds, it will return 0. If the display driver or
- * hardware does not support gamma translation, or otherwise fails,
- * this function will return -1.
- *
- * note Only defined for _USE_NEWGAL.
- *
- * sa GAL_SetGammaRamp
- */
- int GAL_GetGammaRamp (Uint16 *red, Uint16 *green, Uint16 *blue);
- /**
- * def GetGammaRamp
- * brief Is an alias of a GAL_GetGammaRamp
- * sa GAL_GetGammaRamp
- */
- #define GetGammaRamp GAL_GetGammaRamp
- /** @} end of gamma_fns */
- #else
- HDC GUIAPI CreateCompatibleDC (HDC hdc);
- void GUIAPI DeleteCompatibleDC (HDC hdc);
- #endif /* _USE_NEWGAL */
- /** @} end of dc_fns */
- /**
- * defgroup dc_attrs DC attribute operations
- * @{
- */
- #define BM_TRANSPARENT 1
- #define BM_OPAQUE 0
- #ifdef _USE_NEWGAL
- #define DC_ATTR_BK_COLOR 0
- #define DC_ATTR_BK_MODE 1
- #define DC_ATTR_PEN_COLOR 2
- #define DC_ATTR_BRUSH_COLOR 3
- #define DC_ATTR_TEXT_COLOR 4
- #define DC_ATTR_TAB_STOP 5
- #define DC_ATTR_CHAR_EXTRA 6
- #define DC_ATTR_ALINE_EXTRA 7
- #define DC_ATTR_BLINE_EXTRA 8
- #define DC_ATTR_MAP_MODE 9
- #ifdef _ADV_2DAPI
- #define DC_ATTR_PEN_TYPE 10
- #define DC_ATTR_PEN_CAP_STYLE 11
- #define DC_ATTR_PEN_JOIN_STYLE 12
- #define DC_ATTR_PEN_WIDTH 13
- #define DC_ATTR_BRUSH_TYPE 14
- #define NR_DC_ATTRS 15
- #else
- #define NR_DC_ATTRS 10
- #endif
- /**
- * fn Uint32 GUIAPI GetDCAttr (HDC hdc, int attr)
- * brief Gets a specified attribute value of a DC.
- *
- * This function retrives a specified attribute value of the DC a hdc.
- *
- * param hdc The device context.
- * param attr The attribute to be retrived, can be one of the following values:
- *
- * - DC_ATTR_BK_COLORn
- * Background color.
- * - DC_ATTR_BK_MODEn
- * Background mode.
- * - DC_ATTR_PEN_TYPEn
- * Pen type.
- * - DC_ATTR_PEN_CAP_STYLEn
- * Cap style of pen.
- * - DC_ATTR_PEN_JOIN_STYLEn
- * Join style of pen.
- * - DC_ATTR_PEN_COLORn
- * Pen color.
- * - DC_ATTR_BRUSH_TYPEn
- * Brush type.
- * - DC_ATTR_BRUSH_COLORn
- * Brush color.
- * - DC_ATTR_TEXT_COLORn
- * Text color.
- * - DC_ATTR_TAB_STOPn
- * Tabstop width.
- *
- * return The attribute value.
- *
- * note Only defined for _USE_NEWGAL.
- *
- * sa SetDCAttr
- */
- Uint32 GUIAPI GetDCAttr (HDC hdc, int attr);
- /**
- * fn Uint32 GUIAPI SetDCAttr (HDC hdc, int attr, Uint32 value)
- * brief Sets a specified attribute value of a DC.
- *
- * This function sets a specified attribute value of the DC a hdc.
- *
- * param hdc The device context.
- * param attr The attribute to be set.
- * param value The attribute value.
- * return The old attribute value.
- *
- * note Only defined for _USE_NEWGAL.
- *
- * sa GetDCAttr
- */
- Uint32 GUIAPI SetDCAttr (HDC hdc, int attr, Uint32 value);
- /**
- * def GetBkColor(hdc)
- * brief Gets the background color of a DC.
- *
- * param hdc The device context.
- * return The background pixel value of the DC a hdc.
- *
- * note Defined as a macro calling a GetDCAttr for _USE_NEWGAL.
- * If _USE_NEWGAL is not defined, a GetBkColor is defined as
- * a function, and have the same semantics as this macro.
- *
- * sa GetDCAttr, SetBkColor
- */
- #define GetBkColor(hdc) (gal_pixel) GetDCAttr (hdc, DC_ATTR_BK_COLOR)
- /**
- * def GetBkMode(hdc)
- * brief Gets the background mode of a DC.
- *
- * param hdc The device context.
- * return The background mode of the DC a hdc.
- *
- * retval BM_TRANSPARENT Indicate that reserve the background untouched when draw text.
- * retval BM_OPAQUE Indicate that erase the background with background color when draw text.
- *
- * note Defined as a macro calling a GetDCAttr for _USE_NEWGAL.
- * If _USE_NEWGAL is not defined, a GetBkMode is defined as
- * a function, and have the same semantics as this macro.
- *
- * sa GetDCAttr, SetBkMode
- */
- #define GetBkMode(hdc) (int) GetDCAttr (hdc, DC_ATTR_BK_MODE)
- /**
- * def GetPenColor(hdc)
- * brief Gets the pen color of a DC.
- *
- * param hdc The device context.
- * return The pen color (pixel value) of the DC a hdc.
- *
- * note Defined as a macro calling a GetDCAttr for _USE_NEWGAL.
- * If _USE_NEWGAL is not defined, a GetPenColor is defined as
- * a function, and have the same semantics as this macro.
- *
- * sa GetDCAttr, SetPenColor
- */
- #define GetPenColor(hdc) (gal_pixel) GetDCAttr (hdc, DC_ATTR_PEN_COLOR)
- /**
- * def GetBrushColor(hdc)
- * brief Gets the brush color of a DC.
- *
- * param hdc The device context.
- * return The brush color (pixel value) of the DC a hdc.
- *
- * note Defined as a macro calling a GetDCAttr for _USE_NEWGAL.
- * If _USE_NEWGAL is not defined, a GetBrushColor is defined as
- * a function, and have the same semantics as this macro.
- *
- * sa GetDCAttr, SetBrushColor
- */
- #define GetBrushColor(hdc) (gal_pixel) GetDCAttr (hdc, DC_ATTR_BRUSH_COLOR)
- /**
- * def GetTextColor(hdc)
- * brief Gets the text color of a DC.
- *
- * param hdc The device context.
- * return The text color (pixel value) of the DC a hdc.
- *
- * note Defined as a macro calling a GetDCAttr for _USE_NEWGAL.
- * If _USE_NEWGAL is not defined, a GetTextColor is defined as
- * a function, and have the same semantics as this macro.
- *
- * sa GetDCAttr, SetTextColor
- */
- #define GetTextColor(hdc) (gal_pixel) GetDCAttr (hdc, DC_ATTR_TEXT_COLOR)
- /**
- * def GetTabStop(hdc)
- * brief Gets the tabstop value of a DC.
- *
- * param hdc The device context.
- * return The tabstop value of the DC a hdc.
- *
- * note Defined as a macro calling a GetDCAttr for _USE_NEWGAL.
- * If _USE_NEWGAL is not defined, a GetTabStop is defined as
- * a function, and have the same semantics as this macro.
- *
- * sa GetDCAttr, SetTabStop
- */
- #define GetTabStop(hdc) (int) GetDCAttr (hdc, DC_ATTR_TAB_STOP)
- /**
- * def SetBkColor(hdc, color)
- * brief Sets the background color of a DC to a new value.
- *
- * param hdc The device context.
- * param color The new background color (pixel value).
- * return The old background pixel value of the DC a hdc.
- *
- * note Defined as a macro calling a SetDCAttr for _USE_NEWGAL.
- * If _USE_NEWGAL is not defined, a SetBkColor is defined as
- * a function, and have the same semantics as this macro.
- *
- * sa SetDCAttr, GetBkColor
- */
- #define SetBkColor(hdc, color) (gal_pixel) SetDCAttr (hdc, DC_ATTR_BK_COLOR, (DWORD) color)
- /**
- * def SetBkMode(hdc, mode)
- * brief Sets the background color of a DC to a new mode.
- *
- * param hdc The device context.
- * param mode The new background mode, be can one of the following values:
- *
- * - BM_TRANSPARENTn
- * Indicate that reserve the background untouched when draw text.
- * - BM_OPAQUEn
- * Indicate that erase the background with background color when draw text.
- *
- * return The old background mode of the DC a hdc.
- *
- * note Defined as a macro calling a SetDCAttr for _USE_NEWGAL.
- * If _USE_NEWGAL is not defined, a SetBkMode is defined as
- * a function, and have the same semantics as this macro.
- *
- * sa SetDCAttr, GetBkMode
- */
- #define SetBkMode(hdc, mode) (int) SetDCAttr (hdc, DC_ATTR_BK_MODE, (DWORD) mode)
- /**
- * def SetPenColor(hdc, color)
- * brief Sets the pen color of a DC to a new value.
- *
- * param hdc The device context.
- * param color The new pen color (pixel value).
- * return The old pen pixel value of the DC a hdc.
- *
- * note Defined as a macro calling a SetDCAttr for _USE_NEWGAL.
- * If _USE_NEWGAL is not defined, a SetPenColor is defined as
- * a function, and have the same semantics as this macro.
- *
- * sa SetDCAttr, GetPenColor
- */
- #define SetPenColor(hdc, color) (gal_pixel) SetDCAttr (hdc, DC_ATTR_PEN_COLOR, (DWORD) color)
- /**
- * def SetBrushColor(hdc, color)
- * brief Sets the brush color of a DC to a new value.
- *
- * param hdc The device context.
- * param color The new brush color (pixel value).
- * return The old brush pixel value of the DC a hdc.
- *
- * note Defined as a macro calling a SetDCAttr for _USE_NEWGAL.
- * If _USE_NEWGAL is not defined, a SetBrushColor is defined as
- * a function, and have the same semantics as this macro.
- *
- * sa SetDCAttr, GetBrushColor
- */
- #define SetBrushColor(hdc, color) (gal_pixel) SetDCAttr (hdc, DC_ATTR_BRUSH_COLOR, (DWORD) color)
- /**
- * def SetTextColor(hdc, color)
- * brief Sets the text color of a DC to a new value.
- *
- * param hdc The device context.
- * param color The new text color (pixel value).
- * return The old text color (pixel value) of the DC a hdc.
- *
- * note Defined as a macro calling a SetDCAttr for _USE_NEWGAL.
- * If _USE_NEWGAL is not defined, a SetTextColor is defined as
- * a function, and have the same semantics as this macro.
- *
- * sa SetDCAttr, GetTextColor
- */
- #define SetTextColor(hdc, color) (gal_pixel) SetDCAttr (hdc, DC_ATTR_TEXT_COLOR, (DWORD) color)
- /**
- * def SetTabStop(hdc, value)
- * brief Sets the tabstop of a DC to a new value.
- *
- * param hdc The device context.
- * param value The new tabstop value in pixels.
- * return The old tabstop value in pixels of the DC a hdc.
- *
- * note Defined as a macro calling a SetDCAttr for _USE_NEWGAL.
- * If _USE_NEWGAL is not defined, a SetTabStop is defined as
- * a function, and have the same semantics as this macro.
- *
- * sa SetDCAttr, GetTabStop
- */
- #define SetTabStop(hdc, value) (int) SetDCAttr (hdc, DC_ATTR_TAB_STOP, (DWORD) value)
- #define ROP_SET 0
- #define ROP_AND 1
- #define ROP_OR 2
- #define ROP_XOR 3
- /**
- * fn int GUIAPI GetRasterOperation (HDC hdc)
- * brief Gets the raster operation of a DC.
- *
- * This function gets the raster operation of the DC a hdc.
- *
- * param hdc The device context.
- * return The current raster operation of the DC a hdc.
- *
- * retval ROP_SET Set to the new pixel value, erase original pixel on the surface.
- * retval ROP_AND AND'd the new pixel value with the original pixel on the surface.
- * retval ROP_OR OR'd the new pixel value with the original pixel on the surface.
- * retval ROP_XOR XOR'd the new pixel value with the original pixel on the surface.
- *
- * note Only defined for _USE_NEWGAL.
- *
- * sa SetRasterOperation
- */
- int GUIAPI GetRasterOperation (HDC hdc);
- /**
- * fn int GUIAPI SetRasterOperation (HDC hdc, int rop)
- * brief Sets the raster operation of a DC to a new value.
- *
- * This function sets the raster operation of the DC a hdc to the new value a rop.
- *
- * param hdc The device context.
- * param rop The new raster operation, can be one of the following values:
- *
- * - ROP_SETn
- * Set to the new pixel value, erase original pixel on the surface.
- * - ROP_ANDn
- * AND'd the new pixel value with the original pixel on the surface.
- * - ROP_ORn
- * OR'd the new pixel value with the original pixel on the surface.
- * - ROP_XORn
- * XOR'd the new pixel value with the original pixel on the surface.
- *
- * return The old raster operation of the DC a hdc.
- *
- * note Only defined for _USE_NEWGAL.
- *
- * sa GetRasterOperation
- */
- int GUIAPI SetRasterOperation (HDC hdc, int rop);
- #else
- gal_pixel GUIAPI GetBkColor (HDC hdc);
- int GUIAPI GetBkMode (HDC hdc);
- gal_pixel GUIAPI GetTextColor (HDC hdc);
- gal_pixel GUIAPI SetBkColor (HDC hdc, gal_pixel color);
- int GUIAPI SetBkMode (HDC hdc, int bkmode);
- gal_pixel GUIAPI SetTextColor (HDC hdc, gal_pixel color);
- int GUIAPI GetTabStop (HDC hdc);
- int GUIAPI SetTabStop (HDC hdc, int new_value);
- /* Pen and brush support */
- gal_pixel GUIAPI GetPenColor (HDC hdc);
- gal_pixel GUIAPI GetBrushColor (HDC hdc);
- gal_pixel GUIAPI SetPenColor (HDC hdc, gal_pixel color);
- gal_pixel GUIAPI SetBrushColor (HDC hdc, gal_pixel color);
- #endif /* _USE_NEWGAL */
- /** @} end of dc_attrs */
- /**
- * defgroup pal_fns Palette operations
- * @{
- */
- #ifdef _USE_NEWGAL
- /**
- * fn BOOL GUIAPI GetPalette (HDC hdc, int start, int len, GAL_Color* cmap)
- * brief Gets palette entries of a DC.
- *
- * This function gets some palette entries of the DC a hdc.
- *
- * param hdc The device context.
- * param start The start entry of palette to be retrived.
- * param len The length of entries to be retrived.
- * param cmap The buffer receives the palette entries.
- * return TRUE on success, otherwise FALSE.
- *
- * sa SetPalette
- */
- BOOL GUIAPI GetPalette (HDC hdc, int start, int len, GAL_Color* cmap);
- /**
- * fn BOOL GUIAPI SetPalette (HDC hdc, int start, int len, GAL_Color* cmap)
- * brief Sets palette entries of a DC.
- *
- * This function sets some palette entries of the DC a hdc.
- *
- * param hdc The device context.
- * param start The start entry of palette to be set.
- * param len The length of entries to be set.
- * param cmap Pointer to the palette entries.
- * return TRUE on success, otherwise FALSE.
- *
- * sa GetPalette
- */
- BOOL GUIAPI SetPalette (HDC hdc, int start, int len, GAL_Color* cmap);
- /**
- * fn BOOL GUIAPI SetColorfulPalette (HDC hdc)
- * brief Sets a DC with colorfule palette.
- *
- * This function sets the DC specified by a hdc with colorful palette.
- *
- * param hdc The device context.
- * return TRUE on success, otherwise FALSE.
- *
- * sa SetPalette
- */
- BOOL GUIAPI SetColorfulPalette (HDC hdc);
- #else
- int GUIAPI GetPalette (HDC hdc, int start, int len, GAL_Color* cmap);
- int GUIAPI SetPalette (HDC hdc, int start, int len, GAL_Color* cmap);
- int GUIAPI SetColorfulPalette (HDC hdc);
- #endif /* _USE_NEWGAL */
- /** @} end of pal_fns */
- /**
- * defgroup draw_fns General drawing functions
- * @{
- */
- #ifdef _USE_NEWGAL
- /**
- * fn void GUIAPI SetPixel (HDC hdc, int x, int y, gal_pixel pixel)
- * brief Sets the pixel with a new pixel value at the specified position on a DC.
- *
- * This function sets the pixel with a pixel value a pixel at the specified position a (x,y)
- * on the DC a hdc. You can the pre-defined standard system pixel values.
- *
- * param hdc The device context.
- * param x x,y: The pixel position.
- * param y x,y: The pixel position.
- * param pixel The pixel value.
- *
- * sa GetPixel, color_vars
- */
- void GUIAPI SetPixel (HDC hdc, int x, int y, gal_pixel pixel);
- /**
- * fn gal_pixel GUIAPI SetPixelRGB (HDC hdc, int x, int y, Uint8 r, Uint8 g, Uint8 b)
- * brief Sets the pixel by a RGB triple at the specified position on a DC.
- *
- * This function sets the pixel with a RGB triple a (r,g,b) at the specified position a (x,y)
- * on the DC a hdc.
- *
- * param hdc The device context.
- * param x x,y: The pixel position.
- * param y x,y: The pixel position.
- * param r The red component of a color.
- * param g The green component of a color.
- * param b The blue component of a color.
- * return The pixel value of the RGB triple.
- *
- * sa GetPixel, RGB2Pixel
- */
- gal_pixel GUIAPI SetPixelRGB (HDC hdc, int x, int y, Uint8 r, Uint8 g, Uint8 b);
- /**
- * fn gal_pixel GUIAPI SetPixelRGBA (HDC hdc, int x, int y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
- * brief Sets the pixel by a RGBA quarter at the specified position on a DC.
- *
- * This function sets the pixel with a RGBA quarter a (r,g,b,a) at the specified position a (x,y)
- * on the DC a hdc.
- *
- * param hdc The device context.
- * param x x,y: The pixel position.
- * param y x,y: The pixel position.
- * param r The red component of a color.
- * param g The green component of a color.
- * param b The blue component of a color.
- * param a The alpha component of a color.
- * return The pixel value of the RGBA quarter.
- *
- * note Only defined for _USE_NEWGAL.
- *
- * sa GetPixel, RGBA2Pixel
- */
- gal_pixel GUIAPI SetPixelRGBA (HDC hdc, int x, int y, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
- /**
- * fn gal_pixel GUIAPI GetPixel (HDC hdc, int x, int y)
- * brief Gets the pixel value at the specified position on a DC.
- *
- * This function gets the pixel value at the specified position a (x,y) on the DC a hdc.
- *
- * param hdc The device context.
- * param x x,y: The pixel position.
- * param y x,y: The pixel position.
- * return The pixel value.
- *
- * sa SetPixel
- */
- gal_pixel GUIAPI GetPixel (HDC hdc, int x, int y);
- /**
- * fn gal_pixel GUIAPI GetPixelRGB (HDC hdc, int x, int y, Uint8* r, Uint8* g, Uint8* b)
- * brief Gets the pixel value at the specified position on a DC in RGB triple.
- *
- * This function gets the pixel value at the specified position a (x,y)
- * on the DC a hdc in RGB triple.
- *
- * param hdc The device context.
- * param x x,y: The pixel position.
- * param y x,y: The pixel position.
- * param r The red component of the pixel will be returned through these pointers.
- * param g The green component of the pixel will be returned through these pointers.
- * param b The blue component of the pixel will be returned through these pointers.
- * return The pixel value.
- *
- * sa SetPixelRGB
- */
- gal_pixel GUIAPI GetPixelRGB (HDC hdc, int x, int y, Uint8* r, Uint8* g, Uint8* b);
- /**
- * fn gal_pixel GUIAPI GetPixelRGBA (HDC hdc, int x, int y, Uint8* r, Uint8* g, Uint8* b, Uint8* a)
- * brief Gets the pixel value at the specified position on a DC in RGBA quarter.
- *
- * This function gets the pixel value at the specified position a (x,y) on the DC a hdc
- * in RGBA quarter.
- *
- * param hdc The device context.
- * param x x,y: The pixel position.
- * param y x,y: The pixel position.
- * param r The red component of the pixel will be returned through these pointers.
- * param g The green component of the pixel will be returned through these pointers.
- * param b The blue component of the pixel will be returned through these pointers.
- * param a The alpha component of the pixel will be returned through these pointers.
- * return The pixel value.
- *
- * sa SetPixelRGBA
- */
- gal_pixel GUIAPI GetPixelRGBA (HDC hdc, int x, int y, Uint8* r, Uint8* g, Uint8* b, Uint8* a);
- /**
- * fn gal_pixel GUIAPI RGBA2Pixel (HDC hdc, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
- * brief Gets the pixel value from a color in RGBA quarter under a DC.
- *
- * This function gets the pixel value from the RGB quarter a (r,g,b,a) under the DC a hdc.
- *
- * param hdc The device context.
- * param r The red component of a color.
- * param g The green component of a color.
- * param b The blue component of a color.
- * param a The alpha component of a color.
- * return The pixel value.
- *
- * note Only defined for _USE_NEWGAL.
- *
- * sa Pixel2RGBA
- */
- gal_pixel GUIAPI RGBA2Pixel (HDC hdc, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
- /**
- * fn gal_pixel GUIAPI RGB2Pixel (HDC hdc, Uint8 r, Uint8 g, Uint8 b)
- * brief Gets the pixel value from a color in RGB triple under a DC.
- *
- * This function gets the pixel value from the RGB triple a (r,g,b) under the DC a hdc.
- *
- * param hdc The device context.
- * param r The red component of a color.
- * param g The green component of a color.
- * param b The blue component of a color.
- * return The pixel value.
- *
- * sa Pixel2RGB
- */
- gal_pixel GUIAPI RGB2Pixel (HDC hdc, Uint8 r, Uint8 g, Uint8 b);
- /**
- * fn void GUIAPI Pixel2RGB (HDC hdc, gal_pixel pixel, Uint8* r, Uint8* g, Uint8* b)
- * brief Gets the color in RGB triple from a pixel value under a DC.
- *
- * This function gets the color in RGB triple from the pixel value a pixel under the DC a hdc.
- *
- * param hdc The device context.
- * param pixel The pixel value.
- * param r The red component of the pixel will be returned through this pointer.
- * param g The green component of the pixel will be returned through this pointer.
- * param b The blue component of the pixel will be returned through this pointer.
- * return The pixel value.
- *
- * note Only defined for _USE_NEWGAL.
- *
- * sa RGB2Pixel
- */
- void GUIAPI Pixel2RGB (HDC hdc, gal_pixel pixel, Uint8* r, Uint8* g, Uint8* b);
- /**
- * fn void GUIAPI Pixel2RGBA (HDC hdc, gal_pixel pixel, Uint8* r, Uint8* g, Uint8* b, Uint8* a)
- * brief Gets the color in RGBA quarter from a pixel value under a DC.
- *
- * This function gets the color in RGBA quarter from the pixel value a pixel under the DC a hdc.
- *
- * param hdc The device context.
- * param pixel The pixel value.
- * param r The red component of the pixel will be returned through this pointer.
- * param g The green component of the pixel will be returned through this pointer.
- * param b The blue component of the pixel will be returned through this pointer.
- * param a The alpha component of the pixel will be returned through this pointer.
- * return The pixel value.
- *
- * note Only defined for _USE_NEWGAL.
- *
- * sa RGB2Pixel
- */
- void GUIAPI Pixel2RGBA (HDC hdc, gal_pixel pixel, Uint8* r, Uint8* g, Uint8* b, Uint8* a);
- #else
- void GUIAPI SetPixel (HDC hdc, int x, int y, gal_pixel c);
- void GUIAPI SetPixelRGB (HDC hdc, int x, int y, int r, int g, int b);
- gal_pixel GUIAPI GetPixel (HDC hdc, int x, int y);
- void GUIAPI GetPixelRGB (HDC hdc, int x, int y, int* r, int* g, int* b);
- gal_pixel GUIAPI RGB2Pixel (HDC hdc, int r, int g, int b);
- #endif /* USE_NEWGAL */
- /**
- * fn void GUIAPI FocusRect (HDC hdc, int x0, int y0, int x1, int y1)
- * brief Draws a focus rectangle.
- *
- * This function uses XOR mode to draw the focus rectangle on the device context, i.e.
- * calling this function then calling this function with same arguments again
- * will erase the focus rectangle and restore the pixels before the first call.
- *
- * param hdc The device context.
- * param x0 x0,y0: The coordinates of upper-left corner of the rectangle.
- * param y0 x0,y0: The coordinates of upper-left corner of the rectangle.
- * param x1 x1,y1: The corrdinates of lower-right corner of the rectangle.
- * param y1 x1,y1: The corrdinates of lower-right corner of the rectangle.
- *
- * sa DrawHVDotLine
- */
- void GUIAPI FocusRect (HDC hdc, int x0, int y0, int x1, int y1);
- /**
- * fn void GUIAPI DrawHVDotLine (HDC hdc, int x, int y, int w_h, BOOL H_V)
- * brief Draws a horizontal or vertical dot dash line.
- *
- * This function draws a horizontal or vertical dot dash line with
- * the zero pen.
- *
- * param hdc The device context.
- * param x x,y: The start point of the line.
- * param y x,y: The start point of the line.
- * param w_h The width of the line or horizontal dot line, or the height
- * if you want to draw a vertical dot line.
- * param H_V Specify whether you want to draw a horizontal or vertical line.
- * TRUE for horizontal, FALSE for vertical.
- *
- * sa FocusRect
- */
- void GUIAPI DrawHVDotLine (HDC hdc, int x, int y, int w_h, BOOL H_V);
- /**
- * def DrawHDotLine(hdc, x, y, w)
- * brief Draws a horizontal dot dash line.
- *
- * This function draws a horizontal dot dash line with
- * the zero pen.
- *
- * param hdc The device context.
- * param x x,y: The start point of the line.
- * param y x,y: The start point of the line.
- * param w The width of the horizontal dot line.
- *
- * note Defined as a macro calling DrawHVDotLine.
- *
- * sa DrawVDotLine, DrawHVDotLine
- */
- #define DrawHDotLine(hdc, x, y, w) DrawHVDotLine (hdc, x, y, w, TRUE);
- /**
- * def DrawVDotLine(hdc, x, y, h)
- * brief Draws a vertical dot line.
- *
- * This function draws a vertical dot dash line with
- * the zero pen.
- *
- * param hdc The device context.
- * param x x,y: The start point of the line.
- * param y x,y: The start point of the line.
- * param h The height of the horizontal dot line.
- *
- * note Defined as a macro calling DrawHVDotLine.
- *
- * sa DrawHDotLine, DrawHVDotLine
- */
- #define DrawVDotLine(hdc, x, y, h) DrawHVDotLine (hdc, x, y, h, FALSE);
- #ifdef _USE_NEWGAL
- /**
- * fn BOOL GUIAPI LineClipper (const RECT* cliprc, int *_x0, int *_y0, int *_x1, int *_y1)
- * brief The line clipper using Cohen-Sutherland algorithm.
- *
- * This function clips a line from a (*_x0,*_y0) to a (*_x1, *_y1)
- * with the specified clipping rectangle pointed to by a cliprc. Then return the
- * clipped line throught the pointers a (_x0, _y0, _x1, _y1).
- *
- * It is modified to do pixel-perfect clipping. This means that it
- * will generate the same endpoints that would be drawn if an ordinary
- * Bresenham line-drawer where used and only visible pixels drawn.
- *
- * param cliprc The Pointer to the clipping rectangle.
- * param _x0 _x0,_y0: The pointers contains the start point of the line.
- * The start point after clipping will be returned through them as well as.
- * param _y0 _x0,_y0: The pointers contains the start point of the line.
- * The start point after clipping will be returned through them as well as.
- * param _x1 _x1,_y1: The pointers contains the end point of the line.
- * The end point after clipping will be returned through them as well as.
- * param _y1 _x1,_y1: The pointers contains the end point of the line.
- * The end point after clipping will be returned through them as well as.
- * return TRUE for clipped by the clipping rectangle, FALSE for not clipped.
- *
- * note Only defined for _USE_NEWGAL
- *
- * sa LineGenerator
- */
- BOOL GUIAPI LineClipper (const RECT* cliprc, int *_x0, int *_y0, int *_x1, int *_y1);
- /**
- * var typedef void (* CB_LINE) (void* context, int stepx, int stepy)
- * brief The type of line generator callback.
- */
- typedef void (* CB_LINE) (void* context, int stepx, int stepy);
- /**
- * fn void GUIAPI LineGenerator (void* context, int x1, int y1, int x2, int y2, CB_LINE cb)
- * brief A line generator based-on Breshenham algorithm.
- *
- * This is a Breshenham line generator. When it generates a new point on the line,
- * it will call the callback a cb and pass the context a context and the step values
- * on x-coordinate and y-coodinate since the last point. The first generated point always
- * be the start point you passed to this function. Thus, the first step values passed to
- * a cb will be (0,0).
- *
- * MiniGUI implements a LineTo function by using this generator.
- *
- * param context The context, will be passed to the callback a cb.
- * param x1 x1,y1: The start point of the line.
- * param y1 x1,y1: The start point of the line.
- * param x2 x2,y2: The end point of the line.
- * param y2 x2,y2: The end point of the line.
- * param cb The line generator callback.
- *
- * note Only defined for _USE_NEWGAL
- *
- * sa LineTo, LineClipper, CB_LINE
- */
- void GUIAPI LineGenerator (void* context, int x1, int y1, int x2, int y2, CB_LINE cb);
- /**
- * var typedef void (* CB_CIRCLE) (void* context, int x1, int x2, int y)
- * brief The type of circle generator callback.
- */
- typedef void (* CB_CIRCLE) (void* context, int x1, int x2, int y);
- /**
- * fn void GUIAPI CircleGenerator (void* context, int sx, int sy, int r, CB_CIRCLE cb)
- * brief A circle generator.
- *
- * This is a general circle generator, it will generate two points on the same
- * horizontal scan line at every turn. When it generates the points on the circle,
- * it will call the callback a cb and pass the context a context, the y-coordinate
- * of the scan line, the x-coordinate of the left point on the scan line, and
- * the x-coordinate of the right point. Note that in some cases, the left point and
- * the right point will be the same.
- *
- * MiniGUI implements a Circle, a FillCircle and a InitCircleRegion functions
- * by using this generator.
- *
- * param context The context, will be passed to the callback a cb.
- * param sx sx,sy: The center of the circle.
- * param sy sx,sy: The center of the circle.
- * param r The radius of the circle.
- * param cb The circle generator callback.
- *
- * note Only defined for _USE_NEWGAL
- *
- * sa Circle, FillCircle, InitCircleRegion, CB_CIRCLE
- *
- * Example:
- *
- * include circlegenerator.c
- */
- void GUIAPI CircleGenerator (void* context, int sx, int sy, int r, CB_CIRCLE cb);
- /**
- * var typedef void (* CB_ELLIPSE) (void* context, int x1, int x2, int y)
- * brief The type of ellipse generator callback.
- */
- typedef void (* CB_ELLIPSE) (void* context, int x1, int x2, int y);
- /**
- * fn void GUIAPI EllipseGenerator (void* context, int sx, int sy, int rx, int ry, CB_ELLIPSE cb)
- * brief An ellipse generator.
- *
- * This is a general ellipse generator, it will generate two points on the same
- * horizontal scan line at every turn. When it generates the points on the ellipse,
- * it will call the callback a cb and pass the context a context, the y-coordinate
- * of the scan line, the x-coordinate of the left point on the scan line, and
- * the x-coordinate of the right point. Note that in some cases, the left point and
- * the right point will be the same.
- *
- * MiniGUI implements a Ellipse, a FillEllipse, and a InitEllipseRegion functions
- * by using this generator.
- *
- * param context The context, will be passed to the callback a cb.
- * param sx sx,sy: The center of the ellipse.
- * param sy sx,sy: The center of the ellipse.
- * param rx The x-radius of the ellipse.
- * param ry The y-radius of the ellipse.
- * param cb The ellipse generator callback.
- *
- * note Only defined for _USE_NEWGAL
- *
- * sa Ellipse, FillEllipse, InitEllipseRegion, CB_CIRCLE
- */
- void GUIAPI EllipseGenerator (void* context, int sx, int sy, int rx, int ry, CB_ELLIPSE cb);
- /**
- * var typedef void (* CB_ARC) (void* context, int x, int y)
- * brief The type of arc generator callback.
- */
- typedef void (* CB_ARC) (void* context, int x, int y);
- /**
- * fn void GUIAPI CircleArcGenerator (void* context, int sx, int sy, int r, int ang1, int ang2, CB_ARC cb)
- * brief An arc generator.
- *
- * This is a general arc generator. When it generates a point on the arc,
- * it will call the callback a cb and pass the context a context, the coordinates
- * of the point.
- *
- * MiniGUI implements a CircleArc function by using this generator.
- *
- * param context The context, will be passed to the callback a cb.
- * param sx sx,sy: The center of the arc.
- * param sy sx,sy: The center of the arc.
- * param r The radius of the arc.
- * param ang1 The degree of the start angle, in 1/64ths of a degree.
- * param ang2 The degree of the end angle, in 1/64ths of a degree.
- * param cb The arc generator callback.
- *
- * note Only defined for _USE_NEWGAL
- *
- * sa CircleArc, CB_ARC, fixed_math_fns
- */
- void GUIAPI CircleArcGenerator (void* context, int sx, int sy, int r, int ang1, int ang2, CB_ARC cb);
- /**
- * var typedef void (* CB_POLYGON) (void* context, int x1, int x2, int y)
- * brief The type of polygon generator callback.
- */
- typedef void (* CB_POLYGON) (void* context, int x1, int x2, int y);
- /**
- * fn BOOL GUIAPI MonotoneVerticalPolygonGenerator (void* context, const POINT* pts, int vertices, CB_POLYGON cb)
- * brief A monotone vertical polygon generator.
- *
- * This is a monotone vertical polygon generator.
- *
- * "Monoton vertical" means "monotone with respect to a vertical line";
- * that is, every horizontal line drawn through the polygon at any point
- * would cross exactly two active edges (neither horizontal lines
- * nor zero-length edges count as active edges; both are acceptable
- * anywhere in the polygon). Right & left edges may cross (polygons may be nonsimple).
- * Polygons that are not convex according to this definition won't be drawn properly.
- *
- * You can call a PolygonIsMonotoneVertical function to check one polygon is
- * monotone vertical or not.
- *
- * This function will generate two points on the same horizontal scan line at every turn.
- * When it generates the points on the polygon, it will call the callback a cb and
- * pass the context a context, the y-coordinate of the scan line, the x-coordinate of
- * the left point on the scan line, and the x-coordinate of the right point.
- * Note that in some cases, the left point and the right point will be the same.
- *
- * MiniGUI implements a FillPolygon and a InitPolygonRegion functions
- * by using this generator.
- *
- * param context The context, will be passed to the callback a cb.
- * param pts The pointer to the vertex array of the polygon.
- * param vertices The number of the vertices, i.e. the size of the vertex array.
- * param cb The polygon generator callback.
- * return TRUE on success, FALSE on error.
- *
- * note Only defined for _USE_NEWGAL
- *
- * sa FillPolygon, InitPolygonRegion, PolygonIsMonotoneVertical, CB_CIRCLE
- */
- BOOL GUIAPI MonotoneVerticalPolygonGenerator (void* context, const POINT* pts, int vertices, CB_POLYGON cb);
- /**
- * fn BOOL GUIAPI PolygonIsMonotoneVertical (const POINT* pts, int vertices)
- * brief Checks a polygon is monotone vertical or not.
- *
- * This function checks if the given polygon is monotone vertical.
- *
- * param pts The pointer to the vertex array of the polygon.
- * param vertices The number of the vertices, i.e. the size of the vertex array.
- * return TRUE if it is monotonoe vertical, otherwise FALSE.
- *
- * note Only defined for _USE_NEWGAL
- *
- * sa MonotoneVerticalPolygonGenerator
- */
- BOOL GUIAPI PolygonIsMonotoneVertical (const POINT* pts, int vertices);
- /**
- * fn BOOL GUIAPI PolygonGenerator (void* context, const POINT* pts, int vertices, CB_POLYGON cb)
- * brief A general polygon generator.
- *
- * This is a general polygon generator.
- *
- * This function will generate two points on the same horizontal scan line at every turn.
- * When it generates the points on the polygon, it will call the callback a cb and
- * pass the context a context, the y-coordinate of the scan line, the x-coordinate of
- * the left point on the scan line, and the x-coordinate of the right point.
- * Note that in some cases, the left point and the right point will be the same.
- *
- * MiniGUI implements a FillPolygon and a InitPolygonRegion functions
- * by using this generator.
- *
- * param context The context, will be passed to the callback a cb.
- * param pts The pointer to the vertex array of the polygon.
- * param vertices The number of the vertices, i.e. the size of the vertex array.
- * param cb The polygon generator callback.
- *
- * note Only defined for _USE_NEWGAL
- *
- * sa FillPolygon, InitPolygonRegion, CB_CIRCLE
- */
- BOOL GUIAPI PolygonGenerator (void* context, const POINT* pts, int vertices, CB_POLYGON cb);
- /**
- * var typedef BOOL (* CB_EQUAL_PIXEL) (void* context, int x, int y)
- * brief Flodd filling generator's equation callback.
- */
- typedef BOOL (* CB_EQUAL_PIXEL) (void* context, int x, int y);
- /**
- * var typedef void (* CB_FLOOD_FILL) (void* context, int x1, int x2, int y)
- * brief Flodd filling generator's scan line callback.
- */
- typedef void (* CB_FLOOD_FILL) (void* context, int x1, int x2, int y);
- /**
- * fn 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)
- * brief A flood filling generator.
- *
- * This function is a general flood filling generator.
- *
- * MiniGUI implements a FloodFill function by using this generator.
- *
- * param context The context, will be passed to the callback a cb.
- * param src_rc The filling bounding rectangle.
- * param x x,y: The start filling point.
- * param y x,y: The start filling point.
- * param cb_equal_pixel The callback to check the pixel is equal with the start point or not.
- * param cb_flood_fill The callback to fill a scan line.
- *
- * note Only defined for _USE_NEWGAL
- *
- * sa FloodFill, CB_EQUAL_PIXEL, CB_FLOOD_FILL
- */
- 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);
- /**
- * var typedef void* (* CB_GET_LINE_BUFF) (void* context, int y)
- * brief Bitmap scaler's getting line buffer callback.
- */
- typedef void* (* CB_GET_LINE_BUFF) (void* context, int y);
- /**
- * var typedef void* (* CB_LINE_SCALED) (void* context, const void* line, int y)
- * brief Bitmap scaler's getting line buffer callback.
- */
- typedef void (* CB_LINE_SCALED) (void* context, const void* line, int y);
- /**
- * fn BOOL GUIAPI BitmapDDAScaler (void* context, const BITMAP* src_bmp, int dst_w, int dst_h, CB_GET_LINE_BUFF cb_get_line_buff, CB_LINE_SCALED cb_line_scaled)
- * brief A bitmap scaler using DDA algorithm.
- *
- * This function is a general bitmap scaler using DDA algorithm. This function scales
- * the bitmap from bottom to top.
- *
- * MiniGUI implements ScaleBitmap, FillBoxWithBitmap, FillBoxWithBitmapPart, and
- * StretchBlt functions by using this scaler.
- *
- * param context The context will be passed to the callbacks.
- * param src_bmp The source BITMAP object.
- * param dst_w The width of the destination BITMAP object.
- * param dst_h The height of the destination BITMAP object.
- * param cb_get_line_buff The callback to get the line buffer of the destination BITMAP object.
- * param cb_line_scaled The callback to tell the line is scaled.
- *
- * note Only defined for _USE_NEWGAL
- *
- * sa ScaleBitmap, StretchBlt, BitmapDDAScaler2
- */
- BOOL GUIAPI BitmapDDAScaler (void* context, const BITMAP* src_bmp, int dst_w, int dst_h,
- CB_GET_LINE_BUFF cb_get_line_buff, CB_LINE_SCALED cb_line_scaled);
- /**
- * fn BOOL GUIAPI BitmapDDAScaler2 (void* context, const BITMAP* src_bmp, int dst_w, int dst_h, CB_GET_LINE_BUFF cb_get_line_buff, CB_LINE_SCALED cb_line_scaled)
- * brief A bitmap scaler using DDA algorithm.
- *
- * This function is a general bitmap scaler using DDA algorithm. This function scales
- * the bitmap from bottom to top.
- *
- * MiniGUI implements StretchBlt functions by using this scaler.
- *
- * param context The context will be passed to the callbacks.
- * param src_bmp The source BITMAP object.
- * param dst_w The width of the destination BITMAP object.
- * param dst_h The height of the destination BITMAP object.
- * param cb_get_line_buff The callback to get the line buffer of the destination BITMAP object.
- * param cb_line_scaled The callback to tell the line is scaled.
- *
- * note Only defined for _USE_NEWGAL
- *
- * sa ScaleBitmap, StretchBlt, BitmapDDAScaler
- */
- BOOL GUIAPI BitmapDDAScaler2 (void* context, const BITMAP* src_bmp, int dst_w, int dst_h,
- CB_GET_LINE_BUFF cb_get_line_buff, CB_LINE_SCALED cb_line_scaled);
- /**
- * fn void GUIAPI MoveTo (HDC hdc, int x, int y)
- * brief Moves the current zero pen position.
- *
- * This function moves the current pen position of the DC a hdc to a (x,y).
- * The next line or other pen drawing operation will start from the position.
- *
- * param hdc The device context.
- * param x x,y: The new pen position.
- * param y x,y: The new pen position.
- *
- * sa LineTo
- */
- void GUIAPI MoveTo (HDC hdc, int x, int y);
- /**
- * fn void GUIAPI LineTo (HDC hdc, int x, int y)
- * brief Draws a zero line to a position.
- *
- * This function draws a line from the current zero pen position to a (x,y),
- * and then moves the zero pen position to a (x,y) by using the zero pen.
- * The next zero line drawing operation will start from the position.
- *
- * param hdc The device context.
- * param x x,y: The end point of the line.
- * param y x,y: The end point of the line.
- *
- * sa MoveTo, LineGenerator, dc_attrs
- */
- void GUIAPI LineTo (HDC hdc, int x, int y);
- /**
- * fn void GUIAPI Rectangle (HDC hdc, int x0, int y0, int x1, int y1)
- * brief Draws a rectangle.
- *
- * This function draws a rectangle by using a MoveTo and a LineTo.
- * The current zero pen position after calling this function will be a (x1,y1).
- *
- * param hdc The device context.
- * param x0 x0,y0: The coordinates of the upper-left corner of the rectangle.
- * param y0 x0,y0: The coordinates of the upper-left corner of the rectangle.
- * param x1 x1,y1: The coordinates of the lower-right corner of the rectangle.
- * param y1 x1,y1: The coordinates of the lower-right corner of the rectangle.
- *
- * sa MoveTo, LineTo
- */
- void GUIAPI Rectangle (HDC hdc, int x0, int y0, int x1, int y1);
- /**
- * fn void GUIAPI PolyLineTo (HDC hdc, const POINT* pts, int vertices)
- * brief Draws a polyline.
- *
- * This function draws a polyline by using a MoveTo and a LineTo.
- * The current zero pen position after calling this function will be the
- * last vertex of the polyline.
- *
- * param hdc The device context.
- * param pts The pointer to the vertex array of the polyline.
- * param vertices The number of the vertices.
- *
- * sa MoveTo, LineTo
- */
- void GUIAPI PolyLineTo (HDC hdc, const POINT* pts, int vertices);
- /**
- * fn void GUIAPI SplineTo (HDC hdc, const POINT* pts)
- * brief Draws a bezier spline.
- *
- * This function draws a bezier spline by using a MoveTo and a LineTo.
- * The current pen position after calling this function will be the
- * last control point of the spline. Note that the number of the
- * control points should always be 4.
- *
- * param hdc The device context.
- * param pts The pointer to the control point array of the spline.
- *
- * note Only defined for _USE_NEWGAL
- *
- * sa MoveTo, LineTo
- */
- void GUIAPI SplineTo (HDC hdc, const POINT* pts);
- /**
- * fn void GUIAPI Circle (HDC hdc, int sx, int sy, int r)
- * brief Draws a circle.
- *
- * This function draws a circle with the zero pen on the DC a hdc.
- * The center of the circle is at a (sx, sy), and the radius is a r.
- *
- * param hdc The device context.
- * param sx sx,sy: The center of the circle.
- * param sy sx,sy: The center of the circle.
- * param r The radius of the circle.
- *
- * sa CircleGenerator
- */
- void GUIAPI Circle (HDC hdc, int sx, int sy, int r);
- /**
- * fn void GUIAPI Ellipse (HDC hdc, int sx, int sy, int rx, int ry)
- * brief Draws a ellipse.
- *
- * This function draws an ellipse with the zero pen on the DC a hdc.
- * The center of the ellipse is at a (sx, sy), the x-coordinate radius is a rx,
- * and the y-coordinate radius is a ry.
- *
- * param hdc The device context.
- * param sx sx,sy: The center of the ellipse.
- * param sy sx,sy: The center of the ellipse.
- * param rx The x-coordinate radius of the ellipse.
- * param ry The y-coordinate radius of the ellipse.
- *
- * note Only defined for _USE_NEWGAL
- *
- * sa EllipseGenerator, dc_attrs
- */
- void GUIAPI Ellipse (HDC hdc, int sx, int sy, int rx, int ry);
- /**
- * fn void GUIAPI CircleArc (HDC hdc, int sx, int sy, int r, int ang1, int ang2)
- * brief Draws an arc.
- *
- * This function draws an arc with the zero pen on the DC a hdc.
- * The center of the arc is at a (sx, sy), the radius is a r,
- * and the radians of start angle and end angle are a ang1 and a ang2 respectively.
- *
- * param hdc The device context.
- * param sx sx,sy: The center of the arc.
- * param sy sx,sy: The center of the arc.
- * param r The radius of the arc.
- * param ang1 The degree of start angle, in 1/64ths of a degree.
- * param ang2 The degree of end angle, in 1/64ths of a degree.
- *
- * note Only defined for _USE_NEWGAL
- *
- * sa CircleArcGenerator, fixed_math_fns, dc_attrs
- */
- void GUIAPI CircleArc (HDC hdc, int sx, int sy, int r, int ang1, int ang2);
- /**
- * fn void GUIAPI FillBox (HDC hdc, int x, int y, int w, int h)
- * brief Fills a rectangle box.
- *
- * This function fills a box with the current brush in the DC a hdc.
- * Note that MiniGUI only defined the color property for the brush objects so far.
- *
- * param hdc The device context.
- * param x x,y: The coorinates of the upper-left corner of the box.
- * param y x,y: The coorinates of the upper-left corner of the box.
- * param w The width of the box.
- * param h The height of the box.
- *
- * sa dc_attrs
- */
- void GUIAPI FillBox (HDC hdc, int x, int y, int w, int h);
- /**
- * fn void GUIAPI FillCircle (HDC hdc, int sx, int sy, int r)
- * brief Fills a circle.
- *
- * This function fills a circle with the current brush in the DC a hdc.
- * Note that MiniGUI only defined the color property for the brush objects so far.
- *
- * param hdc The device context.
- * param sx sx,sy: The center of the circle.
- * param sy sx,sy: The center of the circle.
- * param r The radius of the circle.
- *
- * note Only defined for _USE_NEWGAL
- *
- * sa CircleGenerator, dc_attrs
- */
- void GUIAPI FillCircle (HDC hdc, int sx, int sy, int r);
- /**
- * fn void GUIAPI FillEllipse (HDC hdc, int sx, int sy, int rx, int ry)
- * brief Fills an ellipse.
- *
- * This function fills an ellipse with the current brush in the DC a hdc.
- * Note that MiniGUI only defined the color property for the brush objects so far.
- *
- * param hdc The device context.
- * param sx sx,sy: The center of the circle.
- * param sy sx,sy: The center of the circle.
- * param rx The x-coordinate radius of the ellipse.
- * param ry The y-coordinate radius of the ellipse.
- *
- * note Only defined for _USE_NEWGAL
- *
- * sa EllipseGenerator, dc_attrs
- */
- void GUIAPI FillEllipse (HDC hdc, int sx, int sy, int rx, int ry);
- /**
- * fn BOOL GUIAPI FillPolygon (HDC hdc, const POINT* pts, int vertices)
- * brief Fills an polygon.
- *
- * This function fills a polygon with the current brush in the DC a hdc.
- * Note that MiniGUI only defined the color property for the brush objects so far.
- *
- * param hdc The device context.
- * param pts The pointer to the vertex array of the polygon.
- * param vertices The number of the vertices, i.e. the size of the vertex array.
- *
- * note Only defined for _USE_NEWGAL
- *
- * sa PolygonGenerator, dc_attrs
- */
- BOOL GUIAPI FillPolygon (HDC hdc, const POINT* pts, int vertices);
- /**
- * fn BOOL GUIAPI FloodFill (HDC hdc, int x, int y)
- * brief Fills an enclosed area starting at point a (x,y).
- *
- * This function fills an enclosed area staring at point a (x,y), and
- * stops when encountering a pixel different from the start point.
- *
- * param hdc The device context.
- * param x x,y: The start point.
- * param y x,y: The start point.
- *
- * note Only defined for _USE_NEWGAL
- *
- * sa FloodFillGenerator, dc_attrs
- */
- BOOL GUIAPI FloodFill (HDC hdc, int x, int y);
- #ifdef _ADV_2DAPI
- /**
- * addtogroup draw_adv_2d_fns Advanced 2-Dimension graphics functions.
- * @{
- */
- /**
- * DC Line styles
- */
- typedef enum
- {
- /**
- * The solid pen.
- * We call the solid pen with zero wide as "zero pen".
- */
- PT_SOLID,
- /**
- * The on/off dash pen, even segments are drawn;
- * odd segments are not drawn.
- */
- PT_ON_OFF_DASH,
- /**
- * The double dash pen, even segments are normally.
- * Odd segments are drawn in the brush color if
- * the brush type is BT_SOLID, or in the brush color
- * masked by the stipple if the brush type is BT_STIPPLED.
- */
- PT_DOUBLE_DASH,
- } PenType;
- /**
- * def GetPenType (hdc)
- * brief Gets the pen type of a DC.
- *
- * param hdc The device context.
- * return The pen type of the DC a hdc.
- *
- * note Defined as a macro calling a GetDCAttr for _USE_NEWGAL.
- *
- * sa PenType, GetDCAttr, SetPenType
- */
- #define GetPenType(hdc) (PenType) GetDCAttr (hdc, DC_ATTR_PEN_TYPE)
- /**
- * def SetPenType(hdc, type)
- * brief Sets the pen type of a DC to a new type.
- *
- * param hdc The device context.
- * param type The new pen type.
- * return The old pen type of the DC a hdc.
- *
- * note Defined as a macro calling a SetDCAttr for _USE_NEWGAL.
- *
- * sa PenType, SetDCAttr, GetPenType
- */
- #define SetPenType(hdc, type) (PenType) SetDCAttr (hdc, DC_ATTR_PEN_TYPE, (DWORD) type)
- /**
- * fn void SetPenDashes (HDC hdc, int dash_offset, const unsigned char* dash_list, int n)
- * brief Sets the way dashed-lines are drawn.
- *
- * Sets the way dashed-lines are drawn. Lines will be drawn with
- * alternating on and off segments of the lengths specified in dash_list.
- * The manner in which the on and off segments are drawn is determined by the pen type of the DC.
- * (This can be changed with SetPenType function.)
- *
- * param hdc The device context.
- * param dash_offset The offset in the dash list.
- * param dash_list The dash list.
- * param n The lenght of the dash list.
- *
- * return The old pen type of the DC a hdc.
- *
- * sa SetPenType
- */
- void GUIAPI SetPenDashes (HDC hdc, int dash_offset, const unsigned char* dash_list, int n);
- /**
- * DC Line cap styles
- */
- typedef enum
- {
- /**
- * the ends of the lines are drawn squared off
- * and extending to the coordinates of the end point.
- */
- PT_CAP_BUTT,
- /**
- * the ends of the lines are drawn as semicircles with
- * the diameter equal to the line width and centered at the end point.
- */
- PT_CAP_ROUND,
- /**
- * the ends of the lines are drawn squared off and
- * extending half the width of the line beyond the end point.
- */
- PT_CAP_PROJECTING
- } PTCapStyle;
- /**
- * def GetPenCapStyle(hdc)
- * brief Gets the pen cap style of a DC.
- *
- * param hdc The device context.
- * return The pen cap style of the DC a hdc.
- *
- * note Defined as a macro calling a GetDCAttr for _USE_NEWGAL.
- *
- * sa PTCapStyle, GetDCAttr, SetPenCapStyle
- */
- #define GetPenCapStyle(hdc) (PTCapStyle) GetDCAttr (hdc, DC_ATTR_PEN_CAP_STYLE)
- /**
- * def SetPenCapStyle(hdc, style)
- * brief Sets the pen type of a DC to a new type.
- *
- * param hdc The device context.
- * param style The new pen cap style.
- * return The old pen cap style of the DC a hdc.
- *
- * note Defined as a macro calling a SetDCAttr for _USE_NEWGAL.
- *
- * sa PTCapStyle, SetDCAttr, GetPenCapStyle
- */
- #define SetPenCapStyle(hdc, style) (PTCapStyle) SetDCAttr (hdc, DC_ATTR_PEN_CAP_STYLE, (DWORD) style)
- /**
- * DC Line join styles
- */
- typedef enum
- {
- /**
- * the sides of each line are extended to meet at an angle.
- */
- PT_JOIN_MITER,
- /**
- * the sides of the two lines are joined by a circular arc.
- */
- PT_JOIN_ROUND,
- /**
- * the sides of the two lines are joined by a straight line
- * which makes an equal angle with each line.
- */
- PT_JOIN_BEVEL
- } PTJoinStyle;
- /**
- * def GetPenJoinStyle(hdc)
- * brief Gets the pen join style of a DC.
- *
- * param hdc The device context.
- * return The pen join style of the DC a hdc.
- *
- * note Defined as a macro calling a GetDCAttr for _USE_NEWGAL.
- *
- * sa PTJoinStyle, GetDCAttr, SetPenJoinStyle
- */
- #define GetPenJoinStyle(hdc) (PTJoinStyle) GetDCAttr (hdc, DC_ATTR_PEN_JOIN_STYLE)
- /**
- * def SetPenJoinStyle(hdc, style)
- * brief Sets the pen type of a DC to a new type.
- *
- * param hdc The device context.
- * param style The new pen join style.
- * return The old pen join style of the DC a hdc.
- *
- * note Defined as a macro calling a SetDCAttr for _USE_NEWGAL.
- *
- * sa PTJoinStyle, SetDCAttr, GetPenJoinStyle
- */
- #define SetPenJoinStyle(hdc, style) (PTJoinStyle) SetDCAttr (hdc, DC_ATTR_PEN_JOIN_STYLE, (DWORD) style)
- /**
- * def GetPenWidth(hdc)
- * brief Gets the pen width of a DC.
- *
- * param hdc The device context.
- * return The width of the current pen in the DC a hdc.
- *
- * note Defined as a macro calling a GetDCAttr for _USE_NEWGAL.
- *
- * sa GetDCAttr, SetPenWidth
- */
- #define GetPenWidth(hdc) (unsigned int) GetDCAttr (hdc, DC_ATTR_PEN_WIDTH)
- /**
- * def SetPenWidth(hdc, width)
- * brief Sets the pen width of a DC to a new width.
- *
- * param hdc The device context.
- * param width The new pen width.
- * return The old pen width of the DC a hdc.
- *
- * note Defined as a macro calling a SetDCAttr for _USE_NEWGAL.
- *
- * sa SetDCAttr, GetPenWidth
- */
- #define SetPenWidth(hdc, width) (unsigned int) SetDCAttr (hdc, DC_ATTR_PEN_WIDTH, (DWORD) width)
- /**
- * DC brush types.
- * Solid:
- * Tiled:
- * Stippled:
- * OpaqueStippled:
- */
- typedef enum
- {
- /**
- * draw with the current brush color.
- */
- BT_SOLID,
- /**
- * draw with a tiled bitmap.
- */
- BT_TILED,
- /**
- * draw using the stipple bitmap.
- * Pixels corresponding to bits in the stipple bitmap that are set
- * will be drawn in the brush color; pixels corresponding to bits
- * that are not set will be left untouched.
- */
- BT_STIPPLED,
- /**
- * draw using the stipple bitmap.
- * Pixels corresponding to bits in the stipple bitmap that are set
- * will be drawn in the brush color; pixels corresponding to bits
- * that are not set will be drawn with the background color.
- */
- BT_OPAQUE_STIPPLED
- } BrushType;
- /**
- * def GetBrushType(hdc)
- * brief Gets the brush type of a DC.
- *
- * param hdc The device context.
- * return The brush type of the DC a hdc.
- *
- * note Defined as a macro calling a GetDCAttr for _USE_NEWGAL.
- *
- * sa BrushType, GetDCAttr, SetBrushType
- */
- #define GetBrushType(hdc) (BrushType) GetDCAttr (hdc, DC_ATTR_BRUSH_TYPE)
- /**
- * def SetBrushType(hdc, type)
- * brief Sets the brush type of a DC to a new type.
- *
- * param hdc The device context.
- * param type The new brush type.
- * return The old brush type of the DC a hdc.
- *
- * note Defined as a macro calling a SetDCAttr for _USE_NEWGAL.
- *
- * sa BrushType, SetDCAttr, GetBrushType
- */
- #define SetBrushType(hdc, type) (BrushType) SetDCAttr (hdc, DC_ATTR_BRUSH_TYPE, (DWORD) type)
- /** The stipple bitmap structure. */
- typedef struct _STIPPLE
- {
- /** The width of the stipple bitmap. */
- int width;
- /** The height of the stipple bitmap. */
- int height;
- /** The pitch of the stipple bitmap. */
- int pitch;
- /** The size of the stipple bitmap. */
- size_t size;
- /** The pointer to the buffer of glyph bitmap bits. */
- const unsigned char* bits;
- } STIPPLE;
- /**
- * fn void GUIAPI SetBrushInfo (HDC hdc, const BITMAP* tile, const STIPPLE* stipple)
- * brief Set the tile or stipple with the DC.
- *
- * param hdc The device context.
- * param tile The tile bitmap.
- * param stipple The stipple bitmap.
- *
- * sa SetBrushInfo
- */
- void GUIAPI SetBrushInfo (HDC hdc, const BITMAP* tile, const STIPPLE* stipple);
- /**
- * fn void GUIAPI SetBrushOrigin (HDC hdc, int x, int y)
- * brief Set the origin when using tiles or stipples with the DC.
- *
- * Set the origin when using tiles or stipples with the DC.
- * The tile or stipple will be aligned such that the upper left corner
- * of the tile or stipple will coincide with this point.
- *
- * param hdc The device context.
- * param x The x-coordinate of the origin.
- * param y The y-coordinate of the origin.
- *
- * sa SetBrushInfo
- */
- void GUIAPI SetBrushOrigin (HDC hdc, int x, int y);
- /**
- * fn void GUIAPI LineEx (HDC hdc, int x1, int y1, int x2, int y2)
- * brief Draws a line with the current pen in the DC a hdc.
- *
- * This function draws a line with the current pen in the DC a hdc.
- * The line draws from a (x1, y1) to a (x2, y2).
- *
- * param hdc The device context.