#[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.)
Convenience function for creating a new pixel
The order of arguments is R,G,B
Iterate over color components (R, G, and B)
Convenience function for converting to RGBA
Convenience function for converting to RGBA with alpha channel of a different type than type of the pixels
The resulting type after applying the +
operator.
The resulting type after applying the +
operator.
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
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
impl<ComponentType> Clone for RGB<ComponentType> where
ComponentType: Clone,
Performs copy-assignment from source
. Read more
Convenience function for applying the same formula to every rgb/gray component, but skipping the alpha component. Read more
Convenience function (equivalent of self.iter().map().collect()
) for applying the same formula to every component. Read more
The components interpreted as an array, e.g. one RGB
expands to 3 elements. Read more
The components interpreted as a mutable array, e.g. one RGB
expands to 3 elements. Read more
impl<ComponentType> Debug for RGB<ComponentType> where
ComponentType: Debug,
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Formats the value using the given formatter. Read more
The resulting type after applying the /
operator.
Takes exactly 3 elements from the iterator and creates a new instance.
Panics if there are fewer elements in the iterator.
impl<ComponentType> Hash for RGB<ComponentType> where
ComponentType: Hash,
Formats the value using the given formatter.
The resulting type after applying the *
operator.
impl<ComponentType> Ord for RGB<ComponentType> where
ComponentType: Ord,
Compares and returns the maximum of two values. Read more
Compares and returns the minimum of two values. Read more
Restrict a value to a certain interval. Read more
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
The resulting type after applying the -
operator.
The resulting type after applying the -
operator.
Method which takes an iterator and generates Self
from the elements by
“summing up” the items. Read more
Formats the value using the given formatter.
impl<T> Zeroable for RGB<T> where
T: Zeroable,
impl<ComponentType> Copy for RGB<ComponentType> where
ComponentType: Copy,
impl<ComponentType> Eq for RGB<ComponentType> where
ComponentType: Eq,
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<T> Any for T where
T: 'static + ?Sized,
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
impl<T> CallHasher for T where
T: Hash + ?Sized,
impl<T, U> Into<U> for T where
U: From<T>,
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String
. Read more
The type returned in the event of a conversion error.
The type returned in the event of a conversion error.