Top |
Pattern filled graphics primitivesPattern filled graphics primitives — Patterned drawing and filling primitives |
The library also supports a pattern filled version of the basic filled primitives described above. These functions have similar parameter passing conventions as the basic ones with one difference: instead of the color value a GrxPixmap has to be passed to them.
GrxPixmap * grx_pixmap_new (const guint8 *pixels
,gint w
,gint h
,const GArray *colors
);
Build a pixmap from pixels
.
The elements of the pixels
array are used as indices in colors
. This means
that pixmaps created this way can use at most 256 colors. NOTE: any color
modifiers (GrXOR, GrOR, GrAND) OR-ed to the elements of the color table are
ignored.
GrxPixmap * grx_pixmap_new_from_bits (const guint8 *bits
,gint w
,gint h
,GrxColor fg
,GrxColor bg
);
Builds a pixmap fill pattern from bitmap data. It is useful if the width of the bitmap pattern is not eight as such bitmap patterns can not be used to build a GrBitmap structure.
GrxPixmap *
grx_pixmap_new_from_context (GrxContext *context
);
Converts a graphics context to a pixmap fill pattern.
This is useful when the pixmap can be created with graphics drawing operations. NOTE: the pixmap pattern and the original context share the drawing RAM, thus if the context is redrawn the fill pattern changes as well.
void
grx_pixmap_free (GrxPixmap *pixmap
);
Frees any dynamically allocated memory associated with the pixmap.
GrxPixmap * grx_pixmap_mirror (GrxPixmap *pixmap
,GrxPixmapMirrorFlags flags
);
Creates a new pixmap, flipping left-right and/or top-bottom as indicated by
flags
.
GrxPixmap * grx_pixmap_stretch (GrxPixmap *pixmap
,gint new_width
,gint new_height
);
Creates a new pixmap stretching pixmap
to new_width
by new_height
.
void grx_draw_pixmap (gint x
,gint y
,GrxPixmap *p
);
Draws the entire image on the current context with the top, left corner at
x
, y
.
void grx_draw_pixmap_tiled (gint x1
,gint y1
,gint x2
,gint y2
,GrxPixmap *p
);
Draws as much of the image as possible (repeating if necessary) on the
current in the rectangle defined by x1
, y1
and x2
, y2
void grx_draw_pixel_with_offset_pixmap (gint x0
,gint y0
,gint x
,gint y
,GrxPixmap *p
);
Draws a single pixel of an pixmap on the current context at x
, y
.
The color of the pixel comes from the pixmap as if p
was tiled over the
entrire context starting with the top/left of the pixmap at x0
, y0
.
void grx_draw_line_with_pixmap (gint x1
,gint y1
,gint x2
,gint y2
,GrxLineOptions *o
,GrxPixmap *p
);
Draws a line on the current context from the starting coordinates to the ending coordinates using the specified line options and pixmap.
void grx_draw_hline_with_offset_pixmap (gint x0
,gint y0
,gint x
,gint y
,gint width
,GrxPixmap *p
);
Draws a single line of an pixmap on the current context starting at x
, y
.
The pixmap can be offset from the line by specifying x0
, y0
different from
x
, y
. The pixmap is repeated if the width of the line is greater than the
width of the pixmap.
void grx_draw_box_with_pixmap (gint x1
,gint y1
,gint x2
,gint y2
,GrxLineOptions *o
,GrxPixmap *p
);
Draws a rectangle on the current context using the specified coordinates and line options and pixmap.
void grx_draw_circle_with_pixmap (gint xc
,gint yc
,gint r
,GrxLineOptions *o
,GrxPixmap *p
);
Draws a circle on the current context centered at the specified coordinates with the specified radius and line options and pixmap.
void grx_draw_ellipse_with_pixmap (gint xc
,gint yc
,gint rx
,gint ry
,GrxLineOptions *o
,GrxPixmap *p
);
Draws an ellipse on the current context using the specified line options and pattern.
The ellipse can only draw ellipses with its major axis parallel with either the X or Y coordinate axis.
void grx_draw_circle_arc_with_pixmap (gint xc
,gint yc
,gint r
,gint start
,gint end
,GrxArcStyle style
,GrxLineOptions *o
,GrxPixmap *p
);
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 line options and pixmap.
void grx_draw_ellipse_arc_with_pixmap (gint xc
,gint yc
,gint rx
,gint ry
,gint start
,gint end
,GrxArcStyle style
,GrxLineOptions *o
,GrxPixmap *p
);
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 line options and pixmap.
xc |
the X coordinate of the center of the arc |
|
yc |
the Y coordinate of the center of the arc |
|
rx |
the radius in the X direction |
|
ry |
the radius in the Y direction |
|
start |
the starting angle in 1/10ths of degrees |
|
end |
the ending angle in 1/10ths of degrees |
|
style |
the arc style |
|
o |
the line options |
|
p |
the pixmap |
void grx_draw_polyline_with_pixmap (gint n_points
,GrxPoint *points
,GrxLineOptions *o
,GrxPixmap *p
);
Draw a multi-segment line on the current context that connects each point in
the points
array using the specified line options and pixmap.
n_points |
the number of points in |
|
points |
an array of GrxPoint. |
[array length=n_points] |
o |
the line options |
|
p |
the pixmap |
void grx_draw_polygon_with_pixmap (gint n_points
,GrxPoint *points
,GrxLineOptions *o
,GrxPixmap *p
);
Draw a closed polygon on the current context that connects each point in
the points
array using the specified line options and pixmap.
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] |
o |
the line options |
|
p |
the pixmap |
void grx_draw_filled_pixel_with_pixmap (gint x
,gint y
,GrxPixmap *p
);
Draw a single pixel on the current context at the specified coordinates.
The color of the pixel comes from the pixmap as if p
was tiled over the
entrire context starting with the top/left of the pixmap at 0, 0.
void grx_draw_filled_line_with_pixmap (gint x1
,gint y1
,gint x2
,gint y2
,GrxPixmap *p
);
Draws a line on the current context from the starting coordinates to the ending coordinates using the specified pixmap.
For horizontal and vertical lines, see grx_draw_hline()
and grx_draw_vline()
.
void grx_draw_filled_box_with_pixmap (gint x1
,gint y1
,gint x2
,gint y2
,GrxPixmap *p
);
Draws a filled rectangle on the current context using the specified coordinates and pixmap.
void grx_draw_filled_box_with_offset_pixmap (gint x0
,gint y0
,gint x1
,gint y1
,gint x2
,gint y2
,GrxPixmap *p
);
Fills the rectangle x1
, y1
, x2
, y2
in the current context with the pixmap.
This pixmap can be offset from the rectangle by specifying x0
, y0
different
from x1
, y1
. The pixmap is tiled if needed to fill the rectangle.
void grx_draw_filled_circle_with_pixmap (gint xc
,gint yc
,gint r
,GrxPixmap *p
);
Draws a filled circle on the current context centered at the specified coordinates with the specified radius and pixmap.
void grx_draw_filled_ellipse_with_pixmap (gint xc
,gint yc
,gint rx
,gint ry
,GrxPixmap *p
);
Draws a filled ellipse on the current context using the specified pixmap.
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_with_pixmap (gint xc
,gint yc
,gint r
,gint start
,gint end
,GrxArcStyle style
,GrxPixmap *p
);
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 pixmap.
void grx_draw_filled_ellipse_arc_with_pixmap (gint xc
,gint yc
,gint rx
,gint ry
,gint start
,gint end
,GrxArcStyle style
,GrxPixmap *p
);
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 pixmap.
void grx_draw_filled_polygon_with_pixmap (gint n_points
,GrxPoint *points
,GrxPixmap *p
);
Draw a filled polygon on the current context that connects each point in
the points
array using the specified pixmap.
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] |
p |
the pixmap |
void grx_draw_filled_convex_polygon_with_pixmap (gint n_points
,GrxPoint *points
,GrxPixmap *p
);
Draw a filled polygon on the current context that connects each point in
the points
array using the specified pixmap.
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] |
p |
the pixmap |