pub struct SvgGraphics { /* private fields */ }Expand description
SVG graphics builder for a single page
Implementations§
Source§impl SvgGraphics
impl SvgGraphics
Sourcepub fn add_rect(
&mut self,
x: Length,
y: Length,
width: Length,
height: Length,
fill: Option<Color>,
stroke: Option<Color>,
stroke_width: Option<Length>,
opacity: Option<f64>,
rx: Option<Length>,
)
pub fn add_rect( &mut self, x: Length, y: Length, width: Length, height: Length, fill: Option<Color>, stroke: Option<Color>, stroke_width: Option<Length>, opacity: Option<f64>, rx: Option<Length>, )
Add a rectangle (for backgrounds, borders)
Sourcepub fn add_text(
&mut self,
text: &str,
x: Length,
y: Length,
font_size: Length,
color: Option<Color>,
)
pub fn add_text( &mut self, text: &str, x: Length, y: Length, font_size: Length, color: Option<Color>, )
Add text with full font styling
Sourcepub fn add_text_styled(
&mut self,
text: &str,
x: Length,
y: Length,
font_size: Length,
color: Option<Color>,
font_family: Option<&str>,
font_weight: Option<u16>,
font_style_italic: Option<bool>,
text_decoration: Option<(bool, bool, bool)>,
)
pub fn add_text_styled( &mut self, text: &str, x: Length, y: Length, font_size: Length, color: Option<Color>, font_family: Option<&str>, font_weight: Option<u16>, font_style_italic: Option<bool>, text_decoration: Option<(bool, bool, bool)>, )
Add text with full styling (font-family, font-weight, font-style, text-decoration)
Sourcepub fn add_linear_gradient(
&mut self,
id: &str,
x1: f64,
y1: f64,
x2: f64,
y2: f64,
stops: &[(f64, Color)],
)
pub fn add_linear_gradient( &mut self, id: &str, x1: f64, y1: f64, x2: f64, y2: f64, stops: &[(f64, Color)], )
Add a linear gradient to the defs section
Sourcepub fn add_gradient_rect(
&mut self,
x: Length,
y: Length,
width: Length,
height: Length,
gradient_id: &str,
)
pub fn add_gradient_rect( &mut self, x: Length, y: Length, width: Length, height: Length, gradient_id: &str, )
Add a rect filled with a gradient (reference gradient by id)
Sourcepub fn add_image(
&mut self,
data_uri: &str,
x: Length,
y: Length,
width: Length,
height: Length,
)
pub fn add_image( &mut self, data_uri: &str, x: Length, y: Length, width: Length, height: Length, )
Add an image
Sourcepub fn add_line(
&mut self,
x1: Length,
y1: Length,
x2: Length,
y2: Length,
color: Color,
width: Length,
style: &str,
)
pub fn add_line( &mut self, x1: Length, y1: Length, x2: Length, y2: Length, color: Color, width: Length, style: &str, )
Add a line (for rules, borders)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SvgGraphics
impl RefUnwindSafe for SvgGraphics
impl Send for SvgGraphics
impl Sync for SvgGraphics
impl Unpin for SvgGraphics
impl UnsafeUnpin for SvgGraphics
impl UnwindSafe for SvgGraphics
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more