Trait nannou::image::Pixel [−][src]
pub trait Pixel: Copy + Clone { type Subpixel: Primitive; pub const CHANNEL_COUNT: u8; pub const COLOR_MODEL: &'static str; pub const COLOR_TYPE: ColorType;}Show methods
pub fn channels(&self) -> &[Self::Subpixel]ⓘ; pub fn channels_mut(&mut self) -> &mut [Self::Subpixel]ⓘ; pub fn channels4(
&self
) -> (Self::Subpixel, Self::Subpixel, Self::Subpixel, Self::Subpixel); pub fn from_channels(
a: Self::Subpixel,
b: Self::Subpixel,
c: Self::Subpixel,
d: Self::Subpixel
) -> Self; pub fn from_slice(slice: &[Self::Subpixel]) -> &Self; pub fn from_slice_mut(slice: &mut [Self::Subpixel]) -> &mut Self; pub fn to_rgb(&self) -> Rgb<Self::Subpixel>; pub fn to_rgba(&self) -> Rgba<Self::Subpixel>; pub fn to_luma(&self) -> Luma<Self::Subpixel>; pub fn to_luma_alpha(&self) -> LumaA<Self::Subpixel>; pub fn to_bgr(&self) -> Bgr<Self::Subpixel>; pub fn to_bgra(&self) -> Bgra<Self::Subpixel>; pub fn map<F>(&self, f: F) -> Self
where
F: FnMut(Self::Subpixel) -> Self::Subpixel; pub fn apply<F>(&mut self, f: F)
where
F: FnMut(Self::Subpixel) -> Self::Subpixel; pub fn map_with_alpha<F, G>(&self, f: F, g: G) -> Self
where
F: FnMut(Self::Subpixel) -> Self::Subpixel,
G: FnMut(Self::Subpixel) -> Self::Subpixel; pub fn apply_with_alpha<F, G>(&mut self, f: F, g: G)
where
F: FnMut(Self::Subpixel) -> Self::Subpixel,
G: FnMut(Self::Subpixel) -> Self::Subpixel; pub fn map2<F>(&self, other: &Self, f: F) -> Self
where
F: FnMut(Self::Subpixel, Self::Subpixel) -> Self::Subpixel; pub fn apply2<F>(&mut self, other: &Self, f: F)
where
F: FnMut(Self::Subpixel, Self::Subpixel) -> Self::Subpixel; pub fn invert(&mut self); pub fn blend(&mut self, other: &Self); pub fn channel_count() -> u8 { ... } pub fn color_model() -> &'static str { ... } pub fn color_type() -> ColorType { ... } pub fn map_without_alpha<F>(&self, f: F) -> Self
where
F: FnMut(Self::Subpixel) -> Self::Subpixel, { ... } pub fn apply_without_alpha<F>(&mut self, f: F)
where
F: FnMut(Self::Subpixel) -> Self::Subpixel, { ... }
A generalized pixel.
A pixel object is usually not used standalone but as a view into an image buffer.
Associated Types
Loading content...Associated Constants
pub const CHANNEL_COUNT: u8
[src]
The number of channels of this pixel type.
pub const COLOR_MODEL: &'static str
[src]
A string that can help to interpret the meaning each channel See gimp babl.
pub const COLOR_TYPE: ColorType
[src]
ColorType for this pixel format
Required methods
pub fn channels(&self) -> &[Self::Subpixel]ⓘ
[src]
Returns the components as a slice.
pub fn channels_mut(&mut self) -> &mut [Self::Subpixel]ⓘ
[src]
Returns the components as a mutable slice
pub fn channels4(
&self
) -> (Self::Subpixel, Self::Subpixel, Self::Subpixel, Self::Subpixel)
[src]
&self
) -> (Self::Subpixel, Self::Subpixel, Self::Subpixel, Self::Subpixel)
Returns the channels of this pixel as a 4 tuple. If the pixel has less than 4 channels the remainder is filled with the maximum value
TODO deprecate
pub fn from_channels(
a: Self::Subpixel,
b: Self::Subpixel,
c: Self::Subpixel,
d: Self::Subpixel
) -> Self
[src]
a: Self::Subpixel,
b: Self::Subpixel,
c: Self::Subpixel,
d: Self::Subpixel
) -> Self
Construct a pixel from the 4 channels a, b, c and d. If the pixel does not contain 4 channels the extra are ignored.
TODO deprecate
pub fn from_slice(slice: &[Self::Subpixel]) -> &Self
[src]
Returns a view into a slice.
Note: The slice length is not checked on creation. Thus the caller has to ensure that the slice is long enough to prevent panics if the pixel is used later on.
pub fn from_slice_mut(slice: &mut [Self::Subpixel]) -> &mut Self
[src]
Returns mutable view into a mutable slice.
Note: The slice length is not checked on creation. Thus the caller has to ensure that the slice is long enough to prevent panics if the pixel is used later on.
pub fn to_rgb(&self) -> Rgb<Self::Subpixel>
[src]
Convert this pixel to RGB
pub fn to_rgba(&self) -> Rgba<Self::Subpixel>
[src]
Convert this pixel to RGB with an alpha channel
pub fn to_luma(&self) -> Luma<Self::Subpixel>
[src]
Convert this pixel to luma
pub fn to_luma_alpha(&self) -> LumaA<Self::Subpixel>
[src]
Convert this pixel to luma with an alpha channel
pub fn to_bgr(&self) -> Bgr<Self::Subpixel>
[src]
Convert this pixel to BGR
pub fn to_bgra(&self) -> Bgra<Self::Subpixel>
[src]
Convert this pixel to BGR with an alpha channel
pub fn map<F>(&self, f: F) -> Self where
F: FnMut(Self::Subpixel) -> Self::Subpixel,
[src]
F: FnMut(Self::Subpixel) -> Self::Subpixel,
Apply the function f
to each channel of this pixel.
pub fn apply<F>(&mut self, f: F) where
F: FnMut(Self::Subpixel) -> Self::Subpixel,
[src]
F: FnMut(Self::Subpixel) -> Self::Subpixel,
Apply the function f
to each channel of this pixel.
pub fn map_with_alpha<F, G>(&self, f: F, g: G) -> Self where
F: FnMut(Self::Subpixel) -> Self::Subpixel,
G: FnMut(Self::Subpixel) -> Self::Subpixel,
[src]
F: FnMut(Self::Subpixel) -> Self::Subpixel,
G: FnMut(Self::Subpixel) -> Self::Subpixel,
Apply the function f
to each channel except the alpha channel.
Apply the function g
to the alpha channel.
pub fn apply_with_alpha<F, G>(&mut self, f: F, g: G) where
F: FnMut(Self::Subpixel) -> Self::Subpixel,
G: FnMut(Self::Subpixel) -> Self::Subpixel,
[src]
F: FnMut(Self::Subpixel) -> Self::Subpixel,
G: FnMut(Self::Subpixel) -> Self::Subpixel,
Apply the function f
to each channel except the alpha channel.
Apply the function g
to the alpha channel. Works in-place.
pub fn map2<F>(&self, other: &Self, f: F) -> Self where
F: FnMut(Self::Subpixel, Self::Subpixel) -> Self::Subpixel,
[src]
F: FnMut(Self::Subpixel, Self::Subpixel) -> Self::Subpixel,
Apply the function f
to each channel of this pixel and
other
pairwise.
pub fn apply2<F>(&mut self, other: &Self, f: F) where
F: FnMut(Self::Subpixel, Self::Subpixel) -> Self::Subpixel,
[src]
F: FnMut(Self::Subpixel, Self::Subpixel) -> Self::Subpixel,
Apply the function f
to each channel of this pixel and
other
pairwise. Works in-place.
pub fn invert(&mut self)
[src]
Invert this pixel
pub fn blend(&mut self, other: &Self)
[src]
Blend the color of a given pixel into ourself, taking into account alpha channels
Provided methods
pub fn channel_count() -> u8
[src]
please use CHANNEL_COUNT associated constant
Returns the number of channels of this pixel type.
pub fn color_model() -> &'static str
[src]
please use COLOR_MODEL associated constant
Returns a string that can help to interpret the meaning each channel See gimp babl.
pub fn color_type() -> ColorType
[src]
please use COLOR_TYPE associated constant
Returns the ColorType for this pixel format
pub fn map_without_alpha<F>(&self, f: F) -> Self where
F: FnMut(Self::Subpixel) -> Self::Subpixel,
[src]
F: FnMut(Self::Subpixel) -> Self::Subpixel,
Apply the function f
to each channel except the alpha channel.
pub fn apply_without_alpha<F>(&mut self, f: F) where
F: FnMut(Self::Subpixel) -> Self::Subpixel,
[src]
F: FnMut(Self::Subpixel) -> Self::Subpixel,
Apply the function f
to each channel except the alpha channel.
Works in place.
Implementors
impl<T> Pixel for Bgr<T> where
T: 'static + Primitive,
[src]
T: 'static + Primitive,
type Subpixel = T
pub const CHANNEL_COUNT: u8
[src]
pub const COLOR_MODEL: &'static str
[src]
pub const COLOR_TYPE: ColorType
[src]
pub fn channels(&self) -> &[T]ⓘ
[src]
pub fn channels_mut(&mut self) -> &mut [T]ⓘ
[src]
pub fn channels4(&self) -> (T, T, T, T)
[src]
pub fn from_channels(a: T, b: T, c: T, d: T) -> Bgr<T>
[src]
pub fn from_slice(slice: &[T]) -> &Bgr<T>
[src]
pub fn from_slice_mut(slice: &mut [T]) -> &mut Bgr<T>
[src]
pub fn to_rgb(&self) -> Rgb<T>
[src]
pub fn to_bgr(&self) -> Bgr<T>
[src]
pub fn to_rgba(&self) -> Rgba<T>
[src]
pub fn to_bgra(&self) -> Bgra<T>
[src]
pub fn to_luma(&self) -> Luma<T>
[src]
pub fn to_luma_alpha(&self) -> LumaA<T>
[src]
pub fn map<F>(&self, f: F) -> Bgr<T> where
F: FnMut(T) -> T,
[src]
F: FnMut(T) -> T,
pub fn apply<F>(&mut self, f: F) where
F: FnMut(T) -> T,
[src]
F: FnMut(T) -> T,
pub fn map_with_alpha<F, G>(&self, f: F, g: G) -> Bgr<T> where
F: FnMut(T) -> T,
G: FnMut(T) -> T,
[src]
F: FnMut(T) -> T,
G: FnMut(T) -> T,
pub fn apply_with_alpha<F, G>(&mut self, f: F, g: G) where
F: FnMut(T) -> T,
G: FnMut(T) -> T,
[src]
F: FnMut(T) -> T,
G: FnMut(T) -> T,
pub fn map2<F>(&self, other: &Bgr<T>, f: F) -> Bgr<T> where
F: FnMut(T, T) -> T,
[src]
F: FnMut(T, T) -> T,
pub fn apply2<F>(&mut self, other: &Bgr<T>, f: F) where
F: FnMut(T, T) -> T,
[src]
F: FnMut(T, T) -> T,
pub fn invert(&mut self)
[src]
pub fn blend(&mut self, other: &Bgr<T>)
[src]
impl<T> Pixel for Bgra<T> where
T: 'static + Primitive,
[src]
T: 'static + Primitive,
type Subpixel = T
pub const CHANNEL_COUNT: u8
[src]
pub const COLOR_MODEL: &'static str
[src]
pub const COLOR_TYPE: ColorType
[src]
pub fn channels(&self) -> &[T]ⓘ
[src]
pub fn channels_mut(&mut self) -> &mut [T]ⓘ
[src]
pub fn channels4(&self) -> (T, T, T, T)
[src]
pub fn from_channels(a: T, b: T, c: T, d: T) -> Bgra<T>
[src]
pub fn from_slice(slice: &[T]) -> &Bgra<T>
[src]
pub fn from_slice_mut(slice: &mut [T]) -> &mut Bgra<T>
[src]
pub fn to_rgb(&self) -> Rgb<T>
[src]
pub fn to_bgr(&self) -> Bgr<T>
[src]
pub fn to_rgba(&self) -> Rgba<T>
[src]
pub fn to_bgra(&self) -> Bgra<T>
[src]
pub fn to_luma(&self) -> Luma<T>
[src]
pub fn to_luma_alpha(&self) -> LumaA<T>
[src]
pub fn map<F>(&self, f: F) -> Bgra<T> where
F: FnMut(T) -> T,
[src]
F: FnMut(T) -> T,
pub fn apply<F>(&mut self, f: F) where
F: FnMut(T) -> T,
[src]
F: FnMut(T) -> T,
pub fn map_with_alpha<F, G>(&self, f: F, g: G) -> Bgra<T> where
F: FnMut(T) -> T,
G: FnMut(T) -> T,
[src]
F: FnMut(T) -> T,
G: FnMut(T) -> T,
pub fn apply_with_alpha<F, G>(&mut self, f: F, g: G) where
F: FnMut(T) -> T,
G: FnMut(T) -> T,
[src]
F: FnMut(T) -> T,
G: FnMut(T) -> T,
pub fn map2<F>(&self, other: &Bgra<T>, f: F) -> Bgra<T> where
F: FnMut(T, T) -> T,
[src]
F: FnMut(T, T) -> T,
pub fn apply2<F>(&mut self, other: &Bgra<T>, f: F) where
F: FnMut(T, T) -> T,
[src]
F: FnMut(T, T) -> T,
pub fn invert(&mut self)
[src]
pub fn blend(&mut self, other: &Bgra<T>)
[src]
impl<T> Pixel for Luma<T> where
T: 'static + Primitive,
[src]
T: 'static + Primitive,
type Subpixel = T
pub const CHANNEL_COUNT: u8
[src]
pub const COLOR_MODEL: &'static str
[src]
pub const COLOR_TYPE: ColorType
[src]
pub fn channels(&self) -> &[T]ⓘ
[src]
pub fn channels_mut(&mut self) -> &mut [T]ⓘ
[src]
pub fn channels4(&self) -> (T, T, T, T)
[src]
pub fn from_channels(a: T, b: T, c: T, d: T) -> Luma<T>
[src]
pub fn from_slice(slice: &[T]) -> &Luma<T>
[src]
pub fn from_slice_mut(slice: &mut [T]) -> &mut Luma<T>
[src]
pub fn to_rgb(&self) -> Rgb<T>
[src]
pub fn to_bgr(&self) -> Bgr<T>
[src]
pub fn to_rgba(&self) -> Rgba<T>
[src]
pub fn to_bgra(&self) -> Bgra<T>
[src]
pub fn to_luma(&self) -> Luma<T>
[src]
pub fn to_luma_alpha(&self) -> LumaA<T>
[src]
pub fn map<F>(&self, f: F) -> Luma<T> where
F: FnMut(T) -> T,
[src]
F: FnMut(T) -> T,
pub fn apply<F>(&mut self, f: F) where
F: FnMut(T) -> T,
[src]
F: FnMut(T) -> T,
pub fn map_with_alpha<F, G>(&self, f: F, g: G) -> Luma<T> where
F: FnMut(T) -> T,
G: FnMut(T) -> T,
[src]
F: FnMut(T) -> T,
G: FnMut(T) -> T,
pub fn apply_with_alpha<F, G>(&mut self, f: F, g: G) where
F: FnMut(T) -> T,
G: FnMut(T) -> T,
[src]
F: FnMut(T) -> T,
G: FnMut(T) -> T,
pub fn map2<F>(&self, other: &Luma<T>, f: F) -> Luma<T> where
F: FnMut(T, T) -> T,
[src]
F: FnMut(T, T) -> T,
pub fn apply2<F>(&mut self, other: &Luma<T>, f: F) where
F: FnMut(T, T) -> T,
[src]
F: FnMut(T, T) -> T,
pub fn invert(&mut self)
[src]
pub fn blend(&mut self, other: &Luma<T>)
[src]
impl<T> Pixel for LumaA<T> where
T: 'static + Primitive,
[src]
T: 'static + Primitive,
type Subpixel = T
pub const CHANNEL_COUNT: u8
[src]
pub const COLOR_MODEL: &'static str
[src]
pub const COLOR_TYPE: ColorType
[src]
pub fn channels(&self) -> &[T]ⓘ
[src]
pub fn channels_mut(&mut self) -> &mut [T]ⓘ
[src]
pub fn channels4(&self) -> (T, T, T, T)
[src]
pub fn from_channels(a: T, b: T, c: T, d: T) -> LumaA<T>
[src]
pub fn from_slice(slice: &[T]) -> &LumaA<T>
[src]
pub fn from_slice_mut(slice: &mut [T]) -> &mut LumaA<T>
[src]
pub fn to_rgb(&self) -> Rgb<T>
[src]
pub fn to_bgr(&self) -> Bgr<T>
[src]
pub fn to_rgba(&self) -> Rgba<T>
[src]
pub fn to_bgra(&self) -> Bgra<T>
[src]
pub fn to_luma(&self) -> Luma<T>
[src]
pub fn to_luma_alpha(&self) -> LumaA<T>
[src]
pub fn map<F>(&self, f: F) -> LumaA<T> where
F: FnMut(T) -> T,
[src]
F: FnMut(T) -> T,
pub fn apply<F>(&mut self, f: F) where
F: FnMut(T) -> T,
[src]
F: FnMut(T) -> T,
pub fn map_with_alpha<F, G>(&self, f: F, g: G) -> LumaA<T> where
F: FnMut(T) -> T,
G: FnMut(T) -> T,
[src]
F: FnMut(T) -> T,
G: FnMut(T) -> T,
pub fn apply_with_alpha<F, G>(&mut self, f: F, g: G) where
F: FnMut(T) -> T,
G: FnMut(T) -> T,
[src]
F: FnMut(T) -> T,
G: FnMut(T) -> T,
pub fn map2<F>(&self, other: &LumaA<T>, f: F) -> LumaA<T> where
F: FnMut(T, T) -> T,
[src]
F: FnMut(T, T) -> T,
pub fn apply2<F>(&mut self, other: &LumaA<T>, f: F) where
F: FnMut(T, T) -> T,
[src]
F: FnMut(T, T) -> T,
pub fn invert(&mut self)
[src]
pub fn blend(&mut self, other: &LumaA<T>)
[src]
impl<T> Pixel for Rgb<T> where
T: 'static + Primitive,
[src]
T: 'static + Primitive,
type Subpixel = T
pub const CHANNEL_COUNT: u8
[src]
pub const COLOR_MODEL: &'static str
[src]
pub const COLOR_TYPE: ColorType
[src]
pub fn channels(&self) -> &[T]ⓘ
[src]
pub fn channels_mut(&mut self) -> &mut [T]ⓘ
[src]
pub fn channels4(&self) -> (T, T, T, T)
[src]
pub fn from_channels(a: T, b: T, c: T, d: T) -> Rgb<T>
[src]
pub fn from_slice(slice: &[T]) -> &Rgb<T>
[src]
pub fn from_slice_mut(slice: &mut [T]) -> &mut Rgb<T>
[src]
pub fn to_rgb(&self) -> Rgb<T>
[src]
pub fn to_bgr(&self) -> Bgr<T>
[src]
pub fn to_rgba(&self) -> Rgba<T>
[src]
pub fn to_bgra(&self) -> Bgra<T>
[src]
pub fn to_luma(&self) -> Luma<T>
[src]
pub fn to_luma_alpha(&self) -> LumaA<T>
[src]
pub fn map<F>(&self, f: F) -> Rgb<T> where
F: FnMut(T) -> T,
[src]
F: FnMut(T) -> T,
pub fn apply<F>(&mut self, f: F) where
F: FnMut(T) -> T,
[src]
F: FnMut(T) -> T,
pub fn map_with_alpha<F, G>(&self, f: F, g: G) -> Rgb<T> where
F: FnMut(T) -> T,
G: FnMut(T) -> T,
[src]
F: FnMut(T) -> T,
G: FnMut(T) -> T,
pub fn apply_with_alpha<F, G>(&mut self, f: F, g: G) where
F: FnMut(T) -> T,
G: FnMut(T) -> T,
[src]
F: FnMut(T) -> T,
G: FnMut(T) -> T,
pub fn map2<F>(&self, other: &Rgb<T>, f: F) -> Rgb<T> where
F: FnMut(T, T) -> T,
[src]
F: FnMut(T, T) -> T,
pub fn apply2<F>(&mut self, other: &Rgb<T>, f: F) where
F: FnMut(T, T) -> T,
[src]
F: FnMut(T, T) -> T,
pub fn invert(&mut self)
[src]
pub fn blend(&mut self, other: &Rgb<T>)
[src]
impl<T> Pixel for Rgba<T> where
T: 'static + Primitive,
[src]
T: 'static + Primitive,
type Subpixel = T
pub const CHANNEL_COUNT: u8
[src]
pub const COLOR_MODEL: &'static str
[src]
pub const COLOR_TYPE: ColorType
[src]
pub fn channels(&self) -> &[T]ⓘ
[src]
pub fn channels_mut(&mut self) -> &mut [T]ⓘ
[src]
pub fn channels4(&self) -> (T, T, T, T)
[src]
pub fn from_channels(a: T, b: T, c: T, d: T) -> Rgba<T>
[src]
pub fn from_slice(slice: &[T]) -> &Rgba<T>
[src]
pub fn from_slice_mut(slice: &mut [T]) -> &mut Rgba<T>
[src]
pub fn to_rgb(&self) -> Rgb<T>
[src]
pub fn to_bgr(&self) -> Bgr<T>
[src]
pub fn to_rgba(&self) -> Rgba<T>
[src]
pub fn to_bgra(&self) -> Bgra<T>
[src]
pub fn to_luma(&self) -> Luma<T>
[src]
pub fn to_luma_alpha(&self) -> LumaA<T>
[src]
pub fn map<F>(&self, f: F) -> Rgba<T> where
F: FnMut(T) -> T,
[src]
F: FnMut(T) -> T,
pub fn apply<F>(&mut self, f: F) where
F: FnMut(T) -> T,
[src]
F: FnMut(T) -> T,
pub fn map_with_alpha<F, G>(&self, f: F, g: G) -> Rgba<T> where
F: FnMut(T) -> T,
G: FnMut(T) -> T,
[src]
F: FnMut(T) -> T,
G: FnMut(T) -> T,
pub fn apply_with_alpha<F, G>(&mut self, f: F, g: G) where
F: FnMut(T) -> T,
G: FnMut(T) -> T,
[src]
F: FnMut(T) -> T,
G: FnMut(T) -> T,
pub fn map2<F>(&self, other: &Rgba<T>, f: F) -> Rgba<T> where
F: FnMut(T, T) -> T,
[src]
F: FnMut(T, T) -> T,
pub fn apply2<F>(&mut self, other: &Rgba<T>, f: F) where
F: FnMut(T, T) -> T,
[src]
F: FnMut(T, T) -> T,