2.1.2. Output Interface (layout.datatypes.output)¶
Base class for output.
-
class
layout.datatypes.output.OutputTarget¶ Bases:
objectTo allow this package to work with various renderers, this defines an interface.
-
clip_rect(x: float, y: float, w: float, h: float) → None¶ Clip further output to this rect.
-
draw_image(img_filename: str, x: float, y: float, w: float, h: float) → None¶ Draws the given image.
-
draw_line(x0: float, y0: float, x1: float, y1: float, *, stroke: Tuple[[float, float], float], stroke_width: float = 1, stroke_dash: Sequence = None) → None¶ Draws the given line.
-
draw_polygon(*pts, close_path: bool = True, stroke: Tuple[[float, float], float] = None, stroke_width: float = 1, stroke_dash: Sequence = None, fill: Tuple[[float, float], float] = None) → None¶ Draws the given linear path.
-
draw_rect(x: float, y: float, w: float, h: float, *, stroke: Tuple[[float, float], float] = None, stroke_width: float = 1, stroke_dash: Sequence = None, fill: Tuple[[float, float], float] = None) → None¶ Draws the given rectangle.
-
draw_text(text: str, x: float, y: float, *, font_name: str, font_size: float, fill: Tuple[[float, float], float]) → None¶ Draws the given text at x,y.
-
end_page() → None¶ Complete the previous page and prepare to begin a new page.
-
rotate(degrees: float) → None¶ Rotate the current rendering context.
-
scale(x: float, y: float) → None¶ Scale the current rendering context.
-
text_width(text: str, *, font_name: str, font_size: float) → float¶ The width of the given text string.
-
translate(x: float, y: float) → None¶ Translate the current rendering context.
-