Top |
There is a second set of the graphics primitives which operates in user coordinates. Every context has a user to screen coordinate mapping associated with it.
If an application wants to take advantage of the user to screen coordinate mapping it has to use the user coordinate version of the graphics primitives. These have exactly the same parameter passing conventions as their screen coordinate counterparts. NOTE: the user coordinate system is not initialized by the library! The application has to set up its coordinate mapping before calling any of the use coordinate drawing functions – otherwise the program will almost certainly exit (in a quite ungraceful fashion) with a 'division by zero' error.
void grx_user_set_window (gint x1
,gint y1
,gint x2
,gint y2
);
Specifies the user window.
A call to this function it in fact specifies the virtual coordinate limits which will be mapped onto the current context regardless of the size of the context. For example, the call:
GrSetUserWindow(0,0,11999,8999);
tells the library that the program will perform its drawing operations in a coordinate system X:0...11999 (width = 12000) and Y:0...8999 (height = 9000). This coordinate range will be mapped onto the total area of the current context. The virtual coordinate system can also be shifted. For example:
GrSetUserWindow(5000,2000,16999,10999);
The user coordinates can even be used to turn the usual left-handed coordinate system (0:0 corresponds to the upper left corner) to a right handed one (0:0 corresponds to the bottom left corner) by calling:
GrSetUserWindow(0,8999,11999,0);
void grx_user_get_window (gint *x1
,gint *y1
,gint *x2
,gint *y2
);
Gets the user window of the current context.
void grx_user_convert_user_to_screen (gint *x
,gint *y
);
Converts x
and y
from coordinates in the user window to coordinates in the
current context.
void grx_user_convert_screen_to_user (gint *x
,gint *y
);
Converts x
and y
from coordinates in the current context to coordinates in
the user window.
void grx_user_draw_pixel (gint x
,gint y
,GrxColor c
);
Draw a single pixel on the current context at the specified user coordinates.
void grx_user_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_user_draw_hline()
and
grx_user_draw_vline()
.
void grx_user_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_user_draw_line()
.
void grx_user_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_user_draw_line()
.
void grx_user_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_user_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_user_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_user_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_user_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_user_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_user_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_user_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_user_draw_framed_box (gint x1
,gint y1
,gint x2
,gint y2
,gint width
,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_user_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_user_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_user_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_user_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_user_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_user_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_user_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.
GrxColor grx_user_get_pixel_at (gint x
,gint y
);
Gets the color value of the pixel in the current context at the specified coordinates.
GrxColor grx_context_get_pixel_at_user (GrxContext *context
,gint x
,gint y
);
Gets the color value of the pixel in the context at the specified coordinates.
Also see grx_get_pixel_at()
for operating on the current context.
void grx_user_draw_line_with_options (gint x1
,gint y1
,gint x2
,gint y2
,const GrxLineOptions *o
);
Draws a line on the current context from the starting coordinates to the ending coordinates using the specified options.
void grx_user_draw_box_with_options (gint x1
,gint y1
,gint x2
,gint y2
,const GrxLineOptions *o
);
Draws a rectangle on the current context using the specified coordinates and options.
void grx_user_draw_circle_with_options (gint xc
,gint yc
,gint r
,const GrxLineOptions *o
);
Draws a circle on the current context centered at the specified coordinates with the specified radius and options.
void grx_user_draw_ellipse_with_options (gint xc
,gint yc
,gint rx
,gint ry
,const GrxLineOptions *o
);
Draws an ellipse on the current context using the specified options.
The ellipse can only draw ellipses with its major axis parallel with either the X or Y coordinate axis
void grx_user_draw_circle_arc_with_options (gint xc
,gint yc
,gint r
,gint start
,gint end
,GrxArcStyle style
,const GrxLineOptions *o
);
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 options.
void grx_user_draw_ellipse_arc_with_options (gint xc
,gint yc
,gint rx
,gint ry
,gint start
,gint end
,GrxArcStyle style
,const GrxLineOptions *o
);
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 options.
void grx_user_draw_polyline_with_options (gint n_points
,GrxPoint *points
,const GrxLineOptions *o
);
Draw a multi-segment line on the current context that connects each point in
the points
array using the specified options.
n_points |
the number of points in |
|
points |
an array of GrxPoint. |
[array length=n_points] |
o |
the options |
void grx_user_draw_polygon_with_options (gint n_points
,GrxPoint *points
,const GrxLineOptions *o
);
Draw a closed polygon on the current context that connects each point in
the points
array using the specified options.
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 options |
void grx_user_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_user_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_user_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_user_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_user_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_user_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_user_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 pattern.
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_user_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_user_draw_filled_pixel_with_pixmap (gint x
,gint y
,GrxPixmap *p
);
Draw a single pixel on the current context at the specified coordinates.
void grx_user_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_user_draw_filled_box_with_pixmap (gint x1
,gint y1
,gint x2
,int y2
,GrxPixmap *p
);
Draws a filled rectangle on the current context using the specified coordinates and pixmap.
void grx_user_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_user_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_user_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_user_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_user_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_user_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 |
void grx_user_flood_fill_with_pixmap (gint x
,gint y
,GrxColor border
,GrxPixmap *p
);
Flood-fills the area of the current context bounded by the color border
using x
, y
as the starting point.
void grx_user_draw_text (const gchar *text
,gint x
,gint y
,GrxTextOptions *options
);