Struct colstodian::DynamicColorAlpha[][src]

pub struct DynamicColorAlpha {
    pub raw: Vec4,
    pub space: DynamicColorSpace,
    pub alpha_state: DynamicAlphaState,
}
Expand description

A dynamic color with an alpha channel, with its space and alpha defined as data. This is mostly useful for (de)serialization.

See ColorAlpha, ColorSpace and AlphaState for more.

Fields

raw: Vec4

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: DynamicColorSpacealpha_state: DynamicAlphaState

Implementations

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

Converts self to a DynamicColor by first premultiplying self if it is not already and then stripping off the alpha component.

Converts self to a DynamicColor by stripping off the alpha component, without checking whether it is premultiplied or not.

Converts from one color space and state to another.

  • If converting from Premultiplied to Separate, if self’s alpha is 0.0, the resulting color values will not be changed.

Convert self to the specified space and downcast it to a typed ColorAlpha with the space and state specified.

Converts self to the provided dst_alpha DynamicAlphaState.

  • If converting to the same state, this is a no-op.
  • If converting from Premultiplied to Separate, if self’s alpha is 0.0, the resulting color values will not be changed.

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

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

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.