Struct dither::color::RGB [−][src]
pub struct RGB<N>(pub N, pub N, pub N);
RGB represents a triplet of pixels (r, g, b). u8, i8, i16, and u16 are all one-word COPY types.
Implementations
impl<P> RGB<P>
[src]
impl<P> RGB<P>
[src]pub fn convert_with<Q>(self, convert: impl FnMut(P) -> Q) -> RGB<Q>
[src]
map a function across all channels of the RGB.
assert_eq!(RGB(2_u8, 5, 8).convert_with(|channel| channel+10), RGB(12_u8, 15, 18));
pub fn map_across(
quantize: impl FnMut(P) -> (P, P)
) -> impl FnMut(RGB<P>) -> (RGB<P>, RGB<P>)
[src]
quantize: impl FnMut(P) -> (P, P)
) -> impl FnMut(RGB<P>) -> (RGB<P>, RGB<P>)
this higher-order function takes a function from function from P to (P, P) and creates the equivalent function that maps it across RGB
.
impl RGB<u8>
[src]
impl RGB<u8>
[src]pub const unsafe fn from_hex(hex: u32) -> Self
[src]
convert a hexidecimal code to the appropriate RGB value, silently discarding the highest 8 bits, if they exist.
Proper use should ensure that the input is less than or equal to 0xFFFFFF
assert_eq!(unsafe{RGB::from_hex(0xff_aa_bb)}, RGB(0xff, 0xaa, 0xbb));
pub fn from_chroma_corrected_black_and_white(p: f64) -> Self
[src]
pub fn to_hex(self) -> u32
[src]
convert to the equivalent 24-bit hexidecimal integer.
assert_eq!(RGB(0xff, 0, 0).to_hex(), 0xff_00_00)
Trait Implementations
impl<N> StructuralEq for RGB<N>
[src]
impl<N> StructuralEq for RGB<N>
[src]impl<N> StructuralPartialEq for RGB<N>
[src]
impl<N> StructuralPartialEq for RGB<N>
[src]Auto Trait Implementations
impl<N> RefUnwindSafe for RGB<N> where
N: RefUnwindSafe,
impl<N> RefUnwindSafe for RGB<N> where
N: RefUnwindSafe,
impl<N> UnwindSafe for RGB<N> where
N: UnwindSafe,
impl<N> UnwindSafe for RGB<N> where
N: UnwindSafe,