#define DrawHDotLine | ( | hdc, | |||
x, | |||||
y, | |||||
w | ) | DrawHVDotLine (hdc, x, y, w, TRUE); |
Draws a horizontal dot dash line.
This function draws a horizontal dot dash line with the zero pen.
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. |
#define DrawVDotLine | ( | hdc, | |||
x, | |||||
y, | |||||
h | ) | DrawHVDotLine (hdc, x, y, h, FALSE); |
Draws a vertical dot line.
This function draws a vertical dot dash line with the zero pen.
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. |
#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.
typedef void(* CB_ARC)(void *context, int x, int y) |
typedef void(* CB_CIRCLE)(void *context, int x1, int x2, int y) |
typedef void(* CB_ELLIPSE)(void *context, int x1, int x2, int y) |
typedef BOOL(* CB_EQUAL_PIXEL)(void *context, int x, int y) |
typedef void(* CB_FLOOD_FILL)(void *context, int x1, int x2, int y) |
typedef void(* CB_LINE)(void *context, int stepx, int stepy) |
typedef void(* CB_POLYGON)(void *context, int x1, int x2, int y) |
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.
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. |
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.
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. |
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.
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. |
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.
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. |
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); }
Draws a horizontal or vertical dot dash line.
This function draws a horizontal or vertical dot dash line with the zero pen.
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. |
An inline function to convert DWORD color to gal_pixel.
This function converts a color in DWORD to pixel value.
hdc | The device context. | |
dword | The color value in DWORD. |
Definition at line 2865 of file gdi.h.
References 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.
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. |
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.
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. |
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.
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. |
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.
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. |
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.
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. |
Fills an polygon.
This function fills a polygon with the current brush in the DC hdc.
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. |
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.
hdc | The device context. | |
x | x,y: The start point. | |
y | x,y: The start point. |
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.
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. |
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.
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. |
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.
hdc | The device context. | |
x | x,y: The pixel position. | |
y | x,y: The pixel position. |
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.
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. |
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.
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. |
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.
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. |
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.
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. |
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.
hdc | The device context. | |
x | x,y: The end point of the line. | |
y | x,y: The end point of the line. |
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.
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. |
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.
hdc | The device context. | |
x | x,y: The new pen position. | |
y | x,y: The new pen position. |
An inline function to convert pixel value to DWORD color.
This function converts a pixel value to color in DWORD.
hdc | The device context. | |
pixel | The pixel value to be converted. |
Definition at line 2846 of file gdi.h.
References MakeRGBA, and Pixel2RGBA().
void GUIAPI Pixel2RGB | ( | HDC | hdc, | |
gal_pixel | pixel, | |||
Uint8 * | r, | |||
Uint8 * | g, | |||
Uint8 * | b | |||
) | [inline, static] |
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.
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. |
Definition at line 2780 of file gdi.h.
References _RGB::b, _RGB::g, Pixel2RGBs(), and _RGB::r.
void GUIAPI Pixel2RGBA | ( | HDC | hdc, | |
gal_pixel | pixel, | |||
Uint8 * | r, | |||
Uint8 * | g, | |||
Uint8 * | b, | |||
Uint8 * | a | |||
) | [inline, static] |
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.
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. |
Definition at line 2828 of file gdi.h.
References _RGB::a, _RGB::b, _RGB::g, Pixel2RGBAs(), and _RGB::r.
Referenced by Pixel2DWORD().
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.
hdc | The device context. | |
pixels | The array of pixel values. | |
rgbs | The array returns the converted RGB quarters. | |
count | The number of pixels. |
Referenced by Pixel2RGBA().
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.
hdc | The device context. | |
pixels | The array of pixel values. | |
rgbs | The array returns the converted RGB triples. | |
count | The number of pixels. |
Referenced by Pixel2RGB().
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.
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. | |
rc_output | The limit RECT for Polygon ScanLines ranges . |
Checks a polygon is monotone vertical or not.
This function checks if the given polygon is monotone vertical.
pts | The pointer to the vertex array of the polygon. | |
vertices | The number of the vertices, i.e. the size of the vertex array. |
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.
hdc | The device context. | |
pts | The pointer to the vertex array of the polyline. | |
vertices | The number of the vertices. |
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).
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. |
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.
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. |
Definition at line 2733 of file gdi.h.
References RGB2Pixels().
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.
hdc | The device context. | |
rgbs | The array of RGB triples to be converted. | |
pixels | The array returns the converted pixel values. | |
count | The number of RGB triples. |
Referenced by RGB2Pixel().
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.
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. |
Definition at line 2689 of file gdi.h.
References RGBA2Pixels().
Referenced by DWORD2PIXEL().
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.
hdc | The device context. | |
rgbs | The array of RGBA quarters to be converted. | |
pixels | The array returns the converted pixel values. | |
count | The number of RGBA quarters. |
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.
hdc | The device context. | |
scaler_type | The type of scaler algorithm, BITMAP_SCALER_DDA or BITMAP_SCALER_BILINEAR. |
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.
hdc | The device context. | |
x | x,y: The pixel position. | |
y | x,y: The pixel position. | |
pixel | The pixel value. |
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.
hdc | The device context. | |
x | x,y: The pixel position. | |
y | x,y: The pixel position. | |
r | The red component of a color. | |
g | The green component of a color. | |
b | The blue component of a color. |
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.
hdc | The device context. | |
x | x,y: The pixel position. | |
y | x,y: The pixel position. | |
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. |
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.
hdc | The device context. | |
pts | The pointer to the control point array of the spline. |