Struct colstodian::color::ColorAlpha[][src]

#[repr(C)]
pub struct ColorAlpha<Spc, A> { pub raw: Vec4, // some fields omitted }
Expand description

A strongly typed color with an alpha channel, parameterized by a color space and alpha state.

A color with an alpha channel is always in display-referred state. The alpha channel is always linear [0..1].

See crate-level docs as well as ColorSpace and AlphaState for more.

Fields

raw: Vec4

The raw values of the color. Be careful when modifying this directly.

Implementations

Creates a ColorAlpha with the raw internal color elements el1, el2, el3 and alpha value alpha.

Creates a ColorAlpha with raw values contained in raw.

Clamp the raw element values of self in the range [0..1]

Get the maximum element of self

Get the minimum element of self

Converts from one color space and state to another.

  • If converting from Premultiplied to Separate, you must ensure that self.alpha != 0.0, otherwise a divide by 0 will occur and Infs will result.

Converts from one color space and state to another.

This works the same as convert except there is only one type parameter, the “Query”.

The query is meant to be one of:

This query is slightly more generic than the ones on convert, which means that the Rust type system is usually not able to infer the query without you explicitly giving one.

This can be useful in conjunction with defined type aliases for predefined ColorAlpha types.

Converts self to the provided DstAlpha AlphaState.

  • If converting to the same state, this is a no-op.
  • If converting from Premultiplied to Separate, you must ensure that self.alpha != 0.0, otherwise a divide by 0 will occur and Infs will result.

Interprets this color as DstSpace. This assumes you have done an external computation/conversion such that this cast is valid.

Changes this color’s alpha state. This assumes that you have done some kind of computation/conversion such that this cast is valid.

Changes this color’s alpha state. This assumes that you have done some kind of computation/conversion such that this cast is valid.

Blend self’s color values with the color values from other. Does not blend alpha.

Blend self’s color values with the color values from other. Also blends alpha.

Premultiplies self by multiplying its color components by its alpha. Does nothing if self is already premultiplied.

Separates self by dividing its color components by its alpha. Does nothing if self is already separate.

  • You must ensure that self.alpha != 0.0, otherwise a divide by 0 will occur and Infs will result.

Convert self into the closest linear color space.

Decode self into its decoded (working) color space, which allows many more operations to be performed.

Converts self to a Color by stripping off the alpha component.

Converts self to a Color by first premultiplying self (if premultiplying makes sense for the current color space) and then stripping off the alpha component.

Convert self to a [u8; 4]. All components of self must be in range [0..1].

Decode a [u8; 4] into a ColorAlpha with specified space and alpha state.

Trait Implementations

The resulting type after applying the + operator.

Performs the + operation. Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Convert self into its canonical cint type.

Create a Self from its canonical cint type.

Convert self into its canonical cint type.

Create a Self from its canonical cint type.

Convert self into its canonical cint type.

Create a Self from its canonical cint type.

Convert self into its canonical cint type.

Create a Self from its canonical cint type.

Convert self into its canonical cint type.

Create a Self from its canonical cint type.

Convert self into its canonical cint type.

Create a Self from its canonical cint type.

Convert self into its canonical cint type.

Create a Self from its canonical cint type.

Convert self into its canonical cint type.

Create a Self from its canonical cint type.

Convert self into its canonical cint type.

Create a Self from its canonical cint type.

Convert self into its canonical cint type.

Create a Self from its canonical cint type.

Convert self into its canonical cint type.

Create a Self from its canonical cint type.

Convert self into its canonical cint type.

Create a Self from its canonical cint type.

Convert self into its canonical cint type.

Create a Self from its canonical cint type.

Convert self into its canonical cint type.

Create a Self from its canonical cint type.

Convert self into its canonical cint type.

Create a Self from its canonical cint type.

Convert self into its canonical cint type.

Create a Self from its canonical cint type.

Convert self into its canonical cint type.

Create a Self from its canonical cint type.

Convert self into its canonical cint type.

Create a Self from its canonical cint type.

Convert self into its canonical cint type.

Create a Self from its canonical cint type.

Convert self into its canonical cint type.

Create a Self from its canonical cint type.

Convert self into its canonical cint type.

Create a Self from its canonical cint type.

Convert self into its canonical cint type.

Create a Self from its canonical cint type.

Convert self into its canonical cint type.

Create a Self from its canonical cint type.

Convert self into its canonical cint type.

Create a Self from its canonical cint type.

Convert self into its canonical cint type.

Create a Self from its canonical cint type.

Convert self into its canonical cint type.

Create a Self from its canonical cint type.

Formats the value using the given formatter. Read more

Test

The resulting type after dereferencing.

Test

The resulting type after dereferencing.

Test

The resulting type after dereferencing.

Test

The resulting type after dereferencing.

Test

The resulting type after dereferencing.

Test

The resulting type after dereferencing.

Test

The resulting type after dereferencing.

Test

The resulting type after dereferencing.

Test

The resulting type after dereferencing.

Test

The resulting type after dereferencing.

Test

The resulting type after dereferencing.

Test

The resulting type after dereferencing.

Test

The resulting type after dereferencing.

Test

The resulting type after dereferencing.

Mutably dereferences the value.

Mutably dereferences the value.

Mutably dereferences the value.

Mutably dereferences the value.

Mutably dereferences the value.

Mutably dereferences the value.

Mutably dereferences the value.

Mutably dereferences the value.

Mutably dereferences the value.

Mutably dereferences the value.

Mutably dereferences the value.

Mutably dereferences the value.

Mutably dereferences the value.

Mutably dereferences the value.

Formats the value using the given formatter. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

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

This method tests for !=.

The resulting type after applying the - operator.

Performs the - operation. Read more

Convert the inner type into the wrapper type.

Convert a reference to the inner type into a reference to the wrapper type. Read more

Convert a mutable reference to the inner type into a mutable reference to the wrapper type. Read more

Convert a slice to the inner type into a slice to the wrapper type.

Convert a mutable slice to the inner type into a mutable slice to the wrapper type. Read more

Convert the wrapper type into the inner type.

Convert a reference to the wrapper type into a reference to the inner type. Read more

Convert a mutable reference to the wrapper type into a mutable reference to the inner type. Read more

Convert a slice to the wrapped type into a slice to the inner type.

Convert a mutable slice to the wrapped type into a mutable slice to the inner type. 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

Converts the given value to a String. 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.