Struct kas_core::draw::color::Rgba

source ·
#[repr(C)]
pub struct Rgba { pub r: f32, pub g: f32, pub b: f32, pub a: f32, }
Expand description

4-part colour data, linear, sRGB colour space

Linear format must be used for colour data uploaded via uniforms or vertex lists. Conversion from sRGB happens in user-space.

This is the expected type for shader inputs, encoded as four f32 values in RGBA order.

Fields§

§r: f32§g: f32§b: f32§a: f32

Implementations§

Transparent black

Opaque white

Opaque black

Construct from R-G-B-A components

Values should be between 0 and 1 on a linear scale.

Construct from opaque R-G-B

Values should be between 0 and 1 on a linear scale.

Construct from grey-scale

Construct from grey-scale with alpha

Get the sum of the three colour components

Average three colour components (desaturate)

Multiply and clamp three colour components

Clamp each colour component to at least min

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Deserialize this value from the given Serde deserializer. Read more
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
The associated error which can be returned from parsing.
Parses a string s to return a value of this type. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Cast from Self to T Read more
Try converting from Self to T Read more
Try approximate conversion from Self to T Read more
Cast approximately from Self to T Read more
Cast to integer, truncating Read more
Cast to the nearest integer Read more
Cast the floor to an integer Read more
Cast the ceiling to an integer Read more
Try converting to integer with truncation Read more
Try converting to the nearest integer Read more
Try converting the floor to an integer Read more
Try convert the ceiling to an integer Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.