Details
enum GnomePrintReturnCode
typedef enum {
GNOME_PRINT_OK = 0,
GNOME_PRINT_ERROR_UNKNOWN = -1,
GNOME_PRINT_ERROR_BADVALUE = -2,
GNOME_PRINT_ERROR_NOCURRENTPOINT = -3,
GNOME_PRINT_ERROR_NOCURRENTPATH = -4,
GNOME_PRINT_ERROR_TEXTCORRUPT = -5,
GNOME_PRINT_ERROR_BADCONTEXT = -6,
GNOME_PRINT_ERROR_NOPAGE = -7,
GNOME_PRINT_ERROR_NOMATCH = -8
} GnomePrintReturnCode; |
struct GnomePrintContext
struct GnomePrintContext; |
gnome_print_context_new ()
Create new printing context from config. You have to have set
all the options/settings beforehand, as changing the config of
an existing context has undefined results.
Also, if creating the context by hand, it completely ignores layout and
orientation value. If you need those, use GnomePrintJob. The
latter also can create output context for you, so in most cases
you may want to ignore gnome_print_context_new at all.
gnome_print_context_close ()
Informs given GnomePrintContext that application has finished print
job. From that point on, pc has to be considered illegal pointer,
and any further printing operation with it may kill application.
Some printing contexts may not start printing before context is
closed.
gnome_print_newpath ()
Resets currentpath to empty path. As currentpoint is defined as
the last point of open path segment, is also erases currentpoint.
gnome_print_moveto ()
Starts new subpath in currentpath with coordinates x,y.
Moves currentpoint to x,y.
gnome_print_lineto ()
Adds new straight line segment from currentpoint to x,y to currentpath.
Moves currentpoint to x,y.
If currentpoint is not defined, returns GNOME_PRINT_ERROR_NOCURRENTPOINT.
gnome_print_curveto ()
gint gnome_print_curveto (GnomePrintContext *pc,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2,
gdouble x3,
gdouble y3); |
Adds new cubig bezier segment with control points x1,y1 and
x2,y2 and endpoint x3,y3 to currentpath.
Moves currentpoint to x3,y3.
If currentpoint is not defined, returns GNOME_PRINT_ERROR_NOCURRENTPOINT.
gnome_print_closepath ()
Closes the last segment of currentpath, optionally drawing straight
line segment from its endpoint to starting point.
Erases currentpoint.
If currentpath is empty, returns GNOME_PRINT_ERROR_NOCURRENTPATH.
gnome_print_strokepath ()
Converts currentpath to new path, that is identical to area painted
by gnome_print_stroke function, using currentpath. I.e. strokepath
followed by fill giver result identical to stroke.
If currentpath is empty, returns GNOME_PRINT_ERROR_NOCURRENTPATH.
Stroked path is always closed, so currentpoint is erased.
gnome_print_bpath ()
gint gnome_print_bpath (GnomePrintContext *pc,
const ArtBpath *bpath,
gboolean append); |
Adds all bpath segments up to ART_END to currentpath. If append
is false, currentpath is cleared first, otherwise segments are
appended to existing path.
This is identical to adding all segments by hand, so the final state
of currentpoint depends on segments processed.
gnome_print_vpath ()
gint gnome_print_vpath (GnomePrintContext *pc,
const ArtVpath *vpath,
gboolean append); |
Adds all vpath line segments up to ART_END to currentpath. If append
is false, currentpath is cleared first, otherwise segments are
appended to existing path.
This is identical to adding all segments by hand, so the final state
of currentpoint depends on segments processed.
gnome_print_arcto ()
gint gnome_print_arcto (GnomePrintContext *pc,
gdouble x,
gdouble y,
gdouble radius,
gdouble angle1,
gdouble angle2,
gint direction); |
Adds an arc with control points x and y with a radius radius and from
angle1 to andgle2 in degrees. direction 1 is clockwise 0 counterclockwise
gnome_print_setrgbcolor ()
gint gnome_print_setrgbcolor (GnomePrintContext *pc,
gdouble r,
gdouble g,
gdouble b); |
Sets color in graphic state to RGB triplet. This does not imply anything
about which colorspace is used internally.
Channel values are clamped to 0.0 - 1.0 region, 0.0 meaning minimum.
gnome_print_setopacity ()
Sets painting opacity in graphic state to given value.
Value is clamped to 0.0 - 1.0 region, 0.0 meaning full transparency and
1.0 completely opaque paint.
gnome_print_setlinewidth ()
Sets line width in graphic state to given value.
Value is given in user coordinates, so effective line width depends on
CTM at the moment of gnome_print_stroke or gnome_print_strokepath.
Line width is always uniform in all directions, regardless of stretch
factor of CTM.
Default line width is 1.0 in user coordinates.
gnome_print_setmiterlimit ()
Sets minimum angle between two lines, in which case miter join is
used. For smaller angles, join is beveled.
Default miter limit is 4 degrees.
gnome_print_setlinejoin ()
Sets join type for non-colinear line segments.
0 - miter
1 - round
2 - bevel
Default join type is miter.
gnome_print_setlinecap ()
Sets cap type for line endpoints.
0 - butt
1 - round
2 - square
Default cap type is butt.
gnome_print_setdash ()
gint gnome_print_setdash (GnomePrintContext *pc,
gint n_values,
const gdouble *values,
gdouble offset); |
Sets line dashing to given pattern. If n_dash is odd, the result is,
as if actual number of segments is 2 times bigger, and 2 copies
of dash arrays concatenated.
If n_values is 0, line is set solid.
Dash segment lengths are given in user coordinates, so the actual
dash lengths depend on CTM at the time of gnome_print_stroke or
gnome_print_strokepath. Dashing is always uniform in all directions,
regardless of the stretching factor of CTM.
Default is solid line.
gnome_print_setfont ()
Sets font in graphic state. Font is referenced by gnome print,
so caller may discard it immediately afterwards.
Default font is system dependent.
gnome_print_clip ()
Defines drawing region as inside area of currentpath. If path is
self-intersecting or consists of several overlapping subpaths,
nonzero rule is used to define the inside orea of path.
All open subpaths of currentpath are closed.
If currentpath is empty, GNOME_PRINT_ERROR_NOCURRENTPATH is
returned.
Currentpath is emptied by this function.
gnome_print_eoclip ()
Defines drawing region as inside area of currentpath. If path is
self-intersecting or consists of several overlapping subpaths,
even-odd rule is used to define the inside area of path.
All open subpaths of currentpath are closed.
If currentpath is empty, GNOME_PRINT_ERROR_NOCURRENTPATH is
returned.
Currentpath is emptied by this function.
gnome_print_concat ()
Appends matrix to current transformation matrix (CTM). The resulting
transformation from user coordinates to page coordinates is, as
if coordinates would first be transformed by matrix, and the
results by CTM.
Matrix is given in column order, i.e.
X' = X * m[0] + Y * m[2] + m[4]
Y' = X * m[1] + Y * m[3] + m[5]
gnome_print_scale ()
Scales user coordinate system by given X and Y values.
gnome_print_rotate ()
Rotates user coordinate system theta degrees counterclockwise.
gnome_print_translate ()
Move the starting point of user coordinate system to given point.
gnome_print_gsave ()
Saves current graphic state (transformation, color, line properties, font)
into stack (push). Values itself remain unchanged.
You can later restore saved values, using gnome_print_grestore, but not
over page boundaries. Graphic state stack has to be cleared for each
gnome_print_showpage, i.e. the number of gnome_print_gsave has to
match the number of gnome_print_grestore for each page.
gnome_print_grestore ()
Retrieves last saved graphic state from stack (pop). Stack has to be
at least the size of one.
gnome_print_fill ()
Fills the inside area of currentpath, using current graphic state.
If path is self-intersecting or consists of several overlapping subpaths,
nonzero rule is used to define the inside area of path.
All open subpaths of currentpath are closed.
If currentpath is empty, GNOME_PRINT_ERROR_NOCURRENTPATH is
returned.
Currentpath is emptied by this function.
gnome_print_eofill ()
Fills the inside area of currentpath, using current graphic state.
If path is self-intersecting or consists of several overlapping subpaths,
even-odd rule is used to define the inside area of path.
All open subpaths of currentpath are closed.
If currentpath is empty, GNOME_PRINT_ERROR_NOCURRENTPATH is
returned.
Currentpath is emptied by this function.
gnome_print_stroke ()
Strokes currentpath, i.e. draws line along it, with style, defined
by current graphic state values.
If currentpath is empty, GNOME_PRINT_ERROR_NOCURRENTPATH is
returned.
Currentpath is emptied by this function.
gnome_print_show ()
Draws UTF-8 text at currentpoint, using current font from graphic
state.
Input text is validated, and GNOME_PRINT_ERROR_BADVALUE returned,
if it is not valid UTF-8.
Both currentpath and currentpoint are erased.
gnome_print_show_sized ()
Draws UTF-8 text at currentpoint, using current font from graphic
state.
Input text is validated, and GNOME_PRINT_ERROR_BADVALUE returned,
if it is not valid UTF-8.
Both currentpath and currentpoint are erased.
gnome_print_glyphlist ()
Draws text, using GnomeGlyphList rich text format.
Glyphlist is rendered in user coordinates, starting from
currentpoint.
Both currentpath and currentpoint are erased.
gnome_print_grayimage ()
gint gnome_print_grayimage (GnomePrintContext *pc,
const guchar *data,
gint width,
gint height,
gint rowstride); |
Draws grayscale image into unit square (0,0 - 1,1) in current coordinate
system.
Image buffer has to be 1 byte per pixel, with value 255 marking
white and 0 black.
gnome_print_rgbimage ()
gint gnome_print_rgbimage (GnomePrintContext *pc,
const guchar *data,
gint width,
gint height,
gint rowstride); |
Draws RGB color image into unit square (0,0 - 1,1) in current coordinate
system.
Image buffer has to be 3 bytes per pixel, order RGB, with value 255 marking
maximum and 0 minimum value.
gnome_print_rgbaimage ()
gint gnome_print_rgbaimage (GnomePrintContext *pc,
const guchar *data,
gint width,
gint height,
gint rowstride); |
Draws RGB color image with transparency channel image into unit square
(0,0 - 1,1) in current coordinate system.
Image buffer has to be 4 bytes per pixel, order RGBA, with value 255 marking
maximum and 0 minimum value. Alpha value 255 means full opacity, 0 full
transparency.
gnome_print_beginpage ()
Starts new output page with name. Naming is used for interactive
contexts like GnomePrintPreview and Document Structuring Convention
conformant PostScript output.
This function has to be called before any drawing methods and immediately
after each gnome_print_showpage albeit the last one. It also resets
graphic state values (transformation, color, line properties, font),
so one has to define these again at the beginning of each page.
gnome_print_showpage ()
Finishes rendering of current page, and marks it as shown. All subsequent
drawing methods will fail, until new page is started with gnome_print_newpage.
Printing contexts may process drawing methods differently - some do
rendering immediately (like GnomePrintPreview), some accumulate all
operators to internal stack, and only after gnome_print_showpage is
any output produced.
gnome_print_line_stroked ()
gint gnome_print_line_stroked (GnomePrintContext *pc,
gdouble x0,
gdouble y0,
gdouble x1,
gdouble y1); |
gnome_print_rect_stroked ()
gint gnome_print_rect_stroked (GnomePrintContext *pc,
gdouble x,
gdouble y,
gdouble width,
gdouble height); |
gnome_print_rect_filled ()
gint gnome_print_rect_filled (GnomePrintContext *pc,
gdouble x,
gdouble y,
gdouble width,
gdouble height); |