Struct Bgra

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

A Blue + Green + Red + Alpha pixel.

Examples

use rgb::Bgra;

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

Fields

b: T

Blue Component

g: T

Green Component

r: T

Red Component

a: A

Alpha Component

Implementations

impl<T> Bgra<T>

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

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

impl<T, A> Bgra<T, A>

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

Provide a mutable view of only RGB components (leaving out alpha). Useful to change color without changing opacity.

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

Provide a mutable view of only RGB components (leaving out alpha). Useful to change color without changing opacity.

impl<T, A> Bgra<T, A>

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

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

impl<T: Clone> Bgra<T>

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

Iterate over all components (length=4)

impl<T: Clone, A> Bgra<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> Bgra<T, A>

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

Copy RGB components out of the RGBA struct

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

impl<T: Copy> Bgra<T>

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

Creates a new Bgra pixel type from its components.

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

use rgb::Bgra;

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

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

fn map_rgb<F, U, B>(self: &Self, f: F) -> BGRA<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) -> BGRA<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 Bgra<S>

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

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

fn type_id(self: &Self) -> TypeId

impl<T> AsRef for Bgra<T>

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

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

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

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

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

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

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

impl<T> ComponentSlice for Bgra<T>

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

impl<T> From for Bgra<T>

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

impl<T> From for Bgra<T>

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

impl<T> From for Bgra<T>

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

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

fn from(t: T) -> T

Returns the argument unchanged.

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

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

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

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

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

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

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

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

impl<T, U> Into for Bgra<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 Bgra<T, A>

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

impl<T, U> TryInto for Bgra<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 Bgra<T, A>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

impl<T: fmt::Display, A: fmt::Display> Display for Bgra<T, A>

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