pub struct RasterB<F: PixFmt> { /* fields omitted */ }
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.
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;
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);
Create a new raster image for borrowed pixel data.
F
Pixel format.
width
Width in pixels.
height
Height in pixels.
Blend pixels with an alpha mask.
mask
Alpha mask for compositing. It is cleared before returning.
clr
Color to composite.
pixels
Borrowed pixel data.
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static