[][src]Struct xblend::RGB

pub struct RGB<T: InnerType>(_, _, _);

This struct represents a RGB color

Implementations

impl<T: InnerType> RGB<T>[src]

pub fn new(r: T, g: T, b: T) -> RGB<T>[src]

Create a new RGB color with 3 components.

pub fn r(&self) -> T[src]

Get the Red component.

pub fn g(&self) -> T[src]

Get the Green component.

pub fn b(&self) -> T[src]

Get the Blue component.

impl RGB<f32>[src]

pub fn to_gray(&self) -> f32[src]

Calculate the gray value
the result equals R*0.33+G*0.59+B*0.11

pub fn to_u8(&self) -> RGB<u8>[src]

Convert itself into RGB<u8>

pub fn as_u32(&self) -> u32[src]

Get the unsigned integer representation of itself.

impl RGB<u8>[src]

pub fn to_gray(&self) -> u8[src]

Calculate the gray value
The result equals(R*28+G*151+B*77)>>8

pub fn to_f32(&self) -> RGB<f32>[src]

Convert itself into RGB<f32>

pub fn as_u32(&self) -> u32[src]

Get the unsigned integer representation of itself

Trait Implementations

impl Add<RGB<f32>> for RGB<f32>[src]

type Output = RGB<f32>

The resulting type after applying the + operator.

impl Add<RGB<u8>> for RGB<u8>[src]

type Output = RGB<u8>

The resulting type after applying the + operator.

impl Clear for RGB<f32>[src]

type Output = RGB<f32>

impl<T: Clone + InnerType> Clone for RGB<T>[src]

impl<T: Copy + InnerType> Copy for RGB<T>[src]

impl Darken for RGB<f32>[src]

type Output = RGB<f32>

impl<T: Debug + InnerType> Debug for RGB<T>[src]

impl<T: Default + InnerType> Default for RGB<T>[src]

impl Div<RGB<f32>> for RGB<f32>[src]

type Output = RGB<f32>

The resulting type after applying the / operator.

impl Div<RGB<u8>> for RGB<u8>[src]

type Output = RGB<u8>

The resulting type after applying the / operator.

impl Dst for RGB<f32>[src]

type Output = RGB<f32>

impl<T: Eq + InnerType> Eq for RGB<T>[src]

impl From<RGB<f32>> for RGB<u8>[src]

impl From<RGB<u8>> for RGB<f32>[src]

impl<T: InnerType> From<RGBA<T>> for RGB<T>[src]

impl From<u32> for RGB<u8>[src]

impl<T: Hash + InnerType> Hash for RGB<T>[src]

impl Into<u32> for RGB<u8>[src]

impl Lighten for RGB<f32>[src]

type Output = RGB<f32>

impl Mul<RGB<f32>> for RGB<f32>[src]

type Output = RGB<f32>

The resulting type after applying the * operator.

impl Mul<RGB<u8>> for RGB<u8>[src]

type Output = RGB<u8>

The resulting type after applying the * operator.

impl Multiply for RGB<f32>[src]

type Output = RGB<f32>

impl<T: Ord + InnerType> Ord for RGB<T>[src]

impl<T: PartialEq + InnerType> PartialEq<RGB<T>> for RGB<T>[src]

impl<T: PartialOrd + InnerType> PartialOrd<RGB<T>> for RGB<T>[src]

impl Screen for RGB<f32>[src]

type Output = RGB<f32>

impl Src for RGB<f32>[src]

type Output = RGB<f32>

impl<T: InnerType> StructuralEq for RGB<T>[src]

impl<T: InnerType> StructuralPartialEq for RGB<T>[src]

impl Sub<RGB<f32>> for RGB<f32>[src]

type Output = RGB<f32>

The resulting type after applying the - operator.

impl Sub<RGB<u8>> for RGB<u8>[src]

type Output = RGB<u8>

The resulting type after applying the - operator.

Auto Trait Implementations

impl<T> RefUnwindSafe for RGB<T> where
    T: RefUnwindSafe
[src]

impl<T> Send for RGB<T> where
    T: Send
[src]

impl<T> Sync for RGB<T> where
    T: Sync
[src]

impl<T> Unpin for RGB<T> where
    T: Unpin
[src]

impl<T> UnwindSafe for RGB<T> where
    T: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.