Struct fltk::surface::SvgFileSurface
source · 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.width(), but.height(), "temp.svg");
surface::SvgFileSurface::push_current(&sur);
draw::set_draw_color(enums::Color::White);
draw::draw_rectf(0, 0, but.width(), but.height());
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 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