pub struct RasterB<F: PixFmt> { /* private fields */ }
Expand description
A raster image with borrowed pixel data. This is more tricky to use than Raster, so it should only be used when pixel data must be owned elsewhere.
Example
use footile::{PathBuilder,PixFmt,Plotter,RasterB,Rgba8};
let path = PathBuilder::new().pen_width(5.0)
.move_to(16.0, 48.0)
.line_to(32.0, 0.0)
.line_to(-16.0, -32.0)
.close().build();
let mut p = Plotter::new(100, 100);
let mut r = RasterB::new(p.width(), p.height());
let len = (p.width() * p.height()) as usize;
// NOTE: typically the pixels would be borrowed from some other source
let mut pixels = vec!(0; len * std::mem::size_of::<Rgba8>());
let mut pix = Rgba8::as_slice_mut(&mut pixels);
r.over(p.stroke(&path), Rgba8::rgb(208, 255, 208), pix);
Implementations
Auto Trait Implementations
impl<F> RefUnwindSafe for RasterB<F>where
F: RefUnwindSafe,
impl<F> Send for RasterB<F>where
F: Send,
impl<F> Sync for RasterB<F>where
F: Sync,
impl<F> Unpin for RasterB<F>where
F: Unpin,
impl<F> UnwindSafe for RasterB<F>where
F: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more