[][src]Trait ffimage::core::traits::Pixel

pub trait Pixel: Sized + Default + Copy + Send + Sync + IndexMut<usize> {
    type T: StorageType;
    fn at(&self, index: usize) -> Self::T;
fn cast_from_slice(raw: &[Self::T]) -> Option<&Self>;
fn cast_from_slice_mut(raw: &mut [Self::T]) -> Option<&mut Self>;
fn try_from(raw: &[Self::T]) -> Result<Self, TryFromSliceError>;
fn channels() -> u8;
fn subpixels() -> u8; fn len() -> usize { ... } }

Generic pixel container

Associated Types

type T: StorageType

Type of the container elements

Loading content...

Required methods

fn at(&self, index: usize) -> Self::T

Returns the channel value at the specified index

fn cast_from_slice(raw: &[Self::T]) -> Option<&Self>

Transmute the slice into a pixel reference

fn cast_from_slice_mut(raw: &mut [Self::T]) -> Option<&mut Self>

Transmute the slice into a writable pixel reference

fn try_from(raw: &[Self::T]) -> Result<Self, TryFromSliceError>

Convert a memory region into a pixel by copying the bytes

fn channels() -> u8

Number of channels for this pixel

fn subpixels() -> u8

Number of image pixels for this pixel

Loading content...

Provided methods

fn len() -> usize

Size of one pixel in bytes

Loading content...

Implementors

impl<T: StorageType> Pixel for Bgr<T>[src]

type T = T

impl<T: StorageType> Pixel for Bgra<T>[src]

type T = T

impl<T: StorageType> Pixel for Gray<T>[src]

type T = T

impl<T: StorageType> Pixel for Rgb<T>[src]

type T = T

impl<T: StorageType> Pixel for Rgba<T>[src]

type T = T

Loading content...