[][src]Struct xblend::RGBA

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

This struct represents a RGBA color

Implementations

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

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

Create a new RGBA color with 4 components.

pub fn from_rgb(color: &RGB<T>, a: T) -> RGBA<T>[src]

Create a new RGBA color from another RGB color and the alpha component.

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.

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

Get the alpha component.

pub fn rgb(&self) -> RGB<T>[src]

Get the RGB components.

impl RGBA<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) -> RGBA<u8>[src]

Convert itself into RGBA<u8>

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

Get the unsigned integer representation of itself.

impl RGBA<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) -> RGBA<f32>[src]

Convert itself into RGBA<f32>

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

Get the unsigned integer representation of itself

Trait Implementations

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

type Output = RGBA<f32>

The resulting type after applying the + operator.

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

type Output = RGBA<u8>

The resulting type after applying the + operator.

impl Clear for RGBA<f32>[src]

type Output = RGBA<f32>

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

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

impl Darken for RGBA<f32>[src]

type Output = RGBA<f32>

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

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

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

type Output = RGBA<f32>

The resulting type after applying the / operator.

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

type Output = RGBA<u8>

The resulting type after applying the / operator.

impl Dst for RGBA<f32>[src]

type Output = RGBA<f32>

impl DstATop for RGBA<f32>[src]

type Output = RGBA<f32>

impl DstIn for RGBA<f32>[src]

type Output = RGBA<f32>

impl DstOut for RGBA<f32>[src]

type Output = RGBA<f32>

impl DstOver for RGBA<f32>[src]

type Output = RGBA<f32>

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

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

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

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

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

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

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

impl Lighten for RGBA<f32>[src]

type Output = RGBA<f32>

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

type Output = RGBA<f32>

The resulting type after applying the * operator.

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

type Output = RGBA<u8>

The resulting type after applying the * operator.

impl Multiply for RGBA<f32>[src]

type Output = RGBA<f32>

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

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

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

impl Screen for RGBA<f32>[src]

type Output = RGBA<f32>

impl Src for RGBA<f32>[src]

type Output = RGBA<f32>

impl SrcATop for RGBA<f32>[src]

type Output = RGBA<f32>

impl SrcIn for RGBA<f32>[src]

type Output = RGBA<f32>

impl SrcOut for RGBA<f32>[src]

type Output = RGBA<f32>

impl SrcOver for RGBA<f32>[src]

type Output = RGBA<f32>

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

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

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

type Output = RGBA<f32>

The resulting type after applying the - operator.

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

type Output = RGBA<u8>

The resulting type after applying the - operator.

impl Xor for RGBA<f32>[src]

type Output = RGBA<f32>

Auto Trait Implementations

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

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

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

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

impl<T> UnwindSafe for RGBA<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.