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
view_parameters: Returns the current view parameters for the object.set_view_parameters: Sets the view parameters for the object.render: Renders the object as an SVG element.
§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§
Sourcefn view_parameters(&self) -> ViewParameters
fn view_parameters(&self) -> ViewParameters
Returns the current view parameters for the object.
Sourcefn set_view_parameters(&mut self, view_box: ViewParameters)
fn set_view_parameters(&mut self, view_box: ViewParameters)
Sets the view parameters for the object.
Provided Methods§
Sourcefn set_height(&mut self, height: u32)
fn set_height(&mut self, height: u32)
Sets the height of the view box (optional).