GNOME_PRINT_OK or positive value on success, negative error code on failure.
The newpath() method resets currentpath to empty path. As currentpoint is defined as the last point of open path segment, is
also erases currentpoint.
gnomeprint.Context.moveto
def moveto(x, y)
x :
X position in user coordinates.
y :
Y position in user coordinates.
Returns :
GNOME_PRINT_OK or positive value on success, negative error code on failure.
The moveto() method starts new subpath in currentpath with coordinates x,y. Moves currentpoint to x,y.
gnomeprint.Context.lineto
def lineto(x, y)
x :
X position in user coordinates.
y :
Y position in user coordinates.
Returns :
GNOME_PRINT_OK or positive value on success, negative error code on failure.
The moveto() method 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.
gnomeprint.Context.curveto
def curveto(x1, y1, x2, y2, x3, y3)
x1 :
X position of first control point in user coordinates.
y1 :
Y position of first control point in user coordinates.
x2 :
X position of second control point in user coordinates.
y2 :
Y position of second control point in user coordinates.
x3 :
X position of third control point in user coordinates.
y3 :
Y position of third control point in user coordinates.
Returns :
GNOME_PRINT_OK or positive value on success, negative error code on failure.
The curveto() method 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.
gnomeprint.Context.closepath
def closepath()
Returns :
GNOME_PRINT_OK or positive value on success, negative error code on failure.
The closepath() method 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.
gnomeprint.Context.strokepath
def strokepath()
Returns :
GNOME_PRINT_OK or positive value on success, negative error code on failure.
The strokepath() method 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.
gnomeprint.Context.bpath
def bpath(bpath, append)
bpath :
a list of ArtBpath segments
append :
whether to append to currentpath
Returns :
GNOME_PRINT_OK or positive value on success, negative error code on failure.
The bpath() method 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.
gnomeprint.Context.vpath
def vpath(vpath, append)
vpath :
a list of ArtVpath segments
append :
whether to append to currentpath
Returns :
GNOME_PRINT_OK or positive value on success, negative error code on failure.
The vpath() method 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.
gnomeprint.Context.arcto
def arcto(x, y, radius, angle1, angle2, direction)
x :
X position of control point in user coordinates.
y :
Y position of control point in user coordinates.
radius :
the radius of the arc.
angle1 :
start angle in degrees.
angle2 :
end angle in degrees.
direction :
direction of movement, 0 counterclockwise 1 clockwise.
Returns :
GNOME_PRINT_OK or positive value on success, negative error code on failure.
The arcto() method 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
gnomeprint.Context.setrgbcolor
def setrgbcolor(r, g, b)
r :
Red channel value.
g :
Green channel value.
b :
Blue channel value.
Returns :
GNOME_PRINT_OK or positive value on success, negative error code on failure.
The setrgbcolor() method 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.
gnomeprint.Context.setopacity
def setopacity(opacity)
opacity :
opacity value.
Returns :
GNOME_PRINT_OK or positive value on success, negative error code on failure.
The setopacity() method 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.
gnomeprint.Context.setlinewidth
def setlinewidth(width)
width :
line width in user coordinates.
Returns :
GNOME_PRINT_OK or positive value on success, negative error code on failure.
The setlinewidth() method 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 stroke or
strokepath. Line width is always uniform in all directions, regardless of stretch factor of
CTM. Default line width is 1.0 in user coordinates.
gnomeprint.Context.setmiterlimit
def setmiterlimit(limit)
limit :
miter limit in degrees.
Returns :
GNOME_PRINT_OK or positive value on success, negative error code on failure.
The setmiterlimit() method 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.
gnomeprint.Context.setlinejoin
def setlinejoin(join_type)
join_type :
integer indicating join type.
Returns :
GNOME_PRINT_OK or positive value on success, negative error code on failure.
The setlinejoin() method sets join type for non-colinear line segments. 0 - miter 1 - round 2 - bevel Default join type is
miter.
gnomeprint.Context.setlinecap
def setlinecap(cap_type)
cap_type :
integer indicating cap type.
Returns :
GNOME_PRINT_OK or positive value on success, negative error code on failure.
The setlinecap() method sets cap type for line endpoints. 0 - butt 1 - round 2 - square Default cap type is butt.
gnomeprint.Context.setdash
def setdash(n_values, values, offset)
n_values :
number of dash segment lengths.
values :
nrray of dash segment lengths.
offset :
line starting offset in dash.
Returns :
GNOME_PRINT_OK or positive value on success, negative error code on failure.
The setdash() method 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 stroke or
strokepath. Dashing is always uniform in all directions, regardless of the stretching factor
of CTM. Default is solid line.
gnomeprint.Context.setfont
def setfont(font)
font :
GnomeFont to use for text.
Returns :
GNOME_PRINT_OK or positive value on success, negative error code on failure.
The setfont() method sets font in graphic state. Font is referenced by gnome print, so caller may discard it immediately
afterwards. Default font is system dependent.
gnomeprint.Context.clip
def clip()
Returns :
GNOME_PRINT_OK or positive value on success, negative error code on failure.
The clip() method 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.
gnomeprint.Context.eoclip
def eoclip()
Returns :
GNOME_PRINT_OK or positive value on success, negative error code on failure.
The erclip() method 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.
gnomeprint.Context.concat
def concat(matrix)
matrix :
3x2 affine transformation matrix.
Returns :
GNOME_PRINT_OK or positive value on success, negative error code on failure.
The concat() method 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]
gnomeprint.Context.scale
def scale(sx, sy)
sx :
X scale.
sy :
Y scale.
Returns :
GNOME_PRINT_OK or positive value on success, negative error code on failure.
The scale() method scales user coordinate system by given X and Y values.
gnomeprint.Context.rotate
def rotate(theta)
theta :
angle in degrees.
Returns :
GNOME_PRINT_OK or positive value on success, negative error code on failure.
The scale() method rotates user coordinate system theta degrees counterclockwise.
gnomeprint.Context.translate
def translate(x, y)
x :
new starting X.
y :
new starting Y.
Returns :
GNOME_PRINT_OK or positive value on success, negative error code on failure.
The translate() method move the starting point of user coordinate system to given point.
gnomeprint.Context.gsave
def gsave()
Returns :
GNOME_PRINT_OK or positive value on success, negative error code on failure.
The gsave() method saves current graphic state (transformation, color, line properties, font) into stack (push). Values itself
remain unchanged. You can later restore saved values, using grestore, but not over page
boundaries. Graphic state stack has to be cleared for each showpage, i.e. the number of
gsave has to match the number of
grestore for each page.
gnomeprint.Context.grestore
def grestore()
Returns :
GNOME_PRINT_OK or positive value on success, negative error code on failure.
The grestore() method retrieves last saved graphic state from stack (pop). Stack has to be at least the size of one.
gnomeprint.Context.fill
def fill()
Returns :
GNOME_PRINT_OK or positive value on success, negative error code on failure.
The fill() method 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.
gnomeprint.Context.eofill
def eofill()
Returns :
GNOME_PRINT_OK or positive value on success, negative error code on failure.
The eofill() method 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.
gnomeprint.Context.stroke
def stroke()
Returns :
GNOME_PRINT_OK or positive value on success, negative error code on failure.
The stroke() method 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.
gnomeprint.Context.show
def show(text)
text :
Null-terminated UTF-8 string.
Returns :
GNOME_PRINT_OK or positive value on success, negative error code on failure.
The show() method 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.
gnomeprint.Context.show_sized
def show_sized(text, bytes)
text :
UTF-8 text string.
bytes :
number of bytes to use from string.
Returns :
GNOME_PRINT_OK or positive value on success, negative error code on failure.
The show_sized() method 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.
gnomeprint.Context.glyphlist
def glyphlist(text)
glyphlist :
GnomeGlyphList text object.
Returns :
GNOME_PRINT_OK or positive value on success, negative error code on failure.
The glyphlist() method draws text, using GnomeGlyphList rich text format. Glyphlist is rendered in user coordinates, starting
from currentpoint. Both currentpath and currentpoint are erased.
gnomeprint.Context.grayimage
def grayimage(data, width, height, rowstride)
data :
pointer to image pixel buffer.
width :
image buffer width.
height :
image buffer height.
rowstride :
image buffer rowstride.
Returns :
GNOME_PRINT_OK or positive value on success, negative error code on failure.
The grayimage() method 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.
gnomeprint.Context.rgbimage
def rgbimage(data, width, height, rowstride)
data :
pointer to image pixel buffer.
width :
image buffer width.
height :
image buffer height.
rowstride :
image buffer rowstride.
Returns :
GNOME_PRINT_OK or positive value on success, negative error code on failure.
The rgbimage() method 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.
gnomeprint.Context.rgbaimage
def rgbaimage(data, width, height, rowstride)
data :
pointer to image pixel buffer.
width :
image buffer width.
height :
image buffer height.
rowstride :
image buffer rowstride.
Returns :
GNOME_PRINT_OK or positive value on success, negative error code on failure.
The rgbaimage() method 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.
gnomeprint.Context.beginpage
def beginpage(name)
name :
name of the page, NULL if you just want to use the page number of the page.
Returns :
GNOME_PRINT_OK or positive value on success, negative error code on failure.
The glyphlist() method 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
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.
gnomeprint.Context.showpage
def showpage()
Returns :
GNOME_PRINT_OK or positive value on success, negative error code on failure.
The showpage() method finishes rendering of current page, and marks it as shown. All subsequent drawing methods will fail,
until new page is started with newpage. Printing contexts may process drawing methods
differently - some do rendering immediately (like GnomePrintPreview), some accumulate all operators to internal stack, and only after
showpage is any output produced.
gnomeprint.Context.line_stroked
def line_stroked(x0, y0, x1, y1)
x0 :
X position of start point in user coordinates.
y0 :
Y position of start point in user coordinates.
x1 :
X position of end point in user coordinates.
y1 :
Y position of end point in user coordinates.
Returns :
GNOME_PRINT_OK or positive value on success, negative error code on failure.
The line_stroked() method is a convenience function to draw a line. Uses
stroke to do the actual work.
gnomeprint.Context.rect_stroked
def rect_stroked(x, y, width, height)
x :
X position of origin of rectangle in user coordinates.
y :
Y position of origin of rectangle in user coordinates.
width :
width of the rectangle.
height :
height of the rectangle.
Returns :
GNOME_PRINT_OK or positive value on success, negative error code on failure.
The rect_stroked() method is a convenience function to draw a rectangle. Uses
stroke to do the actual work.
gnomeprint.Context.rect_filled
def rect_filled(x, y, width, height)
x :
X position of origin of rectangle in user coordinates.
y :
Y position of origin of rectangle in user coordinates.
width :
width of the rectangle.
height :
height of the rectangle.
Returns :
GNOME_PRINT_OK or positive value on success, negative error code on failure.
The rect_filled() method is a convenience function to draw a filled rectangle. Uses
stroke to do the actual work.