#[repr(C)]pub struct RGB<ComponentType> {
pub r: ComponentType,
pub g: ComponentType,
pub b: ComponentType,
}Expand description
The RGB pixel
The component type can be u8 (aliased as RGB8), u16 (aliased as RGB16),
or any other type (but simple copyable types are recommended.)
Fields§
§r: ComponentTypeRed
g: ComponentTypeGreen
b: ComponentTypeBlue
Implementations§
Trait Implementations§
source§impl<T> AddAssign<RGB<T>> for RGB<T>where
T: Add<Output = T> + Copy,
impl<T> AddAssign<RGB<T>> for RGB<T>where
T: Add<Output = T> + Copy,
px + px
source§fn add_assign(&mut self, other: RGB<T>)
fn add_assign(&mut self, other: RGB<T>)
Performs the
+= operation. Read moresource§impl<T> AddAssign<T> for RGB<T>where
T: Copy + Add<Output = T>,
impl<T> AddAssign<T> for RGB<T>where
T: Copy + Add<Output = T>,
px + 1
source§fn add_assign(&mut self, r: T)
fn add_assign(&mut self, r: T)
Performs the
+= operation. Read moresource§impl<T> AsPixels<RGB<T>> for [T]
impl<T> AsPixels<RGB<T>> for [T]
source§fn as_pixels(&self) -> &[RGB<T>]
fn as_pixels(&self) -> &[RGB<T>]
Reinterpret the slice as a read-only/shared slice of pixels.
Multiple consecutive elements in the slice are intepreted as a single pixel
(depending on format, e.g. 3 for RGB, 4 for RGBA). Read more
source§fn as_pixels_mut(&mut self) -> &mut [RGB<T>]
fn as_pixels_mut(&mut self) -> &mut [RGB<T>]
Reinterpret the slice as a mutable/exclusive slice of pixels.
Multiple consecutive elements in the slice are intepreted as a single pixel
(depending on format, e.g. 3 for RGB, 4 for RGBA). Read more
source§impl<T> ComponentSlice<T> for RGB<T>
impl<T> ComponentSlice<T> for RGB<T>
source§impl<'de, ComponentType> Deserialize<'de> for RGB<ComponentType>where
ComponentType: Deserialize<'de>,
impl<'de, ComponentType> Deserialize<'de> for RGB<ComponentType>where
ComponentType: Deserialize<'de>,
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<T> DivAssign<T> for RGB<T>where
T: Copy + Div<Output = T>,
impl<T> DivAssign<T> for RGB<T>where
T: Copy + Div<Output = T>,
px * 1
source§fn div_assign(&mut self, r: T)
fn div_assign(&mut self, r: T)
Performs the
/= operation. Read moresource§impl<T> FromIterator<T> for RGB<T>
impl<T> FromIterator<T> for RGB<T>
source§fn from_iter<I: IntoIterator<Item = T>>(into_iter: I) -> Self
fn from_iter<I: IntoIterator<Item = T>>(into_iter: I) -> Self
Takes exactly 3 elements from the iterator and creates a new instance. Panics if there are fewer elements in the iterator.
source§impl<T> MulAssign<RGB<T>> for RGB<T>where
T: Mul<Output = T> + Copy,
impl<T> MulAssign<RGB<T>> for RGB<T>where
T: Mul<Output = T> + Copy,
px * px
source§fn mul_assign(&mut self, other: RGB<T>)
fn mul_assign(&mut self, other: RGB<T>)
Performs the
*= operation. Read moresource§impl<T> MulAssign<T> for RGB<T>where
T: Copy + Mul<Output = T>,
impl<T> MulAssign<T> for RGB<T>where
T: Copy + Mul<Output = T>,
px * 1
source§fn mul_assign(&mut self, r: T)
fn mul_assign(&mut self, r: T)
Performs the
*= operation. Read moresource§impl<ComponentType: Ord> Ord for RGB<ComponentType>
impl<ComponentType: Ord> Ord for RGB<ComponentType>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<ComponentType: PartialEq> PartialEq<RGB<ComponentType>> for RGB<ComponentType>
impl<ComponentType: PartialEq> PartialEq<RGB<ComponentType>> for RGB<ComponentType>
source§impl<ComponentType: PartialOrd> PartialOrd<RGB<ComponentType>> for RGB<ComponentType>
impl<ComponentType: PartialOrd> PartialOrd<RGB<ComponentType>> for RGB<ComponentType>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moresource§impl<T> SubAssign<RGB<T>> for RGB<T>where
T: Sub<Output = T> + Copy,
impl<T> SubAssign<RGB<T>> for RGB<T>where
T: Sub<Output = T> + Copy,
px - px
source§fn sub_assign(&mut self, other: RGB<T>)
fn sub_assign(&mut self, other: RGB<T>)
Performs the
-= operation. Read moresource§impl<T> SubAssign<T> for RGB<T>where
T: Copy + Sub<Output = T>,
impl<T> SubAssign<T> for RGB<T>where
T: Copy + Sub<Output = T>,
px - 1
source§fn sub_assign(&mut self, r: T)
fn sub_assign(&mut self, r: T)
Performs the
-= operation. Read more