Skip to main content

GridRenderer

Trait GridRenderer 

Source
pub trait GridRenderer {
    // Required methods
    fn line(
        &mut self,
        x0_cm: f64,
        y0_cm: f64,
        x1_cm: f64,
        y1_cm: f64,
        gp: &Gpar,
    );
    fn polyline(&mut self, x_cm: &[f64], y_cm: &[f64], gp: &Gpar);
    fn rect(&mut self, x_cm: f64, y_cm: f64, w_cm: f64, h_cm: f64, gp: &Gpar);
    fn circle(&mut self, x_cm: f64, y_cm: f64, r_cm: f64, gp: &Gpar);
    fn polygon(&mut self, x_cm: &[f64], y_cm: &[f64], gp: &Gpar);
    fn text(&mut self, x_cm: f64, y_cm: f64, label: &str, rot: f64, gp: &Gpar);
    fn point(&mut self, x_cm: f64, y_cm: f64, pch: u8, size_cm: f64, gp: &Gpar);
    fn clip(&mut self, x_cm: f64, y_cm: f64, w_cm: f64, h_cm: f64);
    fn unclip(&mut self);
    fn device_size_cm(&self) -> (f64, f64);
}
Expand description

Abstract renderer for grid graphics.

All coordinates are in centimeters from the device origin (bottom-left). The renderer converts these to whatever coordinate system the backend uses.

Required Methods§

Source

fn line(&mut self, x0_cm: f64, y0_cm: f64, x1_cm: f64, y1_cm: f64, gp: &Gpar)

Draw a single line segment.

Source

fn polyline(&mut self, x_cm: &[f64], y_cm: &[f64], gp: &Gpar)

Draw a connected polyline (multiple segments sharing endpoints).

Source

fn rect(&mut self, x_cm: f64, y_cm: f64, w_cm: f64, h_cm: f64, gp: &Gpar)

Draw a rectangle.

Source

fn circle(&mut self, x_cm: f64, y_cm: f64, r_cm: f64, gp: &Gpar)

Draw a circle.

Source

fn polygon(&mut self, x_cm: &[f64], y_cm: &[f64], gp: &Gpar)

Draw a filled polygon.

Source

fn text(&mut self, x_cm: f64, y_cm: f64, label: &str, rot: f64, gp: &Gpar)

Draw a text label.

Source

fn point(&mut self, x_cm: f64, y_cm: f64, pch: u8, size_cm: f64, gp: &Gpar)

Draw a point (plotting symbol).

Source

fn clip(&mut self, x_cm: f64, y_cm: f64, w_cm: f64, h_cm: f64)

Set a clipping rectangle. All subsequent drawing is clipped to this region.

Source

fn unclip(&mut self)

Remove the most recently set clipping rectangle.

Source

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

Return the device size in centimeters (width, height).

Implementors§