[][src]Struct pix::Raster

pub struct Raster<F: PixFmt> { /* fields omitted */ }

A raster image with owned pixel data. If the pixel data must be owned elsewhere, consider using RasterB.

Example

use pix::{Raster, Alpha8};
let mut r: Raster<Alpha8> = Raster::new(10, 10);
r.set_pixel(2, 4, Alpha8::new(255));

Methods

impl<F: PixFmt> Raster<F>[src]

pub fn new(width: u32, height: u32) -> Raster<F>[src]

Create a new raster image.

  • 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 pixel(&self, x: u32, y: u32) -> F[src]

Get one pixel value.

pub fn set_pixel(&mut self, x: u32, y: u32, p: F)[src]

Set one pixel value.

pub fn as_slice(&self) -> &[F][src]

Get the pixels as a slice.

pub fn as_slice_mut(&mut self) -> &mut [F][src]

Get the pixels as a mutable slice.

pub fn as_u8_slice(&self) -> &[u8][src]

Get the pixels as a u8 slice.

pub fn as_u8_slice_mut(&mut self) -> &mut [u8][src]

Get the pixels as a mutable u8 slice.

pub fn clear(&mut self)[src]

Clear all pixels.

pub fn mask_over(&mut self, mask: &Raster<Alpha8>, x: i32, y: i32, clr: F)[src]

Blend pixels with an alpha mask.

  • mask Alpha mask for compositing.
  • x Left position of alpha mask.
  • y Top position of alpha mask.
  • clr Color to composite.

Auto Trait Implementations

impl<F> Send for Raster<F> where
    F: Send

impl<F> Sync for Raster<F> where
    F: Sync

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.