[−][src]Struct riddle_image::Color
An RGBA color, parameterized over color channel type.
The two supported channel types are u8
and f32
.
Example
let c = Color{ r: 1.0, g: 0.0, b: 0.0, a: 1.0 };
Fields
r: E
Red
g: E
Green
b: E
Blue
a: E
Alpha
Implementations
impl<E> Color<E> where
E: ColorElement,
[src]
E: ColorElement,
pub const RED: Color<E>
[src]
Opaque primary red
pub const GREEN: Color<E>
[src]
Opaque primary green
pub const BLUE: Color<E>
[src]
Opaque primary blue
pub const BLACK: Color<E>
[src]
Opaque black
pub const WHITE: Color<E>
[src]
Opaque white
pub const TRANSPARENT_BLACK: Color<E>
[src]
Transparent black
pub const ZERO: Color<E>
[src]
Transparent black
pub fn rgba(r: E, g: E, b: E, a: E) -> Color<E>
[src]
Example
let c = Color::rgba(1.0, 0.0, 0.0, 1.0);
pub fn rgb(r: E, g: E, b: E) -> Color<E>
[src]
Example
let c = Color::rgb(1.0, 0.0, 0.0); assert_eq!(Color::rgba(1.0, 0.0, 0.0, 1.0), c);
Trait Implementations
impl<E> Clone for Color<E> where
E: Clone,
[src]
E: Clone,
impl<T, F> ColorElementConversion<Color<T>> for Color<F> where
F: ColorElementConversion<T>,
T: ColorElement,
[src]
F: ColorElementConversion<T>,
T: ColorElement,
Support converting colors between element types
Example
let a: Color<f32> = Color::RED; let b: Color<u8> = Color::RED; let a_converted: Color<u8> = a.convert(); assert_eq!(b, a_converted);
impl<E> Debug for Color<E> where
E: Debug,
[src]
E: Debug,
impl<E> Eq for Color<E> where
E: PartialEq<E>,
[src]
E: PartialEq<E>,
impl<E> From<[E; 3]> for Color<E> where
E: ColorElement,
[src]
E: ColorElement,
impl<E> From<[E; 4]> for Color<E> where
E: ColorElement,
[src]
E: ColorElement,
impl<E> PartialEq<Color<E>> for Color<E> where
E: PartialEq<E>,
[src]
E: PartialEq<E>,
Auto Trait Implementations
impl<E> RefUnwindSafe for Color<E> where
E: RefUnwindSafe,
E: RefUnwindSafe,
impl<E> Send for Color<E> where
E: Send,
E: Send,
impl<E> Sync for Color<E> where
E: Sync,
E: Sync,
impl<E> Unpin for Color<E> where
E: Unpin,
E: Unpin,
impl<E> UnwindSafe for Color<E> where
E: UnwindSafe,
E: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> 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, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,