Rendable

Trait Rendable 

Source
pub trait Rendable {
    // Required methods
    fn view_parameters(&self) -> ViewParameters;
    fn set_view_parameters(&mut self, view_box: ViewParameters);
    fn render(&self) -> SVG;

    // Provided methods
    fn set_x(&mut self, x: i32) { ... }
    fn set_y(&mut self, y: i32) { ... }
    fn width(&self) -> u32 { ... }
    fn set_width(&mut self, width: u32) { ... }
    fn height(&self) -> u32 { ... }
    fn set_height(&mut self, height: u32) { ... }
    fn view_box(&mut self) -> (i32, i32, u32, u32) { ... }
    fn set_view_box(&mut self, vx: i32, vy: i32, vw: u32, vh: u32) { ... }
}
Expand description

A trait for types that can be rendered as SVG elements with configurable view parameters.

Types implementing Rendable can be composed into SVG documents, have their viewports adjusted, and be rendered to SVG output. This trait provides both required and optional methods for interacting with the object’s view parameters and rendering logic.

§Required Methods

§Optional Methods

  • set_x: Sets the x position of the view box.
  • set_y: Sets the y position of the view box.
  • width: Returns the width of the view box.
  • height: Returns the height of the view box.

Implementors can override the optional methods for more efficient or specialized behavior.

Required Methods§

Source

fn view_parameters(&self) -> ViewParameters

Returns the current view parameters for the object.

Source

fn set_view_parameters(&mut self, view_box: ViewParameters)

Sets the view parameters for the object.

Source

fn render(&self) -> SVG

Renders the object as an SVG element.

Provided Methods§

Source

fn set_x(&mut self, x: i32)

Sets the x position of the view box (optional).

Source

fn set_y(&mut self, y: i32)

Sets the y position of the view box (optional).

Source

fn width(&self) -> u32

Returns the width of the view box (optional).

Source

fn set_width(&mut self, width: u32)

Sets the width of the view box (optional).

Source

fn height(&self) -> u32

Returns the height of the view box (optional).

Source

fn set_height(&mut self, height: u32)

Sets the height of the view box (optional).

Source

fn view_box(&mut self) -> (i32, i32, u32, u32)

Source

fn set_view_box(&mut self, vx: i32, vy: i32, vw: u32, vh: u32)

Implementors§

Source§

impl Rendable for XYChart

Source§

impl Rendable for XYChromaticity

Implements the XYChromaticity as a Rendable object, allowing it to be rendered as an SVG.

Source§

impl Rendable for SvgDocument