pub struct SvgFileSurface { /* private fields */ }
Expand description
An SVG image surface object which allows drawing to an svg file Example usage:
use fltk::{prelude::*, *};
let but = button::Button::new(0, 0, 80, 40, "Click");
// We need the destructor of SvgFileSurface to actually create the image
{
let sur = surface::SvgFileSurface::new(but.w(), but.h(), "temp.svg");
surface::SvgFileSurface::push_current(&sur);
draw::set_draw_color(enums::Color::White);
draw::draw_rectf(0, 0, but.w(), but.h());
sur.draw(&but, 0, 0);
surface::SvgFileSurface::pop_current();
}
Implementations§
Source§impl SvgFileSurface
impl SvgFileSurface
Sourcepub fn new<P: AsRef<Path>>(width: i32, height: i32, path: P) -> SvgFileSurface
pub fn new<P: AsRef<Path>>(width: i32, height: i32, path: P) -> SvgFileSurface
Returns a new SvgFileSurface
. The path if non-existent will be created
§Panics
Panics on File creation failure and on writablity failure
Sourcepub fn set_origin(&mut self, x: i32, y: i32)
pub fn set_origin(&mut self, x: i32, y: i32)
Sets the origin of the SvgFileSurface
Sourcepub fn printable_rect(&self) -> (i32, i32)
pub fn printable_rect(&self) -> (i32, i32)
Returns the width and height of the printable rect
Trait Implementations§
Source§impl Drop for SvgFileSurface
impl Drop for SvgFileSurface
Source§impl SurfaceDevice for SvgFileSurface
impl SurfaceDevice for SvgFileSurface
Source§fn is_current(&self) -> bool
fn is_current(&self) -> bool
Checks whether this surface is the current surface
Source§fn push_current(new_current: &SvgFileSurface)
fn push_current(new_current: &SvgFileSurface)
Push a surface as a current surface
Source§fn pop_current()
fn pop_current()
Pop the current surface
Auto Trait Implementations§
impl Freeze for SvgFileSurface
impl RefUnwindSafe for SvgFileSurface
impl !Send for SvgFileSurface
impl !Sync for SvgFileSurface
impl Unpin for SvgFileSurface
impl UnwindSafe for SvgFileSurface
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