pub struct Raster<F: PixFmt> { /* private fields */ }
Expand description
A raster image with owned pixel data. If the pixel data must be owned elsewhere, consider using RasterB.
Example
use footile::{PathBuilder,Plotter,Raster,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 = Raster::new(p.width(), p.height());
r.over(p.stroke(&path), Rgba8::rgb(208, 255, 208));
Implementations
sourceimpl<F: PixFmt> Raster<F>
impl<F: PixFmt> Raster<F>
sourcepub fn new(width: u32, height: u32) -> Raster<F>
pub fn new(width: u32, height: u32) -> Raster<F>
Create a new raster image.
F
Pixel format.width
Width in pixels.height
Height in pixels.
sourcepub fn as_slice_mut(&mut self) -> &mut [F] ⓘ
pub fn as_slice_mut(&mut self) -> &mut [F] ⓘ
Get the pixels as a mutable slice.
sourcepub fn as_u8_slice(&self) -> &[u8] ⓘ
pub fn as_u8_slice(&self) -> &[u8] ⓘ
Get the pixels as a u8 slice.
sourcepub fn as_u8_slice_mut(&mut self) -> &mut [u8] ⓘ
pub fn as_u8_slice_mut(&mut self) -> &mut [u8] ⓘ
Get the pixels as a mutable u8 slice.
Auto Trait Implementations
impl<F> RefUnwindSafe for Raster<F>where
F: RefUnwindSafe,
impl<F> Send for Raster<F>where
F: Send,
impl<F> Sync for Raster<F>where
F: Sync,
impl<F> Unpin for Raster<F>where
F: Unpin,
impl<F> UnwindSafe for Raster<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