[−][src]Struct pix::RasterB
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 pix::{PixFmt, RasterB, Rgba8}; let mut r = RasterB::<Rgba8>::new(10, 10); let len = (r.width() * r.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);
Methods
impl<F: PixFmt> RasterB<F>
[src]
pub fn new(width: u32, height: u32) -> RasterB<F>
[src]
Create a new raster image for borrowed pixel data.
F
Pixel format.width
Width in pixels.height
Height in pixels.
pub fn width(&self) -> u32
[src]
Get raster width.
pub fn height(&self) -> u32
[src]
Get raster height.
pub fn clear(&self, pixels: &mut [F])
[src]
Clear all pixels.
pub fn mask_over(&self, mask: &[u8], clr: F, pixels: &mut [F])
[src]
Blend pixels with an alpha mask.
mask
Alpha mask for compositing.clr
Color to composite.pixels
Borrowed pixel data.
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,