Method summary
- __init__(self, pdf_canvas)
- arc(self, x, y, radius, start_angle, end_angle, clockwise)
- arc_to(self, x1, y1, x2, y2, radius)
- begin_page(self)
- begin_path(self)
- clear_clip_path(self)
- clear_rect(self, rect)
- clip(self)
- clip_to_rect(self, x, y, width, height)
- clip_to_rects(self)
- close_path(self)
- concat_ctm(self, transform)
- curve_to(self, cp1x, cp1y, cp2x, cp2y, x, y)
- draw_image(self, img, rect = None)
- draw_path(self, mode = constants.FILL_STROKE)
- draw_rect(self, rect, mode = constants.FILL_STROKE)
- end_page(self)
- eof_fill_path(self)
- even_odd_clip(self)
- fill_path(self)
- fill_rect(self, rect)
- fill_rects(self)
- flush(self)
- get_ctm(self)
- get_full_text_extent(self, textstring)
- get_path_bounding_box(self)
- get_path_current_point(self)
- get_text_extent(self, textstring)
- get_text_matrix(self)
- get_text_position(self)
- is_path_empty(self)
- line_set(self, starts, ends)
- line_to(self, x, y)
- lines(self, points)
- move_to(self, x, y)
- quad_curve_to(self, cpx, cpy, x, y)
- rect(self, *args)
- rects(self, rects)
- restore_state(self)
- rotate_ctm(self, angle)
- save(self)
- save_state(self)
- scale_ctm(self, sx, sy)
- select_font(self, name, size, textEncoding)
- set_alpha(self, alpha)
- set_character_spacing(self)
- set_fill_color(self, color)
- set_fill_color_space(self)
- set_flatness(self, flatness)
- set_font(self, font)
- set_font_size(self, size)
- set_line_cap(self, style)
- set_line_dash(self, lengths, phase = 0)
- set_line_join(self, style)
- set_line_width(self, width)
- set_miter_limit(self, limit)
- set_rendering_intent(self)
- set_should_antialias(self, value)
- set_stroke_color(self, color)
- set_stroke_color_space(self)
- set_text_drawing_mode(self)
- set_text_matrix(self, ttm)
- set_text_position(self, x, y)
- show_glyphs(self)
- show_text(self, text, x = None, y = None)
- stroke_path(self)
- stroke_rect(self, rect)
- stroke_rect_with_width(self, rect, width)
- synchronize(self)
- translate_ctm(self, tx, ty)
Methods
- __init__(self, pdf_canvas)
- arc(self, x, y, radius, start_angle, end_angle, clockwise)
- arc_to(self, x1, y1, x2, y2, radius)
- begin_page(self)
Creates a new page within the graphics context.
Currently, this just calls ReportLab's canvas object's showPage() method. Not sure about this...
- begin_path(self)
Clears the current drawing path and begins a new one.
- clear_clip_path(self)
- clear_rect(self, rect)
- clip(self)
- clip_to_rect(self, x, y, width, height)
Clips context to the given rectangular region.
Region should be a 4-tuple or a sequence.
- clip_to_rects(self)
- close_path(self)
Closes the path of the current subpath.
- concat_ctm(self, transform)
concat_ctm(transform: affine_matrix)
Concatenates the transform to current coordinate transform matrix. transform is an affine transformation matrix (see kiva.affine_matrix).
- curve_to(self, cp1x, cp1y, cp2x, cp2y, x, y)
- draw_image(self, img, rect = None)
draw_image(img_gc, rect=(x,y,w,h))
Draws another gc into this one. If 'rect' is not provided, then the image gc is drawn into this one, rooted at (0,0) and at full pixel size. If 'rect' is provided, then the image is resized into the (w,h) given and drawn into this GC at point (x,y).
img_gc is either a Numeric array (WxHx3 or WxHx4) or a GC from Kiva's Agg backend (kiva.agg.GraphicsContextArray).
Requires the Python Imaging Library (PIL).
- draw_path(self, mode = constants.FILL_STROKE)
Walks through all the drawing subpaths and draw each element.
Each subpath is drawn separately.
- draw_rect(self, rect, mode = constants.FILL_STROKE)
- end_page(self)
Ends drawing in the current page of the graphics context.
Currently, this just calls ReportLab's canvas object's showPage() method. Not sure about this...
- eof_fill_path(self)
- even_odd_clip(self)
- fill_path(self)
- fill_rect(self, rect)
- fill_rects(self)
- flush(self)
Sends all drawing data to the destination device.
Currently, this is a NOP. It used to call ReportLab's save() method, and maybe it still should, but flush() is likely to be called a lot, so this will really slow things down. Also, I think save() affects the paging of a document I think. We'll have to look into this more.
- get_ctm(self)
Returns the current coordinate transform matrix.
- XXX: This should really return a 3x3 matrix (or maybe an affine
- object?) like the other API's. Needs thought.
- get_full_text_extent(self, textstring)
- get_path_bounding_box(self)
Should return a tuple or array instead of a strange object.
- get_path_current_point(self)
Returns the current point from the graphics context.
Note: This should be a tuple or array.
- get_text_extent(self, textstring)
- get_text_matrix(self)
temporarily not implemented. can perhaps get the _textmatrix object off of the canvas if we need to.
- get_text_position(self)
- is_path_empty(self)
Tests to see whether the current drawing path is empty
- line_set(self, starts, ends)
- line_to(self, x, y)
Adds a line from the current point to the given point (x,y).
The current point is moved to (x,y).
- lines(self, points)
Adds a series of lines as a new subpath.
Currently implemented by calling line_to a zillion times.
Points is an Nx2 array of x,y pairs.
current_point is moved to the last point in points
- move_to(self, x, y)
Starts a new drawing subpath at place the current point at (x,y).
- quad_curve_to(self, cpx, cpy, x, y)
- rect(self, *args)
Adds a rectangle as a new subpath. Can be called in two ways: rect(x, y, w, h) rect( (x,y,w,h) )
- rects(self, rects)
Adds multiple rectangles as separate subpaths to the path.
Currently implemented by calling rect a zillion times.
- restore_state(self)
Restores the previous graphics state.
- rotate_ctm(self, angle)
rotate_ctm(angle: float) -> None
Rotates the coordinate space by the given angle (in radians).
- save(self)
- save_state(self)
Saves the current graphic's context state.
Always pair this with a restore_state()
- scale_ctm(self, sx, sy)
scale_ctm(sx: float, sy: float) -> None
Sets the coordinate system scale to the given values, (sx,sy).
- select_font(self, name, size, textEncoding)
PDF ignores the Encoding variable.
- set_alpha(self, alpha)
- set_character_spacing(self)
- set_fill_color(self, color)
PDF currently ignores the alpha value
- set_fill_color_space(self)
- set_flatness(self, flatness)
It is device dependent and therefore not recommended by the PDF documentation.
- set_font(self, font)
Sets the font for the current graphics context.
- set_font_size(self, size)
- set_line_cap(self, style)
Specifies the style of endings to put on line ends.
Parameters
- style : cap_style
- the line cap style to use. Available styles are CAP_ROUND, CAP_BUTT, CAP_SQUARE
- set_line_dash(self, lengths, phase = 0)
Parameters
- lengths : float array
- An array of floating point values specifing the lengths of on/off painting pattern for lines.
- phase : float
- Specifies how many units into dash pattern to start. phase defaults to 0.
- set_line_join(self, style)
Sets style for joining lines in a drawing.
- style : join_style
- The line joining style. The available styles are JOIN_ROUND, JOIN_BEVEL, JOIN_MITER.
- set_line_width(self, width)
Sets the line width for drawing
Parameters
- width : float
- The new width for lines in user space units.
- set_miter_limit(self, limit)
Specifies limits on line lengths for mitering line joins.
If line_join is set to miter joins, the limit specifies which line joins should actually be mitered. If lines aren't mitered, they are joined with a bevel. The line width is divided by the length of the miter. If the result is greater than the limit, the bevel style is used.
Parameters
- limit : float
- limit for mitering joins.
- set_rendering_intent(self)
- set_should_antialias(self, value)
Sets/Unsets anti-aliasing for bitmap graphics context.
- set_stroke_color(self, color)
PDF currently ignores the alpha value
- set_stroke_color_space(self)
- set_text_drawing_mode(self)
- set_text_matrix(self, ttm)
- set_text_position(self, x, y)
- show_glyphs(self)
- show_text(self, text, x = None, y = None)
Draws text on the device at current text position.
This is also used for showing text at a particular point specified by x and y.
This ignores the text matrix for now.
- stroke_path(self)
- stroke_rect(self, rect)
- stroke_rect_with_width(self, rect, width)
- synchronize(self)
Prepares drawing data to be updated on a destination device.
Currently, doesn't do anything. Should this call ReportLab's canvas object's showPage() method.
- translate_ctm(self, tx, ty)
translate_ctm(tx: float, ty: float) -> None
Translates the coordinate syetem by the given value by (tx,ty)