Drawing API
|
Compounds |
| struct | gdm_point |
Defines |
| #define | GDM_LINE 0 |
| #define | GDM_POLYGON 1 |
| #define | GDM_SEGMENT 2 |
Typedefs |
| typedef gdm_point | gdm_point |
Functions |
| void | gdm_draw_point (gdm_display *dp, short x, short y) |
| void | gdm_draw_points (gdm_display *dp, gdm_point *pts, unsigned short npoints) |
| void | gdm_draw_line (gdm_display *dp, short x1, short y1, short x2, short y2) |
| void | gdm_draw_lines (gdm_display *dp, gdm_point *pts, unsigned short npoints, short mode) |
| void | gdm_fill_rectangle (gdm_display *dp, short x, short y, unsigned short width, unsigned short height) |
Detailed Description
The drawing API allows to draw lines, circles, paint characters on the screen. The drawing operations are made in the display manager bitmap which is in memory. Once the drawing is finished, the bitmap must be synchronized with the LCD screen (see gdm_refresh in Management and Control API).
Each drawing operation is made using a graphical context. The graphical context defines the logical operation which is used when drawing the item (see gdm_set_gc in Management and Control API). The following operations are supported:
- GDM_PLOT_OR
- In the OR mode, a logical or is used to write the item in the bitmap. This mode can be used to force the item to appear on the screen.
- GDM_PLOT_XOR
- In the XOR mode, a logical xor is used thus providing an inversion of the dots corresponding to the item. This mode is in general used to provide reverse video effects and can be used to show a cursor.
- GDM_PLOT_AND
- In the AND mode, a logical and is used. It can be used to clear the screen.
All the drawing operation implement a clipping mechanism to restrict the drawing to the LCD screen and optionally a region that you specify. The coordinates can be outside of the LCD screen and outside of the clipping region. Drawing will take place only within the clipping region. For example, it is safe to do:
static gdm_display display;
...
/ * Clear screen. * /
gdm_set_gc (&display, GDM_PLOT_AND);
gdm_fill_rectangle (&display, -100, -200, 1024, 2048);
/ * Draw a line crossing the screen. * /
gdm_set_gc (&display, GDM_PLOT_OR);
gdm_draw_line (&display, -100, -200, 1024, 2048);
Define Documentation
|
|
Draw a continuous line.
Definition at line 443 of file display.h. |
|
|
Draw a continuous closed line (polygon).
Definition at line 446 of file display.h. |
|
|
Draw several segments.
Definition at line 449 of file display.h. |
Typedef Documentation
| typedef struct gdm_point gdm_point
|
|
|
|
Representation of a point. |
Function Documentation
| void gdm_draw_line |
( |
gdm_display * |
dp, |
|
|
short |
x1, |
|
|
short |
y1, |
|
|
short |
x2, |
|
|
short |
y2 |
|
) |
|
|
|
|
Draw a line between two points.
Draw a line between x1, y1 and x2, y2. The line is clipped to the display window and using the current clipping region. The points of the line are drawn using the current graphical context (or, and, xor). - Parameters:
-
| dp |
Display Manager |
| x1 |
X coordinate of first point |
| y1 |
Y coordinate of first point |
| x2 |
X coordinate of second point |
| y2 |
Y coordinate of second point |
- See also:
-
gdm_draw_lines, gdm_refresh
|
|
|
Draw a continuous line, some segments or a polygon.
Draw a continuous line, a set of segments or a polygon based on the list of points specified in pts. The mode parameter controls the drawing mode:
GDM_LINE A continuous line is drawn between each point of the list. GDM_POLYGON The continous line is closed to form a polygon GDM_SEGMENT The list of points represents couples of points to define one or several segments. npoints / 2 segments are drawn. - Parameters:
-
| dp |
Display Manager |
| pts |
Table of points to display |
| npoints |
Number of points in the table |
| mode |
Mode to display the line |
- See also:
-
gdm_draw_line, gdm_refresh
|
| void gdm_draw_point |
( |
gdm_display * |
dp, |
|
|
short |
x, |
|
|
short |
y |
|
) |
|
|
|
|
Draw a point on the graphic display.
The point at x, y is plotted using the current color and graphic operation. The point is clipped to the current display clipping region. The point is plotted in the bitmap only and a display refresh is necessary to make the change visible. - Parameters:
-
| dp |
Display manager |
| x |
X coordinate |
| y |
Y coordinate |
- See also:
-
gdm_draw_points, gdm_refresh
|
|
|
Draw a list of points on the graphic display.
The points specified in the table pts are plotted using the current color and graphic operation. The points are clipped to the current display clipping region. The point is plotted in the bitmap only and a display refresh is necessary to make the change visible. - Parameters:
-
| dp |
Display manager |
| pts |
Table of points to display |
| npoints |
Number of points to print |
- See also:
-
gdm_draw_point, gdm_refresh
|
| void gdm_fill_rectangle |
( |
gdm_display * |
dp, |
|
|
short |
x, |
|
|
short |
y, |
|
|
unsigned short |
width, |
|
|
unsigned short |
height |
|
) |
|
|
|
|
Fill a rectangle with current gc mode.
The rectangle defined by x, y, width, height is filled with the current graphical context. The rectangle is clipped to the display and to the optional clipping region. - Parameters:
-
| dp |
Display Manager |
| x |
X coordinate |
| y |
Y coordinate |
| width |
Width of rectangle |
| height |
Height of rectangle |
- See also:
-
gdm_refresh
|
|
|