Top |
void
grx_clear_screen (GrxColor bg
);
Clears the screen using the specified background color.
Thanks to the special GrxColor definition, you can do more than simple clear with this functions, by example with:
grx_clear_screen (grx_color_to_xor_mode (grx_color_get_white ()));
the screen is negativized, do it again and the screen is restored.
void
grx_clear_context (GrxColor bg
);
Clears the current context using the specified background color.
Thanks to the special GrxColor definition, you can do more than simple clear with this functions, by example with:
grx_clear_context (grx_color_to_xor_mode (grx_color_get_white ()));
the context is negativized, do it again and the context is restored.
void
grx_clear_clip_box (GrxColor bg
);
Clears the current clip box using the specified background color.
Thanks to the special GrxColor definition, you can do more than simple clear with this functions, by example with:
grx_clear_clip_box (grx_color_to_xor_mode (grx_color_get_white ()));
the clip box is negativized, do it again and the clip box is restored.
void grx_draw_pixel (gint x
,gint y
,GrxColor c
);
Draw a single pixel on the current context at the specified coordinates.
void grx_draw_line (gint x1
,gint y1
,gint x2
,gint y2
,GrxColor c
);
Draws a line on the current context from the starting coordinates to the ending coordinates using the specified color.
For horizontal and vertical lines, see grx_draw_hline()
and grx_draw_vline()
.
void grx_draw_hline (gint x1
,gint x2
,gint y
,GrxColor c
);
Draws a horizontal line on the current context from the starting coordinates to the ending coordinates using the specified color.
This is more efficient that using grx_draw_line()
.
void grx_draw_vline (gint x
,gint y1
,gint y2
,GrxColor c
);
Draws a vertical line on the current context from the starting coordinates to the ending coordinates using the specified color.
This is more efficient that using grx_draw_line()
.
void grx_draw_box (gint x1
,gint y1
,gint x2
,gint y2
,GrxColor c
);
Draws a rectangle on the current context using the specified coordinates and color.
void grx_draw_rounded_box (gint x1
,gint y1
,gint x2
,gint y2
,gint r
,GrxColor c
);
Draws a rectangle with rounded corners on the current context using the specified coordinates and color.
void grx_draw_circle (gint xc
,gint yc
,gint r
,GrxColor c
);
Draws a circle on the current context centered at the specified coordinates with the specified radius and color.
void grx_draw_ellipse (gint xc
,gint yc
,gint rx
,gint ry
,GrxColor c
);
Draws an ellipse on the current context using the specified color.
The ellipse can only draw ellipses with its major axis parallel with either the X or Y coordinate axis
void grx_draw_circle_arc (gint xc
,gint yc
,gint r
,gint start
,gint end
,GrxArcStyle style
,GrxColor c
);
Draws an arc on the current context centered at the specified coordinates from the starting angle to the ending angle with the specified radius, arc style and color.
void grx_draw_ellipse_arc (gint xc
,gint yc
,gint rx
,gint ry
,gint start
,gint end
,GrxArcStyle style
,GrxColor c
);
Draws an arc on the current context centered at the specified coordinates from the starting angle to the ending angle with the specified radii, arc style and color.
void grx_draw_polyline (gint n_points
,GrxPoint *points
,GrxColor c
);
Draw a multi-segment line on the current context that connects each point in
the points
array using the specified color.
n_points |
the number of points in |
|
points |
an array of GrxPoint. |
[array length=n_points] |
c |
the color |
void grx_draw_polygon (gint n_points
,GrxPoint *points
,GrxColor c
);
Draw a closed polygon on the current context that connects each point in
the points
array using the specified color.
Coordinate arrays can either contain or omit the closing edge of the polygon. It will be automatically appended to the list if it is missing.
n_points |
the number of points in |
|
points |
an array of GrxPoint. |
[array length=n_points] |
c |
the color |
void grx_get_last_arc_coordinates (gint *xs
,gint *ys
,gint *xe
,gint *ye
,gint *xc
,gint *yc
);
Gets the starting, ending and center coordinates of the arc from the most recent call to an arc function.
GArray * grx_generate_ellipse (gint xc
,gint yc
,gint rx
,gint ry
);
Creates an array of points that describe the ellipse with the specified coordinates and radii.
These coordinates can be drawn using polygon functions. This is more efficient when drawing the same or similar circles and ellipses multiple times.
GArray * grx_generate_ellipse_arc (gint xc
,gint yc
,gint rx
,gint ry
,gint start
,gint end
);
Creates an array with points that describe the arc with the specified coordinates, radii, and starting and ending angles.
These coordinates can be drawn using polyline functions. This is more efficient when drawing the same or similar arcs multiple times.
GArray *
grx_generate_points (GArray *coords
);
Creates an array of points.
This function is intended for use with language bindings that don't have
an elegant way to create an array of points. Each pair of coordinates is
converted into a point, so the returned array will be 1/2 the length of
coords
.
void grx_draw_filled_box (gint x1
,gint y1
,gint x2
,gint y2
,GrxColor c
);
Draws a filled rectangle on the current context using the specified coordinates and color.
void grx_draw_filled_rounded_box (gint x1
,gint y1
,gint x2
,gint y2
,gint r
,GrxColor c
);
Draws a filled rectangle with rounded corners on the current context using the specified coordinates and color.
void grx_draw_framed_box (gint x1
,gint y1
,gint x2
,gint y2
,gint width
,const GrxFramedBoxColors *c
);
Draws a framed rectangle on the current context using the specified
coordinates and colors. The coordinates specify the interior box. The border
extends outside of the box using the given width
.
void grx_draw_filled_circle (gint xc
,gint yc
,gint r
,GrxColor c
);
Draws a filled circle on the current context centered at the specified coordinates with the specified radius and color.
void grx_draw_filled_ellipse (gint xc
,gint yc
,gint rx
,gint ry
,GrxColor c
);
Draws a filled ellipse on the current context using the specified color.
The ellipse can only draw ellipses with its major axis parallel with either the X or Y coordinate axis
void grx_draw_filled_circle_arc (gint xc
,gint yc
,gint r
,gint start
,gint end
,GrxArcStyle style
,GrxColor c
);
Draws a filled arc on the current context centered at the specified coordinates from the starting angle to the ending angle with the specified radius, arc style and color.
void grx_draw_filled_ellipse_arc (gint xc
,gint yc
,gint rx
,gint ry
,gint start
,gint end
,GrxArcStyle style
,GrxColor c
);
Draws a filled arc on the current context centered at the specified coordinates from the starting angle to the ending angle with the specified radii, arc style and color.
void grx_draw_filled_polygon (gint n_points
,GrxPoint *points
,GrxColor c
);
Draw a filled polygon on the current context that connects each point in
the points
array using the specified color.
Coordinate arrays can either contain or omit the closing edge of the polygon. It will be automatically appended to the list if it is missing.
n_points |
the number of points in |
|
points |
an array of GrxPoint. |
[array length=n_points] |
c |
the color |
void grx_draw_filled_convex_polygon (gint n_points
,GrxPoint *points
,GrxColor c
);
Draw a filled polygon on the current context that connects each point in
the points
array using the specified color.
Coordinate arrays can either contain or omit the closing edge of the polygon. It will be automatically appended to the list if it is missing.
This version is slightly more efficient that grx_draw_filled_polygon()
but
requires that the polygon is convex. It can also be used to fill some concave
polygons whose boundaries do not intersect any horizontal scan line more than
twice. It can also be used to fill several disjoint nonoverlapping polygons
in a single operation.
n_points |
the number of points in |
|
points |
an array of GrxPoint. |
[array length=n_points] |
c |
the color |
void grx_flood_fill (gint x
,gint y
,GrxColor border
,GrxColor c
);
Flood-fills the area of the current context bounded by the color border
using x
, y
as the starting point.
void grx_flood_spill (gint x1
,gint y1
,gint x2
,gint y2
,GrxColor old_c
,GrxColor new_c
);
Replaces old color with new color in the current context in the area bounded by the rectangle x1, y1, x2, y2.
This is quite useful for highlighting a selected item in a list, or changing a selected color(s) in a multi colored area.
void grx_flood_spill2 (gint x1
,gint y1
,gint x2
,gint y2
,GrxColor old_c1
,GrxColor new_c1
,GrxColor old_c2
,GrxColor new_c2
);
Replaces two old colors with two new colors in the current context in the
area bounded by the rectangle x1, y1, x2, y2. old_c1
is replaced with
new_c1
and old_c2
is replaced with new_c2
.
This is quite useful for highlighting a selected item in a list, or changing a selected color(s) in a multi colored area.
x1 |
the left edge of the bounding rectangle |
|
y1 |
the top edge of the bounding rectangle |
|
x2 |
the right edge of the bounding rectangle |
|
y2 |
the bottom edge of the bounding rectangle |
|
old_c1 |
the first color to be replaced |
|
new_c1 |
the first new color |
|
old_c2 |
the second color to be replaced |
|
new_c2 |
the second new color |
GrxColor grx_get_pixel_at (gint x
,gint y
);
Gets the color value of the pixel in the current context at the specified coordinates.
void grx_bit_blt (gint x
,gint y
,GrxContext *src
,gint x1
,gint y1
,gint x2
,gint y2
,GrxColor op
);
Copies an area bounded by x1, y2, x2, y2 in the source context to the current context at the location specified by dx, dy using the specified operation.
x |
the destination X coordinate |
|
y |
the destination Y coordinate |
|
src |
the source context or |
[nullable] |
x1 |
the source bounding rectangle left coordinate |
|
y1 |
the source bounding rectangle top coordinate |
|
x2 |
the source bounding rectangle right coordinate |
|
y2 |
the source bounding rectangle bottom coordinate |
|
op |
the GrxColorMode operator and optional transparent color |
void grx_bit_blt_1bpp (gint x
,gint y
,GrxContext *src
,gint x1
,gint y1
,gint x2
,gint y2
,GrxColor fg
,GrxColor bg
);
Copies an area bounded by x1, y2, x2, y2 in the source context to the current context at the location specified by dx, dy using the specified operation.
The source must be a 1 bit per pixel bitmap. The foreground color is used for bits = 1 and the background color is used for bits = 0.
x |
the destination X coordinate |
|
y |
the destination Y coordinate |
|
src |
the source context or |
[nullable] |
x1 |
the source bounding rectangle left coordinate |
|
y1 |
the source bounding rectangle top coordinate |
|
x2 |
the source bounding rectangle right coordinate |
|
y2 |
the source bounding rectangle bottom coordinate |
|
fg |
the foreground color |
|
bg |
the background color |
const GrxColor * grx_get_scanline (gint x1
,gint x2
,gint y
,guint *n
);
An efficient way to get pixels from the current context. Important: the return value is only valid until the next Grx call!
x1 |
the starting X coordinate |
|
x2 |
the ending X coordinate |
|
y |
the Y coordinate |
|
n |
the length of the array. |
[out][optional] |
an array of color values from the scanned pixels or NULL
if there was
an error.
[array length=n][nullable][transfer none]
void grx_put_scanline (gint x1
,gint x2
,gint y
,const GrxColor *scan_line
,GrxColor op
);
Writes scan_data
to the current context using the op
operation.
Data values in scan_data
must fit GRX_COLOR_VALUE_MASK otherwise the
results are implementation dependent. So you can't supply operation code
with the pixel data!
Indicates how an arc should be drawn.
typedef struct { GrxColor background; GrxColor border_top; GrxColor border_right; GrxColor border_bottom; GrxColor border_left; } GrxFramedBoxColors;
Struct to hold colors for a framed box.