MiniGUI API Reference (MiniGUI-Threads)  v3.2.0
A mature and proven cross-platform GUI system for embedded and smart IoT devices
Modules | Macros | Typedefs | Functions
General drawing functions

Modules

 Advanced 2-Dimension graphics functions.
 

Macros

#define DrawHDotLine(hdc, x, y, w)   DrawHVDotLine (hdc, x, y, w, TRUE);
 Draws a horizontal dot dash line. More...
 
#define DrawVDotLine(hdc, x, y, h)   DrawHVDotLine (hdc, x, y, h, FALSE);
 Draws a vertical dot line. More...
 
#define PolygonGenerator(context, pts, vertices, cb)   PolygonGeneratorEx(context, pts, vertices, cb, NULL)
 This is a general polygon generator. More...
 

Typedefs

typedef void(* CB_LINE) (void *context, int stepx, int stepy)
 The type of line generator callback. More...
 
typedef void(* CB_CIRCLE) (void *context, int x1, int x2, int y)
 The type of circle generator callback. More...
 
typedef void(* CB_ELLIPSE) (void *context, int x1, int x2, int y)
 The type of ellipse generator callback. More...
 
typedef void(* CB_ARC) (void *context, int x, int y)
 The type of arc generator callback. More...
 
typedef void(* CB_POLYGON) (void *context, int x1, int x2, int y)
 The type of polygon generator callback. More...
 
typedef BOOL(* CB_EQUAL_PIXEL) (void *context, int x, int y)
 Flodd filling generator's equation callback. More...
 
typedef void(* CB_FLOOD_FILL) (void *context, int x1, int x2, int y)
 Flodd filling generator's scan line callback. More...
 

Functions

MG_EXPORT void GUIAPI SetPixel (HDC hdc, int x, int y, gal_pixel pixel)
 Sets the pixel with a new pixel value at the specified position on a DC. More...
 
MG_EXPORT gal_pixel GUIAPI SetPixelRGB (HDC hdc, int x, int y, Uint8 r, Uint8 g, Uint8 b)
 Sets the pixel by a RGB triple at the specified position on a DC. More...
 
MG_EXPORT gal_pixel GUIAPI SetPixelRGBA (HDC hdc, int x, int y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Sets the pixel by a RGBA quarter at the specified position on a DC. More...
 
MG_EXPORT gal_pixel GUIAPI GetPixel (HDC hdc, int x, int y)
 Gets the pixel value at the specified position on a DC. More...
 
MG_EXPORT gal_pixel GUIAPI GetPixelRGB (HDC hdc, int x, int y, Uint8 *r, Uint8 *g, Uint8 *b)
 Gets the pixel value at the specified position on a DC in RGB triple. More...
 
MG_EXPORT gal_pixel GUIAPI GetPixelRGBA (HDC hdc, int x, int y, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
 Gets the pixel value at the specified position on a DC in RGBA quarter. More...
 
MG_EXPORT void GUIAPI RGBA2Pixels (HDC hdc, const RGB *rgbs, gal_pixel *pixels, int count)
 Gets the pixel values from a color array in RGBA quarter under a DC. More...
 
static gal_pixel RGBA2Pixel (HDC hdc, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Gets the pixel value from a color in RGBA quarter under a DC. More...
 
MG_EXPORT void GUIAPI RGB2Pixels (HDC hdc, const RGB *rgbs, gal_pixel *pixels, int count)
 Gets the pixel values from a color array in RGB triple under a DC. More...
 
static gal_pixel RGB2Pixel (HDC hdc, Uint8 r, Uint8 g, Uint8 b)
 Gets the pixel value from a color in RGB triple under a DC. More...
 
MG_EXPORT void GUIAPI Pixel2RGBs (HDC hdc, const gal_pixel *pixels, RGB *rgbs, int count)
 Gets the colors in RGB triple from a pixel value array under a DC. More...
 
static void Pixel2RGB (HDC hdc, gal_pixel pixel, Uint8 *r, Uint8 *g, Uint8 *b)
 Gets the color in RGB triple from a pixel value under a DC. More...
 
MG_EXPORT void GUIAPI Pixel2RGBAs (HDC hdc, const gal_pixel *pixels, RGB *rgbs, int count)
 Gets the colors in RGBA quarter from a array of pixel values under a DC. More...
 
static void Pixel2RGBA (HDC hdc, gal_pixel pixel, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
 Gets the color in RGBA quarter from a pixel value under a DC. More...
 
static DWORD Pixel2DWORD (HDC hdc, gal_pixel pixel)
 An inline function to convert pixel value to DWORD color. More...
 
static gal_pixel DWORD2Pixel (HDC hdc, DWORD dword)
 An inline function to convert DWORD color to gal_pixel. More...
 
MG_EXPORT void GUIAPI FocusRect (HDC hdc, int x0, int y0, int x1, int y1)
 Draws a focus rectangle. More...
 
MG_EXPORT void GUIAPI DrawHVDotLine (HDC hdc, int x, int y, int w_h, BOOL H_V)
 Draws a horizontal or vertical dot dash line. More...
 
MG_EXPORT BOOL GUIAPI LineClipper (const RECT *cliprc, int *_x0, int *_y0, int *_x1, int *_y1)
 The line clipper using Cohen-Sutherland algorithm. More...
 
MG_EXPORT void GUIAPI LineGenerator (void *context, int x1, int y1, int x2, int y2, CB_LINE cb)
 A line generator based-on Breshenham algorithm. More...
 
MG_EXPORT void GUIAPI CircleGenerator (void *context, int sx, int sy, int r, CB_CIRCLE cb)
 A circle generator. More...
 
MG_EXPORT void GUIAPI EllipseGenerator (void *context, int sx, int sy, int rx, int ry, CB_ELLIPSE cb)
 An ellipse generator. More...
 
MG_EXPORT void GUIAPI CircleArcGenerator (void *context, int sx, int sy, int r, int ang1, int ang2, CB_ARC cb)
 An arc generator. More...
 
MG_EXPORT BOOL GUIAPI MonotoneVerticalPolygonGenerator (void *context, const POINT *pts, int vertices, CB_POLYGON cb)
 A monotone vertical polygon generator. More...
 
MG_EXPORT BOOL GUIAPI PolygonIsMonotoneVertical (const POINT *pts, int vertices)
 Checks a polygon is monotone vertical or not. More...
 
MG_EXPORT BOOL GUIAPI PolygonGeneratorEx (void *context, const POINT *pts, int vertices, CB_POLYGON cb, RECT *rc_output)
 A general polygon generator. More...
 
MG_EXPORT BOOL GUIAPI FloodFillGenerator (void *context, const RECT *src_rc, int x, int y, CB_EQUAL_PIXEL cb_equal_pixel, CB_FLOOD_FILL cb_flood_fill)
 A flood filling generator. More...
 
MG_EXPORT int GUIAPI SetBitmapScalerType (HDC hdc, int scaler_type)
 set bitmap scaler algorithm callback of DC according by scaler_type. More...
 
MG_EXPORT void GUIAPI MoveTo (HDC hdc, int x, int y)
 Moves the current zero pen position. More...
 
MG_EXPORT void GUIAPI LineTo (HDC hdc, int x, int y)
 Draws a zero line to a position. More...
 
MG_EXPORT void GUIAPI Rectangle (HDC hdc, int x0, int y0, int x1, int y1)
 Draws a rectangle. More...
 
MG_EXPORT void GUIAPI PolyLineTo (HDC hdc, const POINT *pts, int vertices)
 Draws a polyline. More...
 
MG_EXPORT void GUIAPI SplineTo (HDC hdc, const POINT *pts)
 Draws a bezier spline. More...
 
MG_EXPORT void GUIAPI Circle (HDC hdc, int sx, int sy, int r)
 Draws a circle. More...
 
MG_EXPORT void GUIAPI Ellipse (HDC hdc, int sx, int sy, int rx, int ry)
 Draws a ellipse. More...
 
MG_EXPORT void GUIAPI CircleArc (HDC hdc, int sx, int sy, int r, int ang1, int ang2)
 Draws an arc. More...
 
MG_EXPORT void GUIAPI FillBox (HDC hdc, int x, int y, int w, int h)
 Fills a rectangle box. More...
 
MG_EXPORT void GUIAPI FillCircle (HDC hdc, int sx, int sy, int r)
 Fills a circle. More...
 
MG_EXPORT void GUIAPI FillEllipse (HDC hdc, int sx, int sy, int rx, int ry)
 Fills an ellipse. More...
 
MG_EXPORT BOOL GUIAPI FillPolygon (HDC hdc, const POINT *pts, int vertices)
 Fills an polygon. More...
 
MG_EXPORT BOOL GUIAPI FloodFill (HDC hdc, int x, int y)
 Fills an enclosed area starting at point (x,y). More...
 

Detailed Description

Macro Definition Documentation

#define DrawHDotLine (   hdc,
  x,
  y,
 
)    DrawHVDotLine (hdc, x, y, w, TRUE);

Draws a horizontal dot dash line.

This function draws a horizontal dot dash line with the zero pen.

Parameters
hdcThe device context.
xx,y: The start point of the line.
yx,y: The start point of the line.
wThe width of the horizontal dot line.
Note
Defined as a macro calling DrawHVDotLine.
See also
DrawVDotLine, DrawHVDotLine

Definition at line 2947 of file gdi.h.

#define DrawVDotLine (   hdc,
  x,
  y,
 
)    DrawHVDotLine (hdc, x, y, h, FALSE);

Draws a vertical dot line.

This function draws a vertical dot dash line with the zero pen.

Parameters
hdcThe device context.
xx,y: The start point of the line.
yx,y: The start point of the line.
hThe height of the horizontal dot line.
Note
Defined as a macro calling DrawHVDotLine.
See also
DrawHDotLine, DrawHVDotLine

Definition at line 2965 of file gdi.h.

#define PolygonGenerator (   context,
  pts,
  vertices,
  cb 
)    PolygonGeneratorEx(context, pts, vertices, cb, NULL)

This is a general polygon generator.

Defined as a macro calling PolygonGeneratorEx passing and rc_output as NULL.

See also
PolygonGeneratorEx

Definition at line 3235 of file gdi.h.

Typedef Documentation

typedef void(* CB_ARC)(void *context, int x, int y)

The type of arc generator callback.

Definition at line 3103 of file gdi.h.

typedef void(* CB_CIRCLE)(void *context, int x1, int x2, int y)

The type of circle generator callback.

Definition at line 3034 of file gdi.h.

typedef void(* CB_ELLIPSE)(void *context, int x1, int x2, int y)

The type of ellipse generator callback.

Definition at line 3070 of file gdi.h.

typedef BOOL(* CB_EQUAL_PIXEL)(void *context, int x, int y)

Flodd filling generator's equation callback.

Definition at line 3242 of file gdi.h.

typedef void(* CB_FLOOD_FILL)(void *context, int x1, int x2, int y)

Flodd filling generator's scan line callback.

Definition at line 3248 of file gdi.h.

typedef void(* CB_LINE)(void *context, int stepx, int stepy)

The type of line generator callback.

Definition at line 3003 of file gdi.h.

typedef void(* CB_POLYGON)(void *context, int x1, int x2, int y)

The type of polygon generator callback.

Definition at line 3135 of file gdi.h.

Function Documentation

void GUIAPI Circle ( HDC  hdc,
int  sx,
int  sy,
int  r 
)

Draws a circle.

This function draws a circle with the zero pen on the DC hdc. The center of the circle is at (sx, sy), and the radius is r.

Parameters
hdcThe device context.
sxsx,sy: The center of the circle.
sysx,sy: The center of the circle.
rThe radius of the circle.
See also
CircleGenerator
void GUIAPI CircleArc ( HDC  hdc,
int  sx,
int  sy,
int  r,
int  ang1,
int  ang2 
)

Draws an arc.

This function draws an arc with the zero pen on the DC hdc. The center of the arc is at (sx, sy), the radius is r, and the radians of start angle and end angle are ang1 and ang2 respectively.

Parameters
hdcThe device context.
sxsx,sy: The center of the arc.
sysx,sy: The center of the arc.
rThe radius of the arc.
ang1The start angle of the arc, relative to the 3 o'clock position, counter-clockwise, in 1/64ths of a degree.
ang2The end angle of the arc, relative to angle1, in 1/64ths of a degree.
See also
CircleArcGenerator, Fixed point math functions, DC attribute operations
void GUIAPI CircleArcGenerator ( void *  context,
int  sx,
int  sy,
int  r,
int  ang1,
int  ang2,
CB_ARC  cb 
)

An arc generator.

This is a general arc generator. When it generates a point on the arc, it will call the callback cb and pass the context context, the coordinates of the point.

MiniGUI implements CircleArc function by using this generator.

Parameters
contextThe context, will be passed to the callback cb.
sxsx,sy: The center of the arc.
sysx,sy: The center of the arc.
rThe radius of the arc.
ang1The start angle of the arc, relative to the 3 o'clock position, counter-clockwise, in 1/64ths of a degree.
ang2The end angle of the arc, relative to angle1, in 1/64ths of a degree.
cbThe arc generator callback.
See also
CircleArc, CB_ARC
void GUIAPI CircleGenerator ( void *  context,
int  sx,
int  sy,
int  r,
CB_CIRCLE  cb 
)

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 cb and pass the context 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 Circle, FillCircle and InitCircleRegion functions by using this generator.

Parameters
contextThe context, will be passed to the callback cb.
sxsx,sy: The center of the circle.
sysx,sy: The center of the circle.
rThe radius of the circle.
cbThe circle generator callback.
See also
Circle, FillCircle, InitCircleRegion, CB_CIRCLE

Example:

/*
* Draw a circle which is 4 pixels wide by using CircleGenerator.
*/
static void draw_circle_pixel (void* context, int x1, int x2, int y)
{
HDC hdc = (HDC) context;
FillCircle (hdc, x1, y, 2);
FillCircle (hdc, x2, y, 2);
}
void DrawMyCircle (HDC hdc, int x, int y, int r, gal_pixel pixel)
{
gal_pixel old_brush;
old_bursh = SetBrushColor (hdc, pixle);
CircleGenerator ((void*)hdc, x, y, r, draw_circle_pixel);
SetBrushColor (hdc, old_brush);
}
void GUIAPI DrawHVDotLine ( HDC  hdc,
int  x,
int  y,
int  w_h,
BOOL  H_V 
)

Draws a horizontal or vertical dot dash line.

This function draws a horizontal or vertical dot dash line with the zero pen.

Parameters
hdcThe device context.
xx,y: The start point of the line.
yx,y: The start point of the line.
w_hThe width of the line or horizontal dot line, or the height if you want to draw a vertical dot line.
H_VSpecify whether you want to draw a horizontal or vertical line. TRUE for horizontal, FALSE for vertical.
See also
FocusRect

Referenced by DWORD2Pixel().

gal_pixel DWORD2Pixel ( HDC  hdc,
DWORD  dword 
)
inlinestatic

An inline function to convert DWORD color to gal_pixel.

This function converts a color in DWORD to pixel value.

Parameters
hdcThe device context.
dwordThe color value in DWORD.
Returns
The converted pixel value.

Definition at line 2886 of file gdi.h.

References DrawHVDotLine(), FocusRect(), GetAValue, GetBValue, GetGValue, GetRValue, and RGBA2Pixel().

void GUIAPI Ellipse ( HDC  hdc,
int  sx,
int  sy,
int  rx,
int  ry 
)

Draws a ellipse.

This function draws an ellipse with the zero pen on the DC hdc. The center of the ellipse is at (sx, sy), the x-coordinate radius is rx, and the y-coordinate radius is ry.

Parameters
hdcThe device context.
sxsx,sy: The center of the ellipse.
sysx,sy: The center of the ellipse.
rxThe x-coordinate radius of the ellipse.
ryThe y-coordinate radius of the ellipse.
See also
EllipseGenerator, DC attribute operations
void GUIAPI EllipseGenerator ( void *  context,
int  sx,
int  sy,
int  rx,
int  ry,
CB_ELLIPSE  cb 
)

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 cb and pass the context 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 Ellipse, FillEllipse, and InitEllipseRegion functions by using this generator.

Parameters
contextThe context, will be passed to the callback cb.
sxsx,sy: The center of the ellipse.
sysx,sy: The center of the ellipse.
rxThe x-radius of the ellipse.
ryThe y-radius of the ellipse.
cbThe ellipse generator callback.
See also
Ellipse, FillEllipse, InitEllipseRegion, CB_CIRCLE
void GUIAPI FillBox ( HDC  hdc,
int  x,
int  y,
int  w,
int  h 
)

Fills a rectangle box.

This function fills a box with the current brush in the DC hdc.

Parameters
hdcThe device context.
xx,y: The coorinates of the upper-left corner of the box.
yx,y: The coorinates of the upper-left corner of the box.
wThe width of the box.
hThe height of the box.
See also
DC attribute operations
void GUIAPI FillCircle ( HDC  hdc,
int  sx,
int  sy,
int  r 
)

Fills a circle.

This function fills a circle with the current brush in the DC hdc.

Parameters
hdcThe device context.
sxsx,sy: The center of the circle.
sysx,sy: The center of the circle.
rThe radius of the circle.
See also
CircleGenerator, DC attribute operations
void GUIAPI FillEllipse ( HDC  hdc,
int  sx,
int  sy,
int  rx,
int  ry 
)

Fills an ellipse.

This function fills an ellipse with the current brush in the DC hdc. Note that MiniGUI only defined the color property for the brush objects so far.

Parameters
hdcThe device context.
sxsx,sy: The center of the circle.
sysx,sy: The center of the circle.
rxThe x-coordinate radius of the ellipse.
ryThe y-coordinate radius of the ellipse.
See also
EllipseGenerator, DC attribute operations
BOOL GUIAPI FillPolygon ( HDC  hdc,
const POINT pts,
int  vertices 
)

Fills an polygon.

This function fills a polygon with the current brush in the DC hdc.

Parameters
hdcThe device context.
ptsThe pointer to the vertex array of the polygon.
verticesThe number of the vertices, i.e. the size of the vertex array.
See also
PolygonGenerator, DC attribute operations
BOOL GUIAPI FloodFill ( HDC  hdc,
int  x,
int  y 
)

Fills an enclosed area starting at point (x,y).

This function fills an enclosed area staring at point (x,y), and stops when encountering a pixel different from the start point.

Parameters
hdcThe device context.
xx,y: The start point.
yx,y: The start point.
See also
FloodFillGenerator, DC attribute operations
BOOL GUIAPI FloodFillGenerator ( void *  context,
const RECT src_rc,
int  x,
int  y,
CB_EQUAL_PIXEL  cb_equal_pixel,
CB_FLOOD_FILL  cb_flood_fill 
)

A flood filling generator.

This function is a general flood filling generator.

MiniGUI implements FloodFill function by using this generator.

Parameters
contextThe context, will be passed to the callback cb.
src_rcThe filling bounding rectangle.
xx,y: The start filling point.
yx,y: The start filling point.
cb_equal_pixelThe callback to check the pixel is equal with the start point or not.
cb_flood_fillThe callback to fill a scan line.
See also
FloodFill, CB_EQUAL_PIXEL, CB_FLOOD_FILL
void GUIAPI FocusRect ( HDC  hdc,
int  x0,
int  y0,
int  x1,
int  y1 
)

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.

Parameters
hdcThe device context.
x0x0,y0: The coordinates of upper-left corner of the rectangle.
y0x0,y0: The coordinates of upper-left corner of the rectangle.
x1x1,y1: The corrdinates of lower-right corner of the rectangle.
y1x1,y1: The corrdinates of lower-right corner of the rectangle.
See also
DrawHVDotLine

Referenced by DWORD2Pixel().

gal_pixel GUIAPI GetPixel ( HDC  hdc,
int  x,
int  y 
)

Gets the pixel value at the specified position on a DC.

This function gets the pixel value at the specified position (x,y) on the DC hdc.

Parameters
hdcThe device context.
xx,y: The pixel position.
yx,y: The pixel position.
Returns
The pixel value.
See also
SetPixel
gal_pixel GUIAPI GetPixelRGB ( HDC  hdc,
int  x,
int  y,
Uint8 r,
Uint8 g,
Uint8 b 
)

Gets the pixel value at the specified position on a DC in RGB triple.

This function gets the pixel value at the specified position (x,y) on the DC hdc in RGB triple.

Parameters
hdcThe device context.
xx,y: The pixel position.
yx,y: The pixel position.
rThe red component of the pixel will be returned through this pointer.
gThe green component of the pixel will be returned through this pointer.
bThe blue component of the pixel will be returned through this pointer.
Returns
The pixel value.
See also
SetPixelRGB
gal_pixel GUIAPI GetPixelRGBA ( HDC  hdc,
int  x,
int  y,
Uint8 r,
Uint8 g,
Uint8 b,
Uint8 a 
)

Gets the pixel value at the specified position on a DC in RGBA quarter.

This function gets the pixel value at the specified position (x,y) on the DC hdc in RGBA quarter.

Parameters
hdcThe device context.
xx,y: The pixel position.
yx,y: The pixel position.
rThe red component of the pixel will be returned through this pointers.
gThe green component of the pixel will be returned through this pointers.
bThe blue component of the pixel will be returned through this pointers.
aThe alpha component of the pixel will be returned through this pointers.
Returns
The pixel value.
See also
SetPixelRGBA
BOOL GUIAPI LineClipper ( const RECT cliprc,
int *  _x0,
int *  _y0,
int *  _x1,
int *  _y1 
)

The line clipper using Cohen-Sutherland algorithm.

This function clips a line from (*_x0,*_y0) to (*_x1, *_y1) with the specified clipping rectangle pointed to by cliprc. Then return the clipped line throught the pointers (_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.

Parameters
cliprcThe Pointer to the clipping rectangle.
_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.
_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.
_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.
_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.
Returns
TRUE for clipped by the clipping rectangle, FALSE for not clipped.
See also
LineGenerator
void GUIAPI LineGenerator ( void *  context,
int  x1,
int  y1,
int  x2,
int  y2,
CB_LINE  cb 
)

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 cb and pass the context 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 cb will be (0,0).

MiniGUI implements LineTo function by using this generator.

Parameters
contextThe context, will be passed to the callback cb.
x1x1,y1: The start point of the line.
y1x1,y1: The start point of the line.
x2x2,y2: The end point of the line.
y2x2,y2: The end point of the line.
cbThe line generator callback.
See also
LineTo, LineClipper, CB_LINE
void GUIAPI LineTo ( HDC  hdc,
int  x,
int  y 
)

Draws a zero line to a position.

This function draws a line from the current zero pen position to (x,y), and then moves the zero pen position to (x,y) by using the zero pen. The next zero line drawing operation will start from the position.

Parameters
hdcThe device context.
xx,y: The end point of the line.
yx,y: The end point of the line.
See also
MoveTo, LineGenerator, DC attribute operations
BOOL GUIAPI MonotoneVerticalPolygonGenerator ( void *  context,
const POINT pts,
int  vertices,
CB_POLYGON  cb 
)

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 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 cb and pass the context 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 FillPolygon and InitPolygonRegion functions by using this generator.

Parameters
contextThe context, will be passed to the callback cb.
ptsThe pointer to the vertex array of the polygon.
verticesThe number of the vertices, i.e. the size of the vertex array.
cbThe polygon generator callback.
Returns
TRUE on success, FALSE on error.
See also
FillPolygon, InitPolygonRegion, PolygonIsMonotoneVertical, CB_CIRCLE
void GUIAPI MoveTo ( HDC  hdc,
int  x,
int  y 
)

Moves the current zero pen position.

This function moves the current pen position of the DC hdc to (x,y). The next line or other pen drawing operation will start from the position.

Parameters
hdcThe device context.
xx,y: The new pen position.
yx,y: The new pen position.
See also
LineTo
DWORD GUIAPI Pixel2DWORD ( HDC  hdc,
gal_pixel  pixel 
)
inlinestatic

An inline function to convert pixel value to DWORD color.

This function converts a pixel value to color in DWORD.

Parameters
hdcThe device context.
pixelThe pixel value to be converted.
Returns
The converted color value in DWORD.

Definition at line 2867 of file gdi.h.

References MakeRGBA, and Pixel2RGBA().

void GUIAPI Pixel2RGB ( HDC  hdc,
gal_pixel  pixel,
Uint8 r,
Uint8 g,
Uint8 b 
)
inlinestatic

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 pixel under the DC hdc.

Parameters
hdcThe device context.
pixelThe pixel value.
rThe red component of the pixel will be returned through this pointer.
gThe green component of the pixel will be returned through this pointer.
bThe blue component of the pixel will be returned through this pointer.
Note
This function is implemented as an inline to RGB2Pixels.
See also
Pixel2RGBs, RGB2Pixel

Definition at line 2801 of file gdi.h.

References _RGB::b, _RGB::g, Pixel2RGBAs(), Pixel2RGBs(), and _RGB::r.

void GUIAPI Pixel2RGBA ( HDC  hdc,
gal_pixel  pixel,
Uint8 r,
Uint8 g,
Uint8 b,
Uint8 a 
)
inlinestatic

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 pixel under the DC hdc.

Parameters
hdcThe device context.
pixelThe pixel value.
rThe red component of the pixel will be returned through this pointer.
gThe green component of the pixel will be returned through this pointer.
bThe blue component of the pixel will be returned through this pointer.
aThe alpha component of the pixel will be returned through this pointer.
Note
This function is implemented as an inline to RGBA2Pixels.
See also
RGBA2Pixels, RGB2Pixel

Definition at line 2849 of file gdi.h.

References _RGB::a, _RGB::b, _RGB::g, Pixel2RGBAs(), and _RGB::r.

Referenced by Pixel2DWORD().

void GUIAPI Pixel2RGBAs ( HDC  hdc,
const gal_pixel pixels,
RGB rgbs,
int  count 
)

Gets the colors in RGBA quarter from a array of pixel values under a DC.

This function gets the colors in RGBA quarter from the pixel value array pixels under the DC hdc.

Parameters
hdcThe device context.
pixelsThe array of pixel values.
rgbsThe array returns the converted RGB quarters.
countThe number of pixels.
See also
RGB2Pixels

Referenced by Pixel2RGB(), and Pixel2RGBA().

void GUIAPI Pixel2RGBs ( HDC  hdc,
const gal_pixel pixels,
RGB rgbs,
int  count 
)

Gets the colors in RGB triple from a pixel value array under a DC.

This function gets the colors in RGB triple from the pixel value array pixels under the DC hdc.

Parameters
hdcThe device context.
pixelsThe array of pixel values.
rgbsThe array returns the converted RGB triples.
countThe number of pixels.
See also
RGB2Pixels

Referenced by Pixel2RGB(), and RGB2Pixel().

BOOL GUIAPI PolygonGeneratorEx ( void *  context,
const POINT pts,
int  vertices,
CB_POLYGON  cb,
RECT rc_output 
)

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 cb and pass the context 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 FillPolygon and InitPolygonRegion functions by using this generator.

Parameters
contextThe context, will be passed to the callback cb.
ptsThe pointer to the vertex array of the polygon.
verticesThe number of the vertices, i.e. the size of the vertex array.
cbThe polygon generator callback.
rc_outputThe limit RECT for Polygon ScanLines ranges .
See also
FillPolygon, InitPolygonRegion, CB_CIRCLE
BOOL GUIAPI PolygonIsMonotoneVertical ( const POINT pts,
int  vertices 
)

Checks a polygon is monotone vertical or not.

This function checks if the given polygon is monotone vertical.

Parameters
ptsThe pointer to the vertex array of the polygon.
verticesThe number of the vertices, i.e. the size of the vertex array.
Returns
TRUE if it is monotonoe vertical, otherwise FALSE.
Note
To make sure a polygon is monotone vertical, the polygon must be a closed one, that is, the pts[0] must be equal to the pts[vertices-1].
See also
MonotoneVerticalPolygonGenerator
void GUIAPI PolyLineTo ( HDC  hdc,
const POINT pts,
int  vertices 
)

Draws a polyline.

This function draws a polyline by using MoveTo and LineTo. The current zero pen position after calling this function will be the last vertex of the polyline.

Parameters
hdcThe device context.
ptsThe pointer to the vertex array of the polyline.
verticesThe number of the vertices.
See also
MoveTo, LineTo
void GUIAPI Rectangle ( HDC  hdc,
int  x0,
int  y0,
int  x1,
int  y1 
)

Draws a rectangle.

This function draws a rectangle by using MoveTo and LineTo. The current zero pen position after calling this function will be (x1,y1).

Parameters
hdcThe device context.
x0x0,y0: The coordinates of the upper-left corner of the rectangle.
y0x0,y0: The coordinates of the upper-left corner of the rectangle.
x1x1,y1: The coordinates of the lower-right corner of the rectangle.
y1x1,y1: The coordinates of the lower-right corner of the rectangle.
See also
MoveTo, LineTo
gal_pixel GUIAPI RGB2Pixel ( HDC  hdc,
Uint8  r,
Uint8  g,
Uint8  b 
)
inlinestatic

Gets the pixel value from a color in RGB triple under a DC.

This function gets the pixel value from the RGB triple (r,g,b) under the DC hdc.

Parameters
hdcThe device context.
rThe red component of a color.
gThe green component of a color.
bThe blue component of a color.
Returns
The pixel value.
Note
This function is implemented as an inline to RGB2Pixels.
See also
RGB2Pixels, Pixel2RGB

Definition at line 2754 of file gdi.h.

References Pixel2RGBs(), and RGB2Pixels().

void GUIAPI RGB2Pixels ( HDC  hdc,
const RGB rgbs,
gal_pixel pixels,
int  count 
)

Gets the pixel values from a color array in RGB triple under a DC.

This function gets the pixel values from the RGB triple array rgbs under the DC hdc.

Parameters
hdcThe device context.
rgbsThe array of RGB triples to be converted.
pixelsThe array returns the converted pixel values.
countThe number of RGB triples.
See also
Pixel2RGBs

Referenced by RGB2Pixel(), and RGBA2Pixel().

gal_pixel GUIAPI RGBA2Pixel ( HDC  hdc,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)
inlinestatic

Gets the pixel value from a color in RGBA quarter under a DC.

This function gets the pixel value from the RGB quarter (r,g,b,a) under the DC hdc.

Parameters
hdcThe device context.
rThe red component of a color.
gThe green component of a color.
bThe blue component of a color.
aThe alpha component of a color.
Returns
The pixel value.
Note
This function is implemented as an inline to RGBA2Pixels.
See also
RGBA2Pixels, Pixel2RGBA

Definition at line 2710 of file gdi.h.

References RGB2Pixels(), and RGBA2Pixels().

Referenced by DWORD2Pixel().

void GUIAPI RGBA2Pixels ( HDC  hdc,
const RGB rgbs,
gal_pixel pixels,
int  count 
)

Gets the pixel values from a color array in RGBA quarter under a DC.

This function gets the pixel values from the RGB quarter array rgbs under the DC hdc.

Parameters
hdcThe device context.
rgbsThe array of RGBA quarters to be converted.
pixelsThe array returns the converted pixel values.
countThe number of RGBA quarters.
See also
Pixel2RGBAs

Referenced by RGBA2Pixel().

int GUIAPI SetBitmapScalerType ( HDC  hdc,
int  scaler_type 
)

set bitmap scaler algorithm callback of DC according by scaler_type.

This function is a set general bitmap scaler type that is DDA or Bilinear interpolation algorithm. MiniGUI implements StretchBlt functions by using this scaler.

Parameters
hdcThe device context.
scaler_typeThe type of scaler algorithm, BITMAP_SCALER_DDA or BITMAP_SCALER_BILINEAR.
See also
BitmapDDAScaler, BitmapBinearScaler
void GUIAPI SetPixel ( HDC  hdc,
int  x,
int  y,
gal_pixel  pixel 
)

Sets the pixel with a new pixel value at the specified position on a DC.

This function sets the pixel with a pixel value pixel at the specified position (x,y) on the DC hdc. You can the pre-defined standard system pixel values.

Parameters
hdcThe device context.
xx,y: The pixel position.
yx,y: The pixel position.
pixelThe pixel value.
See also
GetPixel, System colors and pixel values.
gal_pixel GUIAPI SetPixelRGB ( HDC  hdc,
int  x,
int  y,
Uint8  r,
Uint8  g,
Uint8  b 
)

Sets the pixel by a RGB triple at the specified position on a DC.

This function sets the pixel with a RGB triple (r,g,b) at the specified position (x,y) on the DC hdc.

Parameters
hdcThe device context.
xx,y: The pixel position.
yx,y: The pixel position.
rThe red component of a color.
gThe green component of a color.
bThe blue component of a color.
Returns
The pixel value of the RGB triple.
See also
GetPixel, RGB2Pixel
gal_pixel GUIAPI SetPixelRGBA ( HDC  hdc,
int  x,
int  y,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Sets the pixel by a RGBA quarter at the specified position on a DC.

This function sets the pixel with a RGBA quarter (r,g,b,a) at the specified position (x,y) on the DC hdc.

Parameters
hdcThe device context.
xx,y: The pixel position.
yx,y: The pixel position.
rThe red component of a color.
gThe green component of a color.
bThe blue component of a color.
aThe alpha component of a color.
Returns
The pixel value of the RGBA quarter.
See also
GetPixel, RGBA2Pixel
void GUIAPI SplineTo ( HDC  hdc,
const POINT pts 
)

Draws a bezier spline.

This function draws a bezier spline by using MoveTo and 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.

Parameters
hdcThe device context.
ptsThe pointer to the control point array of the spline.
See also
MoveTo, LineTo