pub struct Pixel<C: Color>(/* private fields */);
Expand description
Normalized image data
Implementations§
Source§impl<C: Color> Pixel<C>
impl<C: Color> Pixel<C>
Sourcepub fn with_color<D: Color>(self) -> Pixel<D>
pub fn with_color<D: Color>(self) -> Pixel<D>
Update the colorspace associated with a pixel without performing any conversion
Sourcepub fn is_alpha(&self, index: Channel) -> bool
pub fn is_alpha(&self, index: Channel) -> bool
Returns true when the provided channel index matches the alpha channel index
Sourcepub fn with_alpha(&mut self, value: f64) -> &mut Self
pub fn with_alpha(&mut self, value: f64) -> &mut Self
Set alpha value
Sourcepub fn convert_to<D: Color>(&self, dest: &mut Pixel<D>)
pub fn convert_to<D: Color>(&self, dest: &mut Pixel<D>)
Convert pixel color type to an existing pixel
Sourcepub fn copy_from_slice<T: Type>(&mut self, data: impl AsRef<[T]>) -> &mut Self
pub fn copy_from_slice<T: Type>(&mut self, data: impl AsRef<[T]>) -> &mut Self
Copy values from an existing slice
Sourcepub fn copy_from_data<T: Type>(&mut self, data: &Data<'_, T, C>) -> &mut Self
pub fn copy_from_data<T: Type>(&mut self, data: &Data<'_, T, C>) -> &mut Self
Copy values from an existing slice
Sourcepub fn convert_from_data<T: Type, D: Color>(&mut self, data: &Data<'_, T, D>)
pub fn convert_from_data<T: Type, D: Color>(&mut self, data: &Data<'_, T, D>)
Convert color and copy to slice
Sourcepub fn convert_to_data<T: Type, D: Color>(&self, data: &mut DataMut<'_, T, D>)
pub fn convert_to_data<T: Type, D: Color>(&self, data: &mut DataMut<'_, T, D>)
Convert color and copy to slice
Sourcepub fn copy_to_slice<T: Type>(&self, data: impl AsMut<[T]>)
pub fn copy_to_slice<T: Type>(&self, data: impl AsMut<[T]>)
Copy values to an existing slice
Sourcepub fn blend_alpha(&mut self) -> &mut Self
pub fn blend_alpha(&mut self) -> &mut Self
Blend alpha value
Sourcepub fn map(&mut self, f: impl Fn(f64) -> f64) -> &mut Self
pub fn map(&mut self, f: impl Fn(f64) -> f64) -> &mut Self
Create a new pixel by applying f
over an existing pixel
Sourcepub fn map2(
&mut self,
other: &Pixel<C>,
f: impl Fn(f64, f64) -> f64,
) -> &mut Self
pub fn map2( &mut self, other: &Pixel<C>, f: impl Fn(f64, f64) -> f64, ) -> &mut Self
Zip two pixels, apply f
and return a new pixel with the results
Sourcepub fn iter(&self) -> impl Iterator<Item = &f64>
pub fn iter(&self) -> impl Iterator<Item = &f64>
Get iterator over pixel data, ignoring alpha channel
Trait Implementations§
Source§impl<'a, C: Color> AddAssign<&'a Pixel<C>> for Pixel<C>
impl<'a, C: Color> AddAssign<&'a Pixel<C>> for Pixel<C>
Source§fn add_assign(&mut self, other: &'a Pixel<C>)
fn add_assign(&mut self, other: &'a Pixel<C>)
Performs the
+=
operation. Read moreSource§impl<T: Type, C: Color> AddAssign<T> for Pixel<C>
impl<T: Type, C: Color> AddAssign<T> for Pixel<C>
Source§fn add_assign(&mut self, other: T)
fn add_assign(&mut self, other: T)
Performs the
+=
operation. Read moreSource§impl<C: Color> AddAssign for Pixel<C>
impl<C: Color> AddAssign for Pixel<C>
Source§fn add_assign(&mut self, other: Pixel<C>)
fn add_assign(&mut self, other: Pixel<C>)
Performs the
+=
operation. Read moreSource§impl<'de, C: Color> Deserialize<'de> for Pixel<C>
impl<'de, C: Color> Deserialize<'de> for Pixel<C>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<'a, C: Color> DivAssign<&'a Pixel<C>> for Pixel<C>
impl<'a, C: Color> DivAssign<&'a Pixel<C>> for Pixel<C>
Source§fn div_assign(&mut self, other: &'a Pixel<C>)
fn div_assign(&mut self, other: &'a Pixel<C>)
Performs the
/=
operation. Read moreSource§impl<T: Type, C: Color> DivAssign<T> for Pixel<C>
impl<T: Type, C: Color> DivAssign<T> for Pixel<C>
Source§fn div_assign(&mut self, other: T)
fn div_assign(&mut self, other: T)
Performs the
/=
operation. Read moreSource§impl<C: Color> DivAssign for Pixel<C>
impl<C: Color> DivAssign for Pixel<C>
Source§fn div_assign(&mut self, other: Pixel<C>)
fn div_assign(&mut self, other: Pixel<C>)
Performs the
/=
operation. Read moreSource§impl<T: Type, C: Color> FromIterator<T> for Pixel<C>
impl<T: Type, C: Color> FromIterator<T> for Pixel<C>
Source§fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
Creates a value from an iterator. Read more
Source§impl<C: Color> IntoIterator for Pixel<C>
impl<C: Color> IntoIterator for Pixel<C>
Source§impl<'a, C: Color> MulAssign<&'a Pixel<C>> for Pixel<C>
impl<'a, C: Color> MulAssign<&'a Pixel<C>> for Pixel<C>
Source§fn mul_assign(&mut self, other: &'a Pixel<C>)
fn mul_assign(&mut self, other: &'a Pixel<C>)
Performs the
*=
operation. Read moreSource§impl<T: Type, C: Color> MulAssign<T> for Pixel<C>
impl<T: Type, C: Color> MulAssign<T> for Pixel<C>
Source§fn mul_assign(&mut self, other: T)
fn mul_assign(&mut self, other: T)
Performs the
*=
operation. Read moreSource§impl<C: Color> MulAssign for Pixel<C>
impl<C: Color> MulAssign for Pixel<C>
Source§fn mul_assign(&mut self, other: Pixel<C>)
fn mul_assign(&mut self, other: Pixel<C>)
Performs the
*=
operation. Read moreSource§impl<C: PartialOrd + Color> PartialOrd for Pixel<C>
impl<C: PartialOrd + Color> PartialOrd for Pixel<C>
Source§impl<'a, C: Color> RemAssign<&'a Pixel<C>> for Pixel<C>
impl<'a, C: Color> RemAssign<&'a Pixel<C>> for Pixel<C>
Source§fn rem_assign(&mut self, other: &'a Pixel<C>)
fn rem_assign(&mut self, other: &'a Pixel<C>)
Performs the
%=
operation. Read moreSource§impl<T: Type, C: Color> RemAssign<T> for Pixel<C>
impl<T: Type, C: Color> RemAssign<T> for Pixel<C>
Source§fn rem_assign(&mut self, other: T)
fn rem_assign(&mut self, other: T)
Performs the
%=
operation. Read moreSource§impl<C: Color> RemAssign for Pixel<C>
impl<C: Color> RemAssign for Pixel<C>
Source§fn rem_assign(&mut self, other: Pixel<C>)
fn rem_assign(&mut self, other: Pixel<C>)
Performs the
%=
operation. Read moreSource§impl<'a, C: Color> SubAssign<&'a Pixel<C>> for Pixel<C>
impl<'a, C: Color> SubAssign<&'a Pixel<C>> for Pixel<C>
Source§fn sub_assign(&mut self, other: &'a Pixel<C>)
fn sub_assign(&mut self, other: &'a Pixel<C>)
Performs the
-=
operation. Read moreSource§impl<T: Type, C: Color> SubAssign<T> for Pixel<C>
impl<T: Type, C: Color> SubAssign<T> for Pixel<C>
Source§fn sub_assign(&mut self, other: T)
fn sub_assign(&mut self, other: T)
Performs the
-=
operation. Read moreSource§impl<C: Color> SubAssign for Pixel<C>
impl<C: Color> SubAssign for Pixel<C>
Source§fn sub_assign(&mut self, other: Pixel<C>)
fn sub_assign(&mut self, other: Pixel<C>)
Performs the
-=
operation. Read moreimpl<C: Color> StructuralPartialEq for Pixel<C>
Auto Trait Implementations§
impl<C> Freeze for Pixel<C>
impl<C> RefUnwindSafe for Pixel<C>where
C: RefUnwindSafe,
impl<C> Send for Pixel<C>
impl<C> Sync for Pixel<C>
impl<C> Unpin for Pixel<C>
impl<C> UnwindSafe for Pixel<C>where
C: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more