Skip to main content

MixedModeRenderer

Struct MixedModeRenderer 

Source
pub struct MixedModeRenderer<'a> { /* private fields */ }
Expand description

A vector renderer that draws rasterized artists into a raster canvas placed in the document as an image (matplotlib’s MixedModeRenderer).

Implementations§

Source§

impl<'a> MixedModeRenderer<'a>

Source

pub fn new( vector: &'a mut dyn Renderer, width: f64, height: f64, dpi: f64, simplify: SimplifySettings, ) -> Self

Draws into vector, whose page is width × height inches, rasterizing at dpi with the path.simplify settings simplify.

Source

pub fn finish(self) -> Result<(), RasterBackendError>

Places what is still being rasterized; drawing is over.

§Errors

When a raster canvas could not be created (its part of the drawing then went to the vector renderer).

Trait Implementations§

Source§

impl Debug for MixedModeRenderer<'_>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Renderer for MixedModeRenderer<'_>

Source§

fn start_filter(&mut self)

Filters only while rasterizing, where the raster canvas draws (matplotlib’s mixed renderer hands start_filter to its current renderer).

Source§

fn start_rasterizing(&mut self)

A raster canvas of the page at the save resolution receives the drawing from now on.

Source§

fn stop_rasterizing(&mut self)

The drawn part of the raster canvas becomes an image of the document, placed with a default graphics context.

Source§

fn raster_dpi(&self) -> Option<f64>

The save resolution while a raster canvas receives the drawing.

Source§

fn canvas_size(&self) -> (f64, f64)

Canvas width and height in pixels.
Source§

fn dpi(&self) -> f64

Resolution in dots per inch.
Source§

fn points_to_pixels(&self, points: f64) -> f64

Converts a length in points (1/72 inch) to pixels.
Source§

fn draw_path( &mut self, gc: &GraphicsContext, path: &Path, transform: &Affine2D, fill: Option<Rgba>, )

Strokes 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>, )

Draws 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<'_>, )

Draws many paths with per-item properties (scatter, patches, meshes).
Source§

fn draw_quad_mesh(&mut self, gc: &GraphicsContext, mesh: &QuadMesh<'_>)

Draws a flat-shaded quad mesh (matplotlib’s 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_tex( &mut self, gc: &GraphicsContext, run: &TextRun, tex: &TexText, origin: Point, angle: f64, ) -> Result<(), TexError>

Draws 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 more
Source§

fn draw_gouraud_triangles( &mut self, gc: &GraphicsContext, triangles: &[[Point; 3]], colors: &[[Rgba; 3]], transform: &Affine2D, )

Draws triangles whose vertex colours are interpolated linearly (Gouraud shading); transform maps the vertices to display space.
Source§

fn draw_image( &mut self, gc: &GraphicsContext, origin: Point, image: &RgbaImage, transform: Option<&Affine2D>, )

Draws an image with its bottom-left corner at 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, )

Draws laid-out text with its origin (left end of the baseline) at origin, rotated by angle degrees counter-clockwise about it. Read more
Source§

fn draw_text_lines( &mut self, gc: &GraphicsContext, text: &TextLines<'_>, ) -> bool

Draws 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

Whether the renderer takes texts whole (draw_text_lines), which those drawing texts ask before they describe one.
Source§

fn rounds_glyph_positions(&self) -> bool

Whether the renderer rounds where it puts each glyph (and each line of TeX) to whole numbers as Python rounds them, as matplotlib’s Agg renderer does (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>)

Starts a named group of draw calls (vector backends emit a group).
Source§

fn stop_filter(&mut self, filter: &FilterFn<'_>)

Hands what was drawn since start_filter, cropped to its visible pixels, to filter and draws the image it returns in its place (matplotlib’s stop_filter).
Source§

fn stop_shared_filter(&mut self, filter: &SharedFilter)

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.
Source§

fn close_group(&mut self, name: &str)

Ends the most recently opened group.
Source§

fn open_part_group(&mut self, name: &str, gid: Option<&str>)

Starts a named group of the draw calls of a part of the artist being drawn, which draws with that artist’s clip regions (the background of a figure or an axes; an axis’ ticks and their lines and labels, whose gridlines matplotlib clips to one box): a group as 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)

Ends the most recently opened group of a part.
Source§

fn option_image_nocomposite(&self) -> bool

When true, images are drawn one by one instead of being composited into a single image first.
Source§

fn option_scale_image(&self) -> bool

When true, draw_image accepts arbitrary affine transforms (vector backends); otherwise images arrive pre-resampled at display resolution.
Source§

fn image_magnification(&self) -> f64

The factor by which images are magnified before being drawn (matplotlib’s get_image_magnification): vector backends rasterize images at their own resolution rather than at 72 dpi.

Auto Trait Implementations§

§

impl<'a> !Freeze for MixedModeRenderer<'a>

§

impl<'a> !RefUnwindSafe for MixedModeRenderer<'a>

§

impl<'a> !Send for MixedModeRenderer<'a>

§

impl<'a> !Sync for MixedModeRenderer<'a>

§

impl<'a> !UnwindSafe for MixedModeRenderer<'a>

§

impl<'a> Forget for MixedModeRenderer<'a>

§

impl<'a> Move for MixedModeRenderer<'a>

§

impl<'a> Unpin for MixedModeRenderer<'a>

§

impl<'a> UnsafeUnpin for MixedModeRenderer<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.