Skip to main content

RGBE8

Struct RGBE8 

Source
#[repr(C, align(4))]
pub struct RGBE8 { pub r: u8, pub g: u8, pub b: u8, pub e: u8, }
Expand description

Aligned representation of Radiance RGBE8 pixel. r, g, and b are subnormal mantissas and e (taking the place of the alpha channel) is a common exponent. This is commonly loaded from Radiance pictures (.hdr).

As it uses 4 u8 components, this format can also be used with PNG compression, with the exponent taking the place of the alpha channel. This will preserve chroma but distort luminance if loaded as a normal PNG, making thumbnailers somewhat useful for image identification.

Fields§

§r: u8§g: u8§b: u8§e: u8

Implementations§

Source§

impl RGBE8

Source

pub fn pack(rgb: [f32; 3]) -> Self

Pack a triple of RGB float values into an RGBE8. This is not as optimized as RGB9E5::pack since it is designed for use in tooling instead of asset loading.

Source

pub fn unpack(self) -> [f32; 3]

Convert a packed color to individual floats

Source

pub fn repack_rgb9e5(self) -> RGB9E5

Repack RGBE8 into RGB9E5 for use on the GPU. This can cause saturation or loss of precision if the exponent is outside the range of RGB9E5.

Trait Implementations§

Source§

impl Clone for RGBE8

Source§

fn clone(&self) -> RGBE8

Returns a duplicate 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 Debug for RGBE8

Source§

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

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

impl From<RGBE8> for [f32; 3]

Source§

fn from(color: RGBE8) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for RGBE8

Source§

fn eq(&self, other: &RGBE8) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Zeroable for RGBE8

Source§

fn zeroed() -> Self

Source§

impl Copy for RGBE8

Source§

impl Eq for RGBE8

Source§

impl Pod for RGBE8

Source§

impl StructuralPartialEq for RGBE8

Auto Trait Implementations§

§

impl Freeze for RGBE8

§

impl RefUnwindSafe for RGBE8

§

impl Send for RGBE8

§

impl Sync for RGBE8

§

impl Unpin for RGBE8

§

impl UnsafeUnpin for RGBE8

§

impl UnwindSafe for RGBE8

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CheckedBitPattern for T
where T: AnyBitPattern,

Source§

type Bits = T

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
Source§

fn is_valid_bit_pattern(_bits: &T) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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 T
where T: Clone,

Source§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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> AnyBitPattern for T
where T: Pod,

Source§

impl<T> NoUninit for T
where T: Pod,