[−][src]Struct dither::color::RGB
RGB represents a triplet of pixels (r, g, b). u8, i8, i16, and u16 are all one-word COPY types.
Methods
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<f64>
[src]
pub fn to_chroma_corrected_black_and_white(&self) -> f64
[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 From<RGB<u8>> for RGB<f64>
[src]
impl<N: Copy, M: From<N>> From<[N; 3]> for RGB<M>
[src]
impl<N, M: From<N>> From<(N, N, N)> for RGB<M>
[src]
impl<N: Eq> Eq for RGB<N>
[src]
impl<N: Default> Default for RGB<N>
[src]
impl Copy for RGB<u8>
[src]
impl Copy for RGB<i8>
[src]
impl Copy for RGB<i16>
[src]
impl Copy for RGB<u16>
[src]
impl<N: PartialEq> PartialEq<RGB<N>> for RGB<N>
[src]
impl<N: Clone> Clone for RGB<N>
[src]
fn clone(&self) -> RGB<N>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl LowerHex for RGB<u8>
[src]
impl<N: Debug> Debug for RGB<N>
[src]
impl<N: Hash> Hash for RGB<N>
[src]
fn hash<__HN: Hasher>(&self, state: &mut __HN)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<N: Add<Output = N>> Add<RGB<N>> for RGB<N>
[src]
type Output = Self
The resulting type after applying the +
operator.
fn add(self, other: Self) -> Self
[src]
impl<N: Sub<Output = N>> Sub<RGB<N>> for RGB<N>
[src]
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, other: Self) -> Self
[src]
impl<S: Mul<Output = S> + Copy> Mul<S> for RGB<S>
[src]
impl<S: Div<Output = S> + Copy> Div<S> for RGB<S>
[src]
impl<S: Rem<Output = S> + Copy> Rem<S> for RGB<S>
[src]
impl<N: Neg<Output = N>> Neg for RGB<N>
[src]
impl<T: From<u8>> FromStr for RGB<T>
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
Sets value
as a parameter of self
.