pub struct SvgWriter { /* private fields */ }Expand description
SVG file writer for visualizing clipper paths.
Direct port from C++ SvgWriter class.
Add paths and text, then save to an SVG file.
§Examples
use clipper2_rust::utils::svg::SvgWriter;
use clipper2_rust::core::FillRule;
let mut svg = SvgWriter::new(0);
// svg.add_paths_64(&paths, false, FillRule::NonZero, 0x1800009C, 0xFFB3B3DA, 0.8, false);
// svg.save_to_file("output.svg", 800, 600, 20);Implementations§
Source§impl SvgWriter
impl SvgWriter
Sourcepub fn new(precision: i32) -> Self
pub fn new(precision: i32) -> Self
Create a new SvgWriter with the given precision (decimal places).
Direct port from C++ SvgWriter(int precision).
Sourcepub fn set_coords_style(
&mut self,
font_name: &str,
font_color: u32,
font_size: u32,
)
pub fn set_coords_style( &mut self, font_name: &str, font_color: u32, font_size: u32, )
Set the coordinate display style.
Direct port from C++ SetCoordsStyle().
Sourcepub fn add_text(
&mut self,
text: &str,
font_color: u32,
font_size: u32,
x: f64,
y: f64,
)
pub fn add_text( &mut self, text: &str, font_color: u32, font_size: u32, x: f64, y: f64, )
Add a text label at the given position.
Direct port from C++ AddText().
Sourcepub fn add_path_64(
&mut self,
path: &Path64,
is_open: bool,
fillrule: FillRule,
brush_color: u32,
pen_color: u32,
pen_width: f64,
show_coords: bool,
)
pub fn add_path_64( &mut self, path: &Path64, is_open: bool, fillrule: FillRule, brush_color: u32, pen_color: u32, pen_width: f64, show_coords: bool, )
Add a single Path64, scaling by the writer’s precision.
Direct port from C++ AddPath(const Path64&, ...).
Sourcepub fn add_path_d(
&mut self,
path: &PathD,
is_open: bool,
fillrule: FillRule,
brush_color: u32,
pen_color: u32,
pen_width: f64,
show_coords: bool,
)
pub fn add_path_d( &mut self, path: &PathD, is_open: bool, fillrule: FillRule, brush_color: u32, pen_color: u32, pen_width: f64, show_coords: bool, )
Add a single PathD.
Direct port from C++ AddPath(const PathD&, ...).
Sourcepub fn add_paths_64(
&mut self,
paths: &Paths64,
is_open: bool,
fillrule: FillRule,
brush_color: u32,
pen_color: u32,
pen_width: f64,
show_coords: bool,
)
pub fn add_paths_64( &mut self, paths: &Paths64, is_open: bool, fillrule: FillRule, brush_color: u32, pen_color: u32, pen_width: f64, show_coords: bool, )
Add multiple Paths64, scaling by the writer’s precision.
Direct port from C++ AddPaths(const Paths64&, ...).
Auto Trait Implementations§
impl Freeze for SvgWriter
impl RefUnwindSafe for SvgWriter
impl Send for SvgWriter
impl Sync for SvgWriter
impl Unpin for SvgWriter
impl UnsafeUnpin for SvgWriter
impl UnwindSafe for SvgWriter
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