pub trait ArrayData {
    type DataType;

    // Required methods
    fn data(&self) -> Self::DataType;
    fn add(lhs: Self::DataType, other: Self::DataType) -> Self::DataType;
    fn sub(lhs: Self::DataType, other: Self::DataType) -> Self::DataType;
}
Expand description

Hack to get around lack of const generics. See comment on sum_image_pixels.

Required Associated Types§

source

type DataType

The type of the data for this array. e.g. [T; 1] for Luma, [T; 3] for Rgb.

Required Methods§

source

fn data(&self) -> Self::DataType

Get the data from this pixel as a constant length array.

source

fn add(lhs: Self::DataType, other: Self::DataType) -> Self::DataType

Add the elements of two data arrays elementwise.

source

fn sub(lhs: Self::DataType, other: Self::DataType) -> Self::DataType

Subtract the elements of two data arrays elementwise.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<T> ArrayData for Rgb<T>
where Rgb<T>: Pixel<Subpixel = T>, T: Primitive,

§

type DataType = [T; 3]

source§

fn data(&self) -> Self::DataType

source§

fn add(lhs: Self::DataType, rhs: Self::DataType) -> Self::DataType

source§

fn sub(lhs: Self::DataType, rhs: Self::DataType) -> Self::DataType

source§

impl<T> ArrayData for Rgba<T>
where Rgba<T>: Pixel<Subpixel = T>, T: Primitive,

§

type DataType = [T; 4]

source§

fn data(&self) -> Self::DataType

source§

fn add(lhs: Self::DataType, rhs: Self::DataType) -> Self::DataType

source§

fn sub(lhs: Self::DataType, rhs: Self::DataType) -> Self::DataType

source§

impl<T: Primitive> ArrayData for Luma<T>

§

type DataType = [T; 1]

source§

fn data(&self) -> Self::DataType

source§

fn add(lhs: Self::DataType, rhs: Self::DataType) -> Self::DataType

source§

fn sub(lhs: Self::DataType, rhs: Self::DataType) -> Self::DataType

Implementors§