Expand description
RGB colors + alpha channel
Tuple Fields
0: [T; 4]Trait Implementations
sourceimpl<T> ArrayData for Rgba<T>where
T: Primitive,
Rgba<T>: Pixel,
<Rgba<T> as Pixel>::Subpixel == T,
impl<T> ArrayData for Rgba<T>where
T: Primitive,
Rgba<T>: Pixel,
<Rgba<T> as Pixel>::Subpixel == T,
type DataType = [T; 4]
type DataType = [T; 4]
The type of the data for this array.
e.g. [T; 1] for Luma, [T; 3] for Rgb. Read more
sourcefn data(&self) -> <Rgba<T> as ArrayData>::DataType
fn data(&self) -> <Rgba<T> as ArrayData>::DataType
Get the data from this pixel as a constant length array.
sourceimpl<T> PartialEq<Rgba<T>> for Rgba<T>where
T: PartialEq<T>,
impl<T> PartialEq<Rgba<T>> for Rgba<T>where
T: PartialEq<T>,
sourceimpl<T> Pixel for Rgba<T>where
T: Primitive + Enlargeable,
impl<T> Pixel for Rgba<T>where
T: Primitive + Enlargeable,
type Subpixel = T
type Subpixel = T
The scalar type that is used to store each channel in this pixel.
sourceconst CHANNEL_COUNT: u8 = 4u8
const CHANNEL_COUNT: u8 = 4u8
The number of channels of this pixel type.
sourcefn channels(&self) -> &[T]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
fn channels(&self) -> &[T]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
Returns the components as a slice.
sourcefn channels_mut(&mut self) -> &mut [T]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
fn channels_mut(&mut self) -> &mut [T]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
Returns the components as a mutable slice
sourceconst COLOR_MODEL: &'static str = "RGBA"
const COLOR_MODEL: &'static str = "RGBA"
sourcefn channels4(&self) -> (T, T, T, T)
fn channels4(&self) -> (T, T, T, T)
Use channels() or channels_mut()
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 Read more
sourcefn from_channels(a: T, b: T, c: T, d: T) -> Rgba<T>
fn from_channels(a: T, b: T, c: T, d: T) -> Rgba<T>
Use the constructor of the pixel, for example Rgba::new(r,g,b,a) or Pixel::from_slice
Construct a pixel from the 4 channels a, b, c and d. If the pixel does not contain 4 channels the extra are ignored. Read more
sourcefn from_slice(slice: &[T]) -> &Rgba<T>
fn from_slice(slice: &[T]) -> &Rgba<T>
Returns a view into a slice. Read more
sourcefn from_slice_mut(slice: &mut [T]) -> &mut Rgba<T>
fn from_slice_mut(slice: &mut [T]) -> &mut Rgba<T>
Returns mutable view into a mutable slice. Read more
sourcefn to_luma_alpha(&self) -> LumaA<T>
fn to_luma_alpha(&self) -> LumaA<T>
Convert this pixel to luma with an alpha channel
sourcefn map<F>(&self, f: F) -> Rgba<T>where
F: FnMut(T) -> T,
fn map<F>(&self, f: F) -> Rgba<T>where
F: FnMut(T) -> T,
Apply the function f to each channel of this pixel.
sourcefn apply<F>(&mut self, f: F)where
F: FnMut(T) -> T,
fn apply<F>(&mut self, f: F)where
F: FnMut(T) -> T,
Apply the function f to each channel of this pixel.
sourcefn map_with_alpha<F, G>(&self, f: F, g: G) -> Rgba<T>where
F: FnMut(T) -> T,
G: FnMut(T) -> T,
fn map_with_alpha<F, G>(&self, f: F, g: G) -> Rgba<T>where
F: FnMut(T) -> T,
G: FnMut(T) -> T,
Apply the function f to each channel except the alpha channel.
Apply the function g to the alpha channel. Read more
sourcefn apply_with_alpha<F, G>(&mut self, f: F, g: G)where
F: FnMut(T) -> T,
G: FnMut(T) -> T,
fn apply_with_alpha<F, G>(&mut self, f: F, g: G)where
F: FnMut(T) -> T,
G: FnMut(T) -> T,
Apply the function f to each channel except the alpha channel.
Apply the function g to the alpha channel. Works in-place. Read more
sourcefn map2<F>(&self, other: &Rgba<T>, f: F) -> Rgba<T>where
F: FnMut(T, T) -> T,
fn map2<F>(&self, other: &Rgba<T>, f: F) -> Rgba<T>where
F: FnMut(T, T) -> T,
Apply the function f to each channel of this pixel and
other pairwise. Read more
sourcefn apply2<F>(&mut self, other: &Rgba<T>, f: F)where
F: FnMut(T, T) -> T,
fn apply2<F>(&mut self, other: &Rgba<T>, f: F)where
F: FnMut(T, T) -> T,
Apply the function f to each channel of this pixel and
other pairwise. Works in-place. Read more
sourcefn blend(&mut self, other: &Rgba<T>)
fn blend(&mut self, other: &Rgba<T>)
Blend the color of a given pixel into ourself, taking into account alpha channels
sourcefn map_without_alpha<F>(&self, f: F) -> Selfwhere
F: FnMut(Self::Subpixel) -> Self::Subpixel,
fn map_without_alpha<F>(&self, f: F) -> Selfwhere
F: FnMut(Self::Subpixel) -> Self::Subpixel,
Apply the function f to each channel except the alpha channel.
sourceimpl PixelWithColorType for Rgba<f32>
impl PixelWithColorType for Rgba<f32>
sourceconst COLOR_TYPE: ColorType = ColorType::Rgba32F
const COLOR_TYPE: ColorType = ColorType::Rgba32F
This pixel has the format of one of the predefined ColorTypes,
such as Rgb8, La16 or Rgba32F.
This is needed for automatically detecting
a color format when saving an image as a file. Read more
sourceimpl PixelWithColorType for Rgba<u16>
impl PixelWithColorType for Rgba<u16>
sourceconst COLOR_TYPE: ColorType = ColorType::Rgba16
const COLOR_TYPE: ColorType = ColorType::Rgba16
This pixel has the format of one of the predefined ColorTypes,
such as Rgb8, La16 or Rgba32F.
This is needed for automatically detecting
a color format when saving an image as a file. Read more
sourceimpl PixelWithColorType for Rgba<u8>
impl PixelWithColorType for Rgba<u8>
sourceconst COLOR_TYPE: ColorType = ColorType::Rgba8
const COLOR_TYPE: ColorType = ColorType::Rgba8
This pixel has the format of one of the predefined ColorTypes,
such as Rgb8, La16 or Rgba32F.
This is needed for automatically detecting
a color format when saving an image as a file. Read more
sourceimpl<T, U> WithChannel<U> for Rgba<T>where
T: Primitive,
U: Primitive,
Rgba<T>: Pixel,
Rgba<U>: Pixel,
<Rgba<T> as Pixel>::Subpixel == T,
<Rgba<U> as Pixel>::Subpixel == U,
impl<T, U> WithChannel<U> for Rgba<T>where
T: Primitive,
U: Primitive,
Rgba<T>: Pixel,
Rgba<U>: Pixel,
<Rgba<T> as Pixel>::Subpixel == T,
<Rgba<U> as Pixel>::Subpixel == U,
impl<T> Copy for Rgba<T>where
T: Copy,
impl<T> Eq for Rgba<T>where
T: Eq,
impl<T> StructuralEq for Rgba<T>
impl<T> StructuralPartialEq for Rgba<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for Rgba<T>where
T: RefUnwindSafe,
impl<T> Send for Rgba<T>where
T: Send,
impl<T> Sync for Rgba<T>where
T: Sync,
impl<T> Unpin for Rgba<T>where
T: Unpin,
impl<T> UnwindSafe for Rgba<T>where
T: UnwindSafe,
Blanket Implementations
impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
type Err = NoError
type Err = NoError
The error type produced by a failed conversion.
fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
Convert the given value into an approximately equivalent representation.
impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
The error type produced by a failed conversion.
fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
Convert the subject into an approximately equivalent representation.
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> ConvUtil for T
impl<T> ConvUtil for T
fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: ApproxInto<Dst, DefaultApprox>,
fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: ApproxInto<Dst, DefaultApprox>,
Approximate the subject to a given type with the default scheme.
fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>where
Self: ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>where
Self: ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
Approximate the subject to a given type with a specific scheme.
impl<T> Pointable for T
impl<T> Pointable for T
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct self from the equivalent element of its
superset. Read more
fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if self is actually part of its subset T (and can be converted to it).
fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset but without any property checks. Always succeeds.
fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts self to the equivalent element of its superset.
impl<V, T> VZip<V> for Twhere
V: MultiLane<T>,
impl<V, T> VZip<V> for Twhere
V: MultiLane<T>,
fn vzip(self) -> V
impl<Src> ValueFrom<Src> for Src
impl<Src> ValueFrom<Src> for Src
type Err = NoError
type Err = NoError
The error type produced by a failed conversion.
fn value_from(src: Src) -> Result<Src, <Src as ValueFrom<Src>>::Err>
fn value_from(src: Src) -> Result<Src, <Src as ValueFrom<Src>>::Err>
Convert the given value into an exactly equivalent representation.
impl<Src, Dst> ValueInto<Dst> for Srcwhere
Dst: ValueFrom<Src>,
impl<Src, Dst> ValueInto<Dst> for Srcwhere
Dst: ValueFrom<Src>,
type Err = <Dst as ValueFrom<Src>>::Err
type Err = <Dst as ValueFrom<Src>>::Err
The error type produced by a failed conversion.
fn value_into(self) -> Result<Dst, <Src as ValueInto<Dst>>::Err>
fn value_into(self) -> Result<Dst, <Src as ValueInto<Dst>>::Err>
Convert the subject into an exactly equivalent representation.