Struct tiny_skia::Color [−][src]
pub struct Color { /* fields omitted */ }
Expand description
An RGBA color value, holding four floating point components.
Guarantees
- All values are in 0..=1 range.
Implementations
A transparent color.
Creates a new color from 4 components.
All values must be in 0..=1 range.
Creates a new color from 4 components.
u8 will be divided by 255 to get the float component.
Returns color’s red component.
The value is guarantee to be in a 0..=1 range.
Returns color’s green component.
The value is guarantee to be in a 0..=1 range.
Returns color’s blue component.
The value is guarantee to be in a 0..=1 range.
Returns color’s alpha component.
The value is guarantee to be in a 0..=1 range.
Sets the red component value.
The new value will be clipped to the 0..=1 range.
Sets the green component value.
The new value will be clipped to the 0..=1 range.
Sets the blue component value.
The new value will be clipped to the 0..=1 range.
Sets the alpha component value.
The new value will be clipped to the 0..=1 range.
Shifts color’s opacity.
Essentially, multiplies color’s alpha by opacity.
opacity
will be clamped to the 0..=1 range first.
The final alpha will also be clamped.
Converts into a premultiplied color.
Converts into ColorU8
.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Color
impl UnwindSafe for Color
Blanket Implementations
Mutably borrows from an owned value. Read more