#[repr(C)]pub struct RGB<ComponentType> {
pub r: ComponentType,
pub g: ComponentType,
pub b: ComponentType,
}
Expand description
An RGB pixel (from the rgb
crate)
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: ComponentType
Red
g: ComponentType
Green
b: ComponentType
Blue
Implementations§
Trait Implementations§
source§impl<T> AddAssign<T> for RGB<T>
impl<T> AddAssign<T> for RGB<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> AddAssign for RGB<T>
impl<T> AddAssign for RGB<T>
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> 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<T> DivAssign<T> for RGB<T>
impl<T> DivAssign<T> for RGB<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>(into_iter: I) -> RGB<T>where
I: IntoIterator<Item = T>,
fn from_iter<I>(into_iter: I) -> RGB<T>where
I: IntoIterator<Item = T>,
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<T> for RGB<T>
impl<T> MulAssign<T> for RGB<T>
px * 1
source§fn mul_assign(&mut self, r: T)
fn mul_assign(&mut self, r: T)
Performs the
*=
operation. Read moresource§impl<T> MulAssign for RGB<T>
impl<T> MulAssign for RGB<T>
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<ComponentType> Ord for RGB<ComponentType>where
ComponentType: Ord,
impl<ComponentType> Ord for RGB<ComponentType>where
ComponentType: Ord,
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 for RGB<ComponentType>where
ComponentType: PartialEq,
impl<ComponentType> PartialEq for RGB<ComponentType>where
ComponentType: PartialEq,
source§impl<ComponentType> PartialOrd for RGB<ComponentType>where
ComponentType: PartialOrd,
impl<ComponentType> PartialOrd for RGB<ComponentType>where
ComponentType: PartialOrd,
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<T> for RGB<T>
impl<T> SubAssign<T> for RGB<T>
px - 1
source§fn sub_assign(&mut self, r: T)
fn sub_assign(&mut self, r: T)
Performs the
-=
operation. Read moresource§impl<T> SubAssign for RGB<T>
impl<T> SubAssign for RGB<T>
px - px
source§fn sub_assign(&mut self, other: RGB<T>)
fn sub_assign(&mut self, other: RGB<T>)
Performs the
-=
operation. Read moreimpl<ComponentType> Copy for RGB<ComponentType>where
ComponentType: Copy,
impl<ComponentType> Eq for RGB<ComponentType>where
ComponentType: Eq,
impl<T> Pod for RGB<T>where
T: Pod,
impl<ComponentType> StructuralPartialEq for RGB<ComponentType>
Auto Trait Implementations§
impl<ComponentType> Freeze for RGB<ComponentType>where
ComponentType: Freeze,
impl<ComponentType> RefUnwindSafe for RGB<ComponentType>where
ComponentType: RefUnwindSafe,
impl<ComponentType> Send for RGB<ComponentType>where
ComponentType: Send,
impl<ComponentType> Sync for RGB<ComponentType>where
ComponentType: Sync,
impl<ComponentType> Unpin for RGB<ComponentType>where
ComponentType: Unpin,
impl<ComponentType> UnwindSafe for RGB<ComponentType>where
ComponentType: 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> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
§type Bits = T
type Bits = T
Self
must have the same layout as the specified Bits
except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern
.source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret
bits
as &Self
.