Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

General drawing functions
[GDI functions]

Modules

Defines

Typedefs

Functions


Define 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:
hdc The device context.
x x,y: The start point of the line.
y x,y: The start point of the line.
w The width of the horizontal dot line.
Note:
Defined as a macro calling DrawHVDotLine.
See also:
DrawVDotLine, DrawHVDotLine

Definition at line 2636 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:
hdc The device context.
x x,y: The start point of the line.
y x,y: The start point of the line.
h The height of the horizontal dot line.
Note:
Defined as a macro calling DrawHVDotLine.
See also:
DrawHDotLine, DrawHVDotLine

Definition at line 2654 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 2802 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 2729 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 2767 of file gdi.h.

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

Flodd filling generator's equation callback.

Definition at line 2934 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 2940 of file gdi.h.

typedef void *(* CB_GET_LINE_BUFF)(void *context, int y)
 

Bitmap scaler's getting line buffer callback.

Definition at line 2972 of file gdi.h.

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

The type of line generator callback.

Definition at line 2696 of file gdi.h.

typedef void *(* CB_LINE_SCALED)(void *context, const void *line, int y)
 

Bitmap scaler's getting line buffer callback.

Definition at line 2978 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 2836 of file gdi.h.


Function Documentation

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
 

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.

Parameters:
context The context will be passed to the callbacks.
src_bmp The source BITMAP object.
dst_w The width of the destination BITMAP object.
dst_h The height of the destination BITMAP object.
cb_get_line_buff The callback to get the line buffer of the destination BITMAP object.
cb_line_scaled The callback to tell the line is scaled.
Note:
Only defined for _USE_NEWGAL
See also:
ScaleBitmap, StretchBlt, BitmapDDAScaler2

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
 

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.

Parameters:
context The context will be passed to the callbacks.
src_bmp The source BITMAP object.
dst_w The width of the destination BITMAP object.
dst_h The height of the destination BITMAP object.
cb_get_line_buff The callback to get the line buffer of the destination BITMAP object.
cb_line_scaled The callback to tell the line is scaled.
Note:
Only defined for _USE_NEWGAL
See also:
ScaleBitmap, StretchBlt, BitmapDDAScaler

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:
hdc The device context.
sx sx,sy: The center of the circle.
sy sx,sy: The center of the circle.
r The 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:
hdc The device context.
sx sx,sy: The center of the arc.
sy sx,sy: The center of the arc.
r The radius of the arc.
ang1 The start angle of the arc, relative to the 3 o'clock position, counter-clockwise, in 1/64ths of a degree.
ang2 The end angle of the arc, relative to angle1, in 1/64ths of a degree.
Note:
Only defined for _USE_NEWGAL
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:
context The context, will be passed to the callback cb.
sx sx,sy: The center of the arc.
sy sx,sy: The center of the arc.
r The radius of the arc.
ang1 The start angle of the arc, relative to the 3 o'clock position, counter-clockwise, in 1/64ths of a degree.
ang2 The end angle of the arc, relative to angle1, in 1/64ths of a degree.
cb The arc generator callback.
Note:
Only defined for _USE_NEWGAL
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:
context The context, will be passed to the callback cb.
sx sx,sy: The center of the circle.
sy sx,sy: The center of the circle.
r The radius of the circle.
cb The circle generator callback.
Note:
Only defined for _USE_NEWGAL
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:
hdc The device context.
x x,y: The start point of the line.
y x,y: The start point of the line.
w_h The width of the line or horizontal dot line, or the height if you want to draw a vertical dot line.
H_V Specify whether you want to draw a horizontal or vertical line. TRUE for horizontal, FALSE for vertical.
See also:
FocusRect

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:
hdc The device context.
sx sx,sy: The center of the ellipse.
sy sx,sy: The center of the ellipse.
rx The x-coordinate radius of the ellipse.
ry The y-coordinate radius of the ellipse.
Note:
Only defined for _USE_NEWGAL
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:
context The context, will be passed to the callback cb.
sx sx,sy: The center of the ellipse.
sy sx,sy: The center of the ellipse.
rx The x-radius of the ellipse.
ry The y-radius of the ellipse.
cb The ellipse generator callback.
Note:
Only defined for _USE_NEWGAL
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:
hdc The device context.
x x,y: The coorinates of the upper-left corner of the box.
y x,y: The coorinates of the upper-left corner of the box.
w The width of the box.
h The 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:
hdc The device context.
sx sx,sy: The center of the circle.
sy sx,sy: The center of the circle.
r The radius of the circle.
Note:
Only defined for _USE_NEWGAL
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:
hdc The device context.
sx sx,sy: The center of the circle.
sy sx,sy: The center of the circle.
rx The x-coordinate radius of the ellipse.
ry The y-coordinate radius of the ellipse.
Note:
Only defined for _USE_NEWGAL
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:
hdc The device context.
pts The pointer to the vertex array of the polygon.
vertices The number of the vertices, i.e. the size of the vertex array.
Note:
Only defined for _USE_NEWGAL
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:
hdc The device context.
x x,y: The start point.
y x,y: The start point.
Note:
Only defined for _USE_NEWGAL
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:
context The context, will be passed to the callback cb.
src_rc The filling bounding rectangle.
x x,y: The start filling point.
y x,y: The start filling point.
cb_equal_pixel The callback to check the pixel is equal with the start point or not.
cb_flood_fill The callback to fill a scan line.
Note:
Only defined for _USE_NEWGAL
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:
hdc The device context.
x0 x0,y0: The coordinates of upper-left corner of the rectangle.
y0 x0,y0: The coordinates of upper-left corner of the rectangle.
x1 x1,y1: The corrdinates of lower-right corner of the rectangle.
y1 x1,y1: The corrdinates of lower-right corner of the rectangle.
See also:
DrawHVDotLine

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:
hdc The device context.
x x,y: The pixel position.
y x,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:
hdc The device context.
x x,y: The pixel position.
y x,y: The pixel position.
r The red component of the pixel will be returned through this pointer.
g The green component of the pixel will be returned through this pointer.
b The 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:
hdc The device context.
x x,y: The pixel position.
y x,y: The pixel position.
r The red component of the pixel will be returned through this pointers.
g The green component of the pixel will be returned through this pointers.
b The blue component of the pixel will be returned through this pointers.
a The 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:
cliprc The 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.
Note:
Only defined for _USE_NEWGAL
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:
context The context, will be passed to the callback cb.
x1 x1,y1: The start point of the line.
y1 x1,y1: The start point of the line.
x2 x2,y2: The end point of the line.
y2 x2,y2: The end point of the line.
cb The line generator callback.
Note:
Only defined for _USE_NEWGAL
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:
hdc The device context.
x x,y: The end point of the line.
y x,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:
context The context, will be passed to the callback cb.
pts The pointer to the vertex array of the polygon.
vertices The number of the vertices, i.e. the size of the vertex array.
cb The polygon generator callback.
Returns:
TRUE on success, FALSE on error.
Note:
Only defined for _USE_NEWGAL
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:
hdc The device context.
x x,y: The new pen position.
y x,y: The new pen position.
See also:
LineTo

void GUIAPI 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.

This function gets the color in RGB triple from the pixel value pixel under the DC hdc.

Parameters:
hdc The device context.
pixel The pixel value.
r The red component of the pixel will be returned through this pointer.
g The green component of the pixel will be returned through this pointer.
b The blue component of the pixel will be returned through this pointer.
Note:
Only defined for _USE_NEWGAL.
See also:
RGB2Pixel

void GUIAPI 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.

This function gets the color in RGBA quarter from the pixel value pixel under the DC hdc.

Parameters:
hdc The device context.
pixel The pixel value.
r The red component of the pixel will be returned through this pointer.
g The green component of the pixel will be returned through this pointer.
b The blue component of the pixel will be returned through this pointer.
a The alpha component of the pixel will be returned through this pointer.
Note:
Only defined for _USE_NEWGAL.
See also:
RGB2Pixel

BOOL GUIAPI PolygonGenerator void *  context,
const POINT pts,
int  vertices,
CB_POLYGON  cb
 

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:
context The context, will be passed to the callback cb.
pts The pointer to the vertex array of the polygon.
vertices The number of the vertices, i.e. the size of the vertex array.
cb The polygon generator callback.
Note:
Only defined for _USE_NEWGAL
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:
pts The pointer to the vertex array of the polygon.
vertices The number of the vertices, i.e. the size of the vertex array.
Returns:
TRUE if it is monotonoe vertical, otherwise FALSE.
Note:
Only defined for _USE_NEWGAL
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:
hdc The device context.
pts The pointer to the vertex array of the polyline.
vertices The 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:
hdc The device context.
x0 x0,y0: The coordinates of the upper-left corner of the rectangle.
y0 x0,y0: The coordinates of the upper-left corner of the rectangle.
x1 x1,y1: The coordinates of the lower-right corner of the rectangle.
y1 x1,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
 

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:
hdc The device context.
r The red component of a color.
g The green component of a color.
b The blue component of a color.
Returns:
The pixel value.
See also:
Pixel2RGB

gal_pixel GUIAPI RGBA2Pixel HDC  hdc,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a
 

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:
hdc The device context.
r The red component of a color.
g The green component of a color.
b The blue component of a color.
a The alpha component of a color.
Returns:
The pixel value.
Note:
Only defined for _USE_NEWGAL.
See also:
Pixel2RGBA

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:
hdc The device context.
x x,y: The pixel position.
y x,y: The pixel position.
pixel The pixel value.
See also:
GetPixel, System colors and pixel values.

gal_pixel GUIAPI SetPixelRGB HDC  hdc,
int  x,
int  y,
Uint8  r,