pub struct PsRenderer { /* private fields */ }Expand description
Renders into a PostScript document exactly like matplotlib’s
RendererPS. Coordinates are points with the origin at the bottom
left.
Implementations§
Source§impl PsRenderer
impl PsRenderer
Sourcepub fn take_body(&mut self) -> String
pub fn take_body(&mut self) -> String
The PostScript written to the page since the document began or the
last call, which leaves the page empty (matplotlib’s RendererPS
writes it to its pswriter as it goes).
Sourcepub fn set_color(&mut self, rgb: [f64; 3], store: bool)
pub fn set_color(&mut self, rgb: [f64; 3], store: bool)
Sets the colour (setgray for greys) when it changed, keeping it
as the page’s when store (matplotlib’s set_color).
Sourcepub fn set_linewidth(&mut self, width: f64, store: bool)
pub fn set_linewidth(&mut self, width: f64, store: bool)
Sets the line width in points when it changed (matplotlib’s
set_linewidth).
Sourcepub fn set_linejoin(&mut self, join: JoinStyle, store: bool)
pub fn set_linejoin(&mut self, join: JoinStyle, store: bool)
Sets the line join when it changed (matplotlib’s set_linejoin).
Sourcepub fn set_linecap(&mut self, cap: CapStyle, store: bool)
pub fn set_linecap(&mut self, cap: CapStyle, store: bool)
Sets the line cap when it changed (matplotlib’s set_linecap).
Sourcepub fn set_linedash(
&mut self,
offset: f64,
pattern: Option<&[f64]>,
store: bool,
)
pub fn set_linedash( &mut self, offset: f64, pattern: Option<&[f64]>, store: bool, )
Sets the dashes, offset into pattern (none, or an empty one,
for solid lines), when they changed (matplotlib’s set_linedash).
Sourcepub fn set_font(&mut self, name: &str, size: f64, store: bool)
pub fn set_font(&mut self, name: &str, size: f64, store: bool)
Selects the font name at size points when it changed
(matplotlib’s set_font).
Sourcepub fn create_hatch(&mut self, pattern: &str, linewidth: f64) -> String
pub fn create_hatch(&mut self, pattern: &str, linewidth: f64) -> String
The name of the pattern of hatch, defined on first use with lines
linewidth points wide (matplotlib’s create_hatch; hatches are
told apart by their pattern only).
Source§impl PsRenderer
impl PsRenderer
Sourcepub fn new(
width: f64,
height: f64,
image_dpi: f64,
options: PsOptions,
) -> Result<Self, VectorError>
pub fn new( width: f64, height: f64, image_dpi: f64, options: PsOptions, ) -> Result<Self, VectorError>
A document for a figure of width × height inches whose images are
rasterized at image_dpi.
Sourcepub fn drew_tex_as_plain(&self) -> bool
pub fn drew_tex_as_plain(&self) -> bool
Whether some usetex text was drawn as plain text so far, since
without PsOptions::usetex the backend runs no TeX (what
matplotlib’s draw_tex logs as it draws, once per document).
Sourcepub fn drew_partial_transparency(&self) -> bool
pub fn drew_partial_transparency(&self) -> bool
Whether a partially transparent colour was drawn so far, opaque
(what matplotlib’s _is_transparent logs as it draws, once per
document).
Sourcepub fn finish(self) -> Result<PsOutput, VectorError>
pub fn finish(self) -> Result<PsOutput, VectorError>
The document: header comments, the prolog with the procedures and
fonts, then the drawing placed on the page (matplotlib’s
_print_figure); with PsOptions::usetex, the figure whose
texts LaTeX typesets (PsOutput::Psfrag).
§Errors
When a font met while drawing could not be embedded, or TeX could not measure a usetex text.
Trait Implementations§
Source§impl Debug for PsRenderer
impl Debug for PsRenderer
Source§impl Renderer for PsRenderer
impl Renderer for PsRenderer
Source§fn points_to_pixels(&self, points: f64) -> f64
fn points_to_pixels(&self, points: f64) -> f64
Lengths are points already.
Source§fn canvas_size(&self) -> (f64, f64)
fn canvas_size(&self) -> (f64, f64)
Source§fn draw_path(
&mut self,
gc: &GraphicsContext,
path: &Path,
transform: &Affine2D,
fill: Option<Rgba>,
)
fn draw_path( &mut self, gc: &GraphicsContext, path: &Path, transform: &Affine2D, fill: Option<Rgba>, )
path with gc and fills it with fill, if given.Source§fn draw_markers(
&mut self,
gc: &GraphicsContext,
marker: &Path,
marker_transform: &Affine2D,
path: &Path,
transform: &Affine2D,
fill: Option<Rgba>,
)
fn draw_markers( &mut self, gc: &GraphicsContext, marker: &Path, marker_transform: &Affine2D, path: &Path, transform: &Affine2D, fill: Option<Rgba>, )
marker (in marker coordinates, mapped by marker_transform
to pixel offsets) at every vertex of path transformed by transform.Source§fn draw_path_collection(
&mut self,
gc: &GraphicsContext,
collection: &PathCollection<'_>,
)
fn draw_path_collection( &mut self, gc: &GraphicsContext, collection: &PathCollection<'_>, )
Source§fn draw_gouraud_triangles(
&mut self,
_gc: &GraphicsContext,
triangles: &[[Point; 3]],
colors: &[[Rgba; 3]],
transform: &Affine2D,
)
fn draw_gouraud_triangles( &mut self, _gc: &GraphicsContext, triangles: &[[Point; 3]], colors: &[[Rgba; 3]], transform: &Affine2D, )
transform maps the vertices to display space.Source§fn draw_image(
&mut self,
gc: &GraphicsContext,
origin: Point,
image: &RgbaImage,
transform: Option<&Affine2D>,
)
fn draw_image( &mut self, gc: &GraphicsContext, origin: Point, image: &RgbaImage, transform: Option<&Affine2D>, )
origin (display
coordinates). With transform, the image’s unit square is mapped
through it instead (only used when
option_scale_image is true).Source§fn draw_text(
&mut self,
gc: &GraphicsContext,
run: &TextRun,
origin: Point,
angle: f64,
)
fn draw_text( &mut self, gc: &GraphicsContext, run: &TextRun, origin: Point, angle: f64, )
origin, rotated by angle degrees counter-clockwise about it. Read moreSource§fn draw_tex(
&mut self,
gc: &GraphicsContext,
_run: &TextRun,
tex: &TexText,
origin: Point,
angle: f64,
) -> Result<(), TexError>
fn draw_tex( &mut self, gc: &GraphicsContext, _run: &TextRun, tex: &TexText, origin: Point, angle: f64, ) -> Result<(), TexError>
tex, a line of TeX text that is the source of run
(TextSource::Tex), with its origin at
origin, rotated by angle degrees counter-clockwise about it
(matplotlib’s draw_tex). Read moreSource§fn option_image_nocomposite(&self) -> bool
fn option_image_nocomposite(&self) -> bool
true, images are drawn one by one instead of being
composited into a single image first.Source§fn option_scale_image(&self) -> bool
fn option_scale_image(&self) -> bool
true, draw_image accepts arbitrary
affine transforms (vector backends); otherwise images arrive
pre-resampled at display resolution.Source§fn image_magnification(&self) -> f64
fn image_magnification(&self) -> f64
get_image_magnification): vector backends rasterize
images at their own resolution rather than at 72 dpi.Source§fn draw_quad_mesh(&mut self, gc: &GraphicsContext, mesh: &QuadMesh<'_>)
fn draw_quad_mesh(&mut self, gc: &GraphicsContext, mesh: &QuadMesh<'_>)
draw_quad_mesh): by
default as a path collection of its cells in matplotlib’s order
(QuadMesh::cell_paths) with the line width of gc.Source§fn draw_text_lines(
&mut self,
_gc: &GraphicsContext,
_text: &TextLines<'_>,
) -> bool
fn draw_text_lines( &mut self, _gc: &GraphicsContext, _text: &TextLines<'_>, ) -> bool
text whole, as matplotlib’s Text.draw hands a renderer a
text’s lines one by one, each with its string, font and artist
(draw_text(gc, x, y, s, prop, angle, ismath, mtext)); whether
the renderer drew it. The renderers of this crate don’t (they draw
each line through draw_text or
draw_tex), a renderer of the program’s does.Source§fn takes_texts_whole(&self) -> bool
fn takes_texts_whole(&self) -> bool
draw_text_lines), which those drawing
texts ask before they describe one.Source§fn rounds_glyph_positions(&self) -> bool
fn rounds_glyph_positions(&self) -> bool
round(0x40 * x)), which refuses a position that is
not finite. Renderers drawing glyphs as paths don’t.Source§fn open_group(&mut self, _name: &str, _gid: Option<&str>)
fn open_group(&mut self, _name: &str, _gid: Option<&str>)
Source§fn close_group(&mut self, _name: &str)
fn close_group(&mut self, _name: &str)
Source§fn open_part_group(&mut self, name: &str, gid: Option<&str>)
fn open_part_group(&mut self, name: &str, gid: Option<&str>)
open_group starts, but the PDF backend does
not set the clip regions again for the parts.Source§fn close_part_group(&mut self, name: &str)
fn close_part_group(&mut self, name: &str)
Source§fn start_rasterizing(&mut self)
fn start_rasterizing(&mut self)
stop_rasterizing (matplotlib’s
start_rasterizing); only vector output distinguishes the modes.Source§fn stop_rasterizing(&mut self)
fn stop_rasterizing(&mut self)
start_rasterizing in the output as an
image and resumes drawing directly.Source§fn raster_dpi(&self) -> Option<f64>
fn raster_dpi(&self) -> Option<f64>
None otherwise. Artists drawn meanwhile
compute their geometry at it, in canvas pixels (matplotlib changes
the figure’s dpi in start_rasterizing).Source§fn start_filter(&mut self)
fn start_filter(&mut self)
stop_filter (matplotlib’s start_filter).
Only raster canvases filter; other backends draw as usual.Source§fn stop_filter(&mut self, _filter: &FilterFn<'_>)
fn stop_filter(&mut self, _filter: &FilterFn<'_>)
start_filter,
cropped to its visible pixels, to filter and draws the image it
returns in its place (matplotlib’s stop_filter).stop_filter with a filter the renderer may
keep, as matplotlib hands renderers the artist’s filter itself: a
renderer passing it on (to a program’s renderer, say) overrides
this; the others filter as stop_filter does.