Trait mksvg::write::SvgWrite [−][src]
pub trait SvgWrite { fn write(&mut self, s: &str); fn inc_depth(&mut self, n: i8); fn start<T: CDNum>(&mut self, w: T, h: T) { ... } fn end(&mut self) { ... } fn g(&mut self, args: Args) { ... } fn g_translate<T: CDNum>(&mut self, x: T, y: T) { ... } fn g_rotate<T: CDNum>(&mut self, ang: T, x: T, y: T) { ... } fn g_end(&mut self) { ... } fn any(&mut self, name: &str, args: &Args) { ... } fn any_o(&mut self, name: &str, args: &Args) { ... } fn rect<T: CDNum>(&mut self, x: T, y: T, w: T, h: T, args: Args) { ... } fn ellipse<T: CDNum>(&mut self, cx: T, cy: T, rx: T, ry: T, args: Args) { ... } fn text<T: CDNum>(&mut self, tx: &str, x: T, y: T, fs: T, args: Args) { ... } fn text_lines<T: CDNum>(
&mut self,
tx: &str,
x: T,
y: T,
fs: T,
dy: T,
args: Args
) { ... } fn bg_text<T: CDNum>(
&mut self,
tx: &str,
x: T,
y: T,
fs: T,
sw: T,
scol: &str,
args: Args
) { ... } fn bg_text_lines<T: CDNum>(
&mut self,
tx: &str,
x: T,
y: T,
fs: T,
dy: T,
sw: T,
scol: &str,
args: Args
) { ... } fn img<T: Display>(&mut self, loc: &str, x: T, y: T, w: T, h: T) { ... } fn path<T: Display>(&mut self, pathd: T, args: Args) { ... } }
the methods on SvgWrite, do not build anything. they simply write the output, so if you open something (g or svg) don't forget to close it.
Required Methods
Provided Methods
fn start<T: CDNum>(&mut self, w: T, h: T)
writes a simple prelude for an svg file don't forget to call end.
fn end(&mut self)
ends the svg file
fn g(&mut self, args: Args)
fn g_translate<T: CDNum>(&mut self, x: T, y: T)
fn g_rotate<T: CDNum>(&mut self, ang: T, x: T, y: T)
fn g_end(&mut self)
fn any(&mut self, name: &str, args: &Args)
fn any_o(&mut self, name: &str, args: &Args)
fn rect<T: CDNum>(&mut self, x: T, y: T, w: T, h: T, args: Args)
fn ellipse<T: CDNum>(&mut self, cx: T, cy: T, rx: T, ry: T, args: Args)
fn text<T: CDNum>(&mut self, tx: &str, x: T, y: T, fs: T, args: Args)
fn text_lines<T: CDNum>(
&mut self,
tx: &str,
x: T,
y: T,
fs: T,
dy: T,
args: Args
)
&mut self,
tx: &str,
x: T,
y: T,
fs: T,
dy: T,
args: Args
)
text_lines provides a simple way of printing multiline text dy is the distance down y has to be.
fn bg_text<T: CDNum>(
&mut self,
tx: &str,
x: T,
y: T,
fs: T,
sw: T,
scol: &str,
args: Args
)
&mut self,
tx: &str,
x: T,
y: T,
fs: T,
sw: T,
scol: &str,
args: Args
)
svg has a foible, where a wide stroke on text, hides the text. this method provides a workaround, printing the text twice. the back copy has the stroke, so all the front letters remain intact.
fn bg_text_lines<T: CDNum>(
&mut self,
tx: &str,
x: T,
y: T,
fs: T,
dy: T,
sw: T,
scol: &str,
args: Args
)
&mut self,
tx: &str,
x: T,
y: T,
fs: T,
dy: T,
sw: T,
scol: &str,
args: Args
)
multiple lines with the background workaround