Struct rgb::alt::BGR

source ·
#[repr(C)]
pub struct BGR<ComponentType> { pub b: ComponentType, pub g: ComponentType, pub r: ComponentType, }
Expand description

RGB in reverse byte order

Fields§

§b: ComponentType

Blue first

§g: ComponentType

Green

§r: ComponentType

Red last

Implementations§

source§

impl<T> BGR<T>

source

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

👎Deprecated: This function has a misleading order of arguments. Use BGR{} literal instead

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

source§

impl<T: Clone> BGR<T>

source

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

Iterate over color components (R, G, and B)

source§

impl<T: Clone> BGR<T>

source

pub fn alpha(&self, a: T) -> BGRA<T>

Convenience function for converting to RGBA

source

pub fn new_alpha<A>(&self, a: A) -> BGRA<T, A>

Convenience function for converting to RGBA with alpha channel of a different type than type of the pixels

Trait Implementations§

source§

impl<T> AsPixels<BGR<T>> for [T]

source§

fn as_pixels(&self) -> &[BGR<T>]

Reinterpret the slice as a read-only/shared slice of pixels. Multiple consecutive elements in the slice are intepreted as a single pixel (depending on format, e.g. 3 for RGB, 4 for RGBA). Read more
source§

fn as_pixels_mut(&mut self) -> &mut [BGR<T>]

Reinterpret the slice as a mutable/exclusive slice of pixels. Multiple consecutive elements in the slice are intepreted as a single pixel (depending on format, e.g. 3 for RGB, 4 for RGBA). Read more
source§

impl<ComponentType: Clone> Clone for BGR<ComponentType>

source§

fn clone(&self) -> BGR<ComponentType>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Copy, B> ColorComponentMap<BGR<B>, T, B> for BGR<T>

source§

fn map_c<F>(&self, f: F) -> BGR<B>where F: FnMut(T) -> B,

Convenience function for applying the same formula to every rgb/gray component, but skipping the alpha component. Read more
source§

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

source§

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

Convenience function (equivalent of self.iter().map().collect()) for applying the same formula to every component. Read more
source§

impl<T> ComponentSlice<T> for BGR<T>

source§

fn as_slice(&self) -> &[T]

The components interpreted as an array, e.g. one RGB expands to 3 elements. Read more
source§

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

The components interpreted as a mutable array, e.g. one RGB expands to 3 elements. Read more
source§

impl<ComponentType: Debug> Debug for BGR<ComponentType>

source§

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

Formats the value using the given formatter. Read more
source§

impl<ComponentType: Default> Default for BGR<ComponentType>

source§

fn default() -> BGR<ComponentType>

Returns the “default value” for a type. Read more
source§

impl<'de, ComponentType> Deserialize<'de> for BGR<ComponentType>where ComponentType: Deserialize<'de>,

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<T: Display> Display for BGR<T>

source§

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

Formats the value using the given formatter. Read more
source§

impl<T: Copy> From<[T; 3]> for BGR<T>

source§

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

Converts to this type from the input type.
source§

impl<T> From<(T, T, T)> for BGR<T>

source§

fn from(other: (T, T, T)) -> Self

Converts to this type from the input type.
source§

impl<T: Copy> From<BGR<T>> for BGRA<T, u16>

Assumes 65535 is opaque

source§

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

Converts to this type from the input type.
source§

impl<T: Copy> From<BGR<T>> for BGRA<T, u8>

Assumes 255 is opaque

source§

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

Converts to this type from the input type.
source§

impl<T> From<BGR<T>> for RGB<T>where T: Clone,

source§

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

Converts to this type from the input type.
source§

impl<T: Copy> From<BGR<T>> for RGBA<T, u16>

Assumes 65535 is opaque

source§

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

Converts to this type from the input type.
source§

impl<T: Copy> From<BGR<T>> for RGBA<T, u8>

Assumes 255 is opaque

source§

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

Converts to this type from the input type.
source§

impl<T> From<RGB<T>> for BGR<T>where T: Clone,

source§

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

Converts to this type from the input type.
source§

impl<ComponentType: Hash> Hash for BGR<ComponentType>

source§

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

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<T> Into<[T; 3]> for BGR<T>

source§

fn into(self) -> [T; 3]

Converts this type into the (usually inferred) input type.
source§

impl<T> Into<(T, T, T)> for BGR<T>

source§

fn into(self) -> (T, T, T)

Converts this type into the (usually inferred) input type.
source§

impl<T: LowerHex> LowerHex for BGR<T>

source§

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

Formats the value using the given formatter.
source§

impl<ComponentType: Ord> Ord for BGR<ComponentType>

source§

fn cmp(&self, other: &BGR<ComponentType>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl<ComponentType: PartialEq> PartialEq<BGR<ComponentType>> for BGR<ComponentType>

source§

fn eq(&self, other: &BGR<ComponentType>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<ComponentType: PartialOrd> PartialOrd<BGR<ComponentType>> for BGR<ComponentType>

source§

fn partial_cmp(&self, other: &BGR<ComponentType>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<ComponentType> Serialize for BGR<ComponentType>where ComponentType: Serialize,

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<T: UpperHex> UpperHex for BGR<T>

source§

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

Formats the value using the given formatter.
source§

impl<ComponentType: Copy> Copy for BGR<ComponentType>

source§

impl<ComponentType: Eq> Eq for BGR<ComponentType>

source§

impl<ComponentType> StructuralEq for BGR<ComponentType>

source§

impl<ComponentType> StructuralPartialEq for BGR<ComponentType>

Auto Trait Implementations§

§

impl<ComponentType> RefUnwindSafe for BGR<ComponentType>where ComponentType: RefUnwindSafe,

§

impl<ComponentType> Send for BGR<ComponentType>where ComponentType: Send,

§

impl<ComponentType> Sync for BGR<ComponentType>where ComponentType: Sync,

§

impl<ComponentType> Unpin for BGR<ComponentType>where ComponentType: Unpin,

§

impl<ComponentType> UnwindSafe for BGR<ComponentType>where ComponentType: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,