Struct colstodian::DynamicColor[][src]

pub struct DynamicColor {
    pub raw: Vec3,
    pub space: DynamicColorSpace,
    pub state: DynamicState,
}
Expand description

A dynamic color, with its Space and State defined as data. This is mostly useful for (de)serialization.

See Color, ColorSpace and State for more.

Fields

raw: Vec3

The raw tristimulus value of the color. Be careful when modifying this directly, i.e. don’t multiply two Colors’ raw values unless they are in the same color space and state.

space: DynamicColorSpacestate: DynamicState

Implementations

Create a new DynamicColor with specified raw color components, color space, and state.

Convert self to the given color space. Must not attempt to convert to or from a nonlinear color space while in scene-referred state.

Convert self’s state to the given state using the given conversion function.

self.space must be linear. See docs for Color::<Space, State>::convert_state

Convert self to the specified space and downcast it to a typed Color with the space and state specified. self must already be in the correct DynamicState

Convert self into the closest linear color space, if it is not linear already

Converts self to a DynamicColorAlpha with specified DynamicAlphaState by adding an alpha component.

Trait Implementations

Upcasts self into a DynamicColor

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

Performs the conversion.

Performs the conversion.

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

Attempt to convert to a typed Color. Returns an error if self’s color space and state do not match the given types.

Convert to a typed Color without checking if the color space and state types match this color’s space and state. Use only if you are sure that this color is in the correct format.

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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.