Struct Argb

struct Argb<T, A = T> { ... }

An Alpha + Red + Green + Blue pixel.

Examples

use rgb::Argb;

let pixel: Argb<u8> = Argb { a: 255, r: 0, g: 0, b: 0 };

Fields

a: A

Alpha Component

r: T

Red Component

g: T

Green Component

b: T

Blue Component

Implementations

impl<T> Argb<T>

const fn new(r: T, g: T, b: T, a: T) -> Self

Convenience function for creating a new pixel The order of arguments is R,G,B,A

impl<T, A> Argb<T, A>

const fn new_alpha(r: T, g: T, b: T, a: A) -> Self

Convenience function for creating a new pixel The order of arguments is R,G,B,A

impl<T: Clone> Argb<T>

fn iter(self: &Self) -> Cloned<Iter<'_, T>>

Iterate over all components (length=4)

impl<T: Clone, A> Argb<T, A>

fn bgr(self: &Self) -> BGR<T>

Copy RGB components out of the RGBA struct

Note: you can use .into() to convert between other types

impl<T: Clone, A> Argb<T, A>

fn rgb(self: &Self) -> RGB<T>

Copy RGB components out of the ARGB struct

Note: you can use .into() to convert between other types

impl<T: Copy> Argb<T>

const fn new_argb(alpha: T, red: T, green: T, blue: T) -> Self

Creates a new Argb pixel type from its components.

Alternatively, you can use struct literal syntax to create the new pixel type:

use rgb::Argb;

let pixel = Argb {a : alpha, r : red, g : green, b : blue};

impl<T: Copy, A: Clone> Argb<T, A>

fn map_rgb<F, U, B>(self: &Self, f: F) -> ARGB<U, B>
where
    F: FnMut(T) -> U,
    U: Clone,
    B: From<A> + Clone

Create new RGBA with the same alpha value, but different RGB values

fn with_alpha(self: &Self, a: A) -> Self

Create a new RGBA with the new alpha value, but same RGB values

fn map_alpha<F, B>(self: &Self, f: F) -> ARGB<T, B>
where
    F: FnOnce(A) -> B

Create a new RGBA with a new alpha value created by the callback. Allows changing of the type used for the alpha channel.

impl<R, S> From for Argb<S>

fn from(value: (R, R, R, R)) -> Self

impl<T> Add for Argb<T>

fn add(self: Self, r: T) -> <Self as >::Output

impl<T> AddAssign for Argb<T>

fn add_assign(self: &mut Self, r: T)

impl<T> Any for Argb<T, A>

fn type_id(self: &Self) -> TypeId

impl<T> AsRef for Argb<T>

fn as_ref(self: &Self) -> &[T; 4]

impl<T> Borrow for Argb<T, A>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Argb<T, A>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> CloneToUninit for Argb<T, A>

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> ComponentSlice for Argb<T>

fn as_slice(self: &Self) -> &[T]
fn as_mut_slice(self: &mut Self) -> &mut [T]

impl<T> Div for Argb<T>

fn div(self: Self, r: T) -> <Self as >::Output

impl<T> DivAssign for Argb<T>

fn div_assign(self: &mut Self, r: T)

impl<T> From for Argb<T>

fn from(other: BGRA<T>) -> Self

impl<T> From for Argb<T>

fn from(other: RGBA<T>) -> Self

impl<T> From for Argb<T>

fn from(other: ABGR<T>) -> Self

impl<T> From for Argb<T, A>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Into for Argb<T>

fn into(self: Self) -> [T; 4]

impl<T> Mul for Argb<T>

fn mul(self: Self, r: T) -> <Self as >::Output

impl<T> MulAssign for Argb<T>

fn mul_assign(self: &mut Self, r: T)

impl<T> Sub for Argb<T>

fn sub(self: Self, r: T) -> <Self as >::Output

impl<T> SubAssign for Argb<T>

fn sub_assign(self: &mut Self, r: T)

impl<T, A> AddAssign for Argb<T, A>

fn add_assign(self: &mut Self, other: ARGB<T, A>)

impl<T, A> Freeze for Argb<T, A>

impl<T, A> RefUnwindSafe for Argb<T, A>

impl<T, A> Send for Argb<T, A>

impl<T, A> StructuralPartialEq for Argb<T, A>

impl<T, A> SubAssign for Argb<T, A>

fn sub_assign(self: &mut Self, other: ARGB<T, A>)

impl<T, A> Sum for Argb<T, A>

fn sum<I: Iterator<Item = Self>>(iter: I) -> Self

impl<T, A> Sync for Argb<T, A>

impl<T, A> Unpin for Argb<T, A>

impl<T, A> UnsafeUnpin for Argb<T, A>

impl<T, A> UnwindSafe for Argb<T, A>

impl<T, U> Into for Argb<T, A>

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for Argb<T, A>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for Argb<T, A>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>

impl<T: $crate::clone::Clone, A: $crate::clone::Clone> Clone for Argb<T, A>

fn clone(self: &Self) -> Argb<T, A>

impl<T: $crate::cmp::Eq, A: $crate::cmp::Eq> Eq for Argb<T, A>

impl<T: $crate::cmp::Ord, A: $crate::cmp::Ord> Ord for Argb<T, A>

fn cmp(self: &Self, other: &Argb<T, A>) -> Ordering

impl<T: $crate::cmp::PartialEq, A: $crate::cmp::PartialEq> PartialEq for Argb<T, A>

fn eq(self: &Self, other: &Argb<T, A>) -> bool

impl<T: $crate::cmp::PartialOrd, A: $crate::cmp::PartialOrd> PartialOrd for Argb<T, A>

fn partial_cmp(self: &Self, other: &Argb<T, A>) -> Option<Ordering>

impl<T: $crate::default::Default, A: $crate::default::Default> Default for Argb<T, A>

fn default() -> Argb<T, A>

impl<T: $crate::fmt::Debug, A: $crate::fmt::Debug> Debug for Argb<T, A>

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl<T: $crate::hash::Hash, A: $crate::hash::Hash> Hash for Argb<T, A>

fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H)

impl<T: $crate::marker::Copy, A: $crate::marker::Copy> Copy for Argb<T, A>

impl<T: Add, A: Add> Add for Argb<T, A>

fn add(self: Self, other: ARGB<T, A>) -> <Self as >::Output

impl<T: Copy> From for Argb<T>

fn from(other: [T; 4]) -> Self

impl<T: Copy> From for Argb<T, u16>

fn from(other: RGB<T>) -> Self

impl<T: Copy> From for Argb<T, u16>

fn from(other: BGR<T>) -> Self

impl<T: Copy> From for Argb<T, u8>

fn from(other: RGB<T>) -> Self

impl<T: Copy> From for Argb<T, u8>

fn from(other: BGR<T>) -> Self

impl<T: Copy, A: Copy, B> ColorComponentMap for Argb<T, A>

fn map_colors<F>(self: &Self, f: F) -> ARGB<B, A>
where
    F: FnMut(T) -> B

impl<T: Copy, B> ComponentMap for Argb<T>

fn map<F>(self: &Self, f: F) -> ARGB<B>
where
    F: FnMut(T) -> B

impl<T: Sub, A: Sub> Sub for Argb<T, A>

fn sub(self: Self, other: ARGB<T, A>) -> <Self as >::Output