Struct rgb::RGBA [−][src]
#[repr(C)]pub struct RGBA<ComponentType, AlphaComponentType = ComponentType> {
pub r: ComponentType,
pub g: ComponentType,
pub b: ComponentType,
pub a: AlphaComponentType,
}
Expand description
The RGBA pixel
The component type can be u8
(aliased as RGBA8
), u16
(aliased as RGBA16
),
or any other type (but simple copyable types are recommended.)
You can specify a different type for alpha, but it’s only for special cases
(e.g. if you use a newtype like RGBA<LinearLight<u16>, u16>
).
Fields
r: ComponentType
Red
g: ComponentType
Green
b: ComponentType
Blue
a: AlphaComponentType
Alpha
Implementations
Create new RGBA with the same alpha value, but different RGB values
Create a new RGBA with the new alpha value, but same RGB values
Trait Implementations
px + px
px + 1
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
The components interpreted as an array, e.g. one RGB
expands to 3 elements. Read more
impl<'de, ComponentType, AlphaComponentType> Deserialize<'de> for RGBA<ComponentType, AlphaComponentType> where
ComponentType: Deserialize<'de>,
AlphaComponentType: Deserialize<'de>,
impl<'de, ComponentType, AlphaComponentType> Deserialize<'de> for RGBA<ComponentType, AlphaComponentType> where
ComponentType: Deserialize<'de>,
AlphaComponentType: Deserialize<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
px / 1
Assumes 255 is opaque
Assumes 65535 is opaque
Assumes 255 is opaque
Assumes 65535 is opaque
Takes exactly 4 elements from the iterator and creates a new instance. Panics if there are fewer elements in the iterator.
px * 1
impl<ComponentType: PartialOrd, AlphaComponentType: PartialOrd> PartialOrd<RGBA<ComponentType, AlphaComponentType>> for RGBA<ComponentType, AlphaComponentType>
impl<ComponentType: PartialOrd, AlphaComponentType: PartialOrd> PartialOrd<RGBA<ComponentType, AlphaComponentType>> for RGBA<ComponentType, AlphaComponentType>
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
px - px
px - 1
impl<ComponentType: Copy, AlphaComponentType: Copy> Copy for RGBA<ComponentType, AlphaComponentType>
impl<ComponentType, AlphaComponentType> StructuralEq for RGBA<ComponentType, AlphaComponentType>
impl<ComponentType, AlphaComponentType> StructuralPartialEq for RGBA<ComponentType, AlphaComponentType>
Auto Trait Implementations
impl<ComponentType, AlphaComponentType> RefUnwindSafe for RGBA<ComponentType, AlphaComponentType> where
AlphaComponentType: RefUnwindSafe,
ComponentType: RefUnwindSafe,
impl<ComponentType, AlphaComponentType> Send for RGBA<ComponentType, AlphaComponentType> where
AlphaComponentType: Send,
ComponentType: Send,
impl<ComponentType, AlphaComponentType> Sync for RGBA<ComponentType, AlphaComponentType> where
AlphaComponentType: Sync,
ComponentType: Sync,
impl<ComponentType, AlphaComponentType> Unpin for RGBA<ComponentType, AlphaComponentType> where
AlphaComponentType: Unpin,
ComponentType: Unpin,
impl<ComponentType, AlphaComponentType> UnwindSafe for RGBA<ComponentType, AlphaComponentType> where
AlphaComponentType: UnwindSafe,
ComponentType: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more