Inherits from
- GraphicsContext: enthought.kiva.backend_pdf.GraphicsContext
Attributes
- dest_box
A tuple (x, y, width, height) specifying the box into which the plot should be rendered. x and y correspond to the lower-left hand coordinates of the box in the coordinates of the page (i.e. 0,0 is at the lower left). width and height can be positive or negative; if they are positive, they are interpreted as distances from (x,y); if they are negative, they are interpreted as distances from the right and top of the page, respectively.
dest_box = (0.5, 0.5, -Const(0.5), -Const(0.5))
- dest_box_units
The units of the values in dest_box
dest_box_units = 'inch'
- filename
The name of the file that this graphics context will use when gc.save() is called without a filename being supplied.
filename = 'saved_plot.pdf'
- pagesize
The page size of the generated PDF
pagesize = 'letter'
Method summary
- __init__(self, pdf_canvas = None, filename = None, pagesize = None, dest_box = None, dest_box_units = None)
- render_component(self, component, container_coords = False, halign = 'center', valign = 'top')
- save(self, filename = None)
Inherited from base classes
- 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_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 = None, filename = None, pagesize = None, dest_box = None, dest_box_units = None)
- render_component(self, component, container_coords = False, halign = 'center', valign = 'top')
Erases the current contents of the graphics context and renders the given component at the maximum possible scaling while preserving aspect ratio.
Parameters
- component : Component
- The component to be rendered.
- container_coords : Boolean
- Whether to use coordinates of the component's container
- halign : "center", "left", "right"
- Determines the position of the component if it is narrower than the graphics context area (after scaling)
- valign : "center", "top", "bottom"
- Determiens the position of the component if it is shorter than the graphics context area (after scaling)
Description
If container_coords is False, then the (0,0) coordinate of this graphics context corresponds to the lower-left corner of the component's outer_bounds. If container_coords is True, then the method draws the component as it appears inside its container, i.e., it treats (0,0) of the graphics context as the lower-left corner of the container's outer bounds.
- save(self, filename = None)