Trait rgb::FromSlice

source ·
pub trait FromSlice<T: Copy> {
    // Required methods
    fn as_rgb(&self) -> &[RGB<T>];
    fn as_rgba(&self) -> &[RGBA<T>];
    fn as_rgb_mut(&mut self) -> &mut [RGB<T>];
    fn as_rgba_mut(&mut self) -> &mut [RGBA<T>];
    fn as_gray(&self) -> &[Gray<T>];
    fn as_gray_alpha(&self) -> &[GrayAlpha<T>];
    fn as_gray_mut(&mut self) -> &mut [Gray<T>];
    fn as_gray_alpha_mut(&mut self) -> &mut [GrayAlpha<T>];
    fn as_bgr(&self) -> &[BGR<T>];
    fn as_bgra(&self) -> &[BGRA<T>];
    fn as_bgr_mut(&mut self) -> &mut [BGR<T>];
    fn as_bgra_mut(&mut self) -> &mut [BGRA<T>];
}
Expand description

Cast a slice of component values (bytes) as a slice of RGB/RGBA pixels

If there’s any incomplete pixel at the end of the slice it is ignored.

Required Methods§

source

fn as_rgb(&self) -> &[RGB<T>]

Reinterpert slice as RGB pixels

source

fn as_rgba(&self) -> &[RGBA<T>]

Reinterpert slice as RGBA pixels

source

fn as_rgb_mut(&mut self) -> &mut [RGB<T>]

Reinterpert mutable slice as RGB pixels

source

fn as_rgba_mut(&mut self) -> &mut [RGBA<T>]

Reinterpert mutable slice as RGBA pixels

source

fn as_gray(&self) -> &[Gray<T>]

Reinterpert mutable slice as grayscale pixels

source

fn as_gray_alpha(&self) -> &[GrayAlpha<T>]

Reinterpert mutable slice as grayscale pixels with alpha

source

fn as_gray_mut(&mut self) -> &mut [Gray<T>]

Reinterpert mutable slice as grayscale pixels

source

fn as_gray_alpha_mut(&mut self) -> &mut [GrayAlpha<T>]

Reinterpert mutable slice as grayscale pixels with alpha

source

fn as_bgr(&self) -> &[BGR<T>]

Reinterpert slice as reverse-order BGR pixels

source

fn as_bgra(&self) -> &[BGRA<T>]

Reinterpert slice as reverse-order BGRA pixels

source

fn as_bgr_mut(&mut self) -> &mut [BGR<T>]

Reinterpert ntable slice as reverse-order BGR pixels

source

fn as_bgra_mut(&mut self) -> &mut [BGRA<T>]

Reinterpert mutable slice as reverse-order alpha-last BGRA pixels

Implementations on Foreign Types§

source§

impl<T: Copy> FromSlice<T> for [T]

source§

fn as_rgb(&self) -> &[RGB<T>]

source§

fn as_rgba(&self) -> &[RGBA<T>]

source§

fn as_rgb_mut(&mut self) -> &mut [RGB<T>]

source§

fn as_rgba_mut(&mut self) -> &mut [RGBA<T>]

source§

fn as_gray(&self) -> &[Gray<T>]

source§

fn as_gray_alpha(&self) -> &[GrayAlpha<T>]

source§

fn as_gray_mut(&mut self) -> &mut [Gray<T>]

source§

fn as_gray_alpha_mut(&mut self) -> &mut [GrayAlpha<T>]

source§

fn as_bgr(&self) -> &[BGR<T>]

source§

fn as_bgra(&self) -> &[BGRA<T>]

source§

fn as_bgr_mut(&mut self) -> &mut [BGR<T>]

source§

fn as_bgra_mut(&mut self) -> &mut [BGRA<T>]

Implementors§