Struct sixtyfps_interpreter::Color [−][src]
#[repr(C)]pub struct Color { /* fields omitted */ }
Expand description
(Re-export from corelib.)
Color represents a color in the SixtyFPS run-time, represented using 8-bit channels for
red, green, blue and the alpha (opacity).
It can be conveniently converted using the to_
and from_
(a)rgb helper functions:
let col = some_color.to_argb_f32(); do_something_with_red_and_green(col.red, col.green); let RgbaColor { red, blue, green, .. } = some_color.to_argb_u8(); do_something_with_red(red); let new_col = Color::from(RgbaColor{ red: 0.5, green: 0.65, blue: 0.32, alpha: 1.});
Implementations
(Re-export from corelib.)
Construct a color from an integer encoded as 0xAARRGGBB
Returns (alpha, red, green, blue)
encoded as u32
Construct a color from the alpha, red, green and blue color channel parameters.
Construct a color from the red, green and blue color channel parameters. The alpha channel will have the value 255.
Construct a color from the alpha, red, green and blue color channel parameters.
Construct a color from the red, green and blue color channel parameters. The alpha channel will have the value 255.
Converts this color to an RgbaColor struct for easy destructuring.
Converts this color to an RgbaColor struct for easy destructuring.
Returns a new version of this color that has the brightness increased
by the specified factor. This is done by converting the color to the HSV
color space and multiplying the brightness (value) with (1 + factor).
The result is converted back to RGB and the alpha channel is unchanged.
So for example brighter(0.2)
will increase the brightness by 20%, and
calling brighter(-0.5)
will return a color that’s 50% darker.
Returns a new version of this color that has the brightness decreased
by the specified factor. This is done by converting the color to the HSV
color space and dividing the brightness (value) by (1 + factor). The
result is converted back to RGB and the alpha channel is unchanged.
So for example darker(0.3)
will decrease the brightness by 30%.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Color
impl UnwindSafe for Color
Blanket Implementations
Mutably borrows from an owned value. Read more
Checks that type has a default value.