Struct cogl::Color [−][src]
pub struct Color(_);
Implementations
impl Color
[src]
pub fn new() -> Color
[src]
Creates a new (empty) color
Returns
a newly-allocated Color
. Use Color::free
to free the allocated resources
pub fn get_alpha(&self) -> f32
[src]
Retrieves the alpha channel of self
as a fixed point
value between 0 and 1.0.
Returns
the alpha channel of the passed color
pub fn get_alpha_byte(&self) -> u8
[src]
Retrieves the alpha channel of self
as a byte value
between 0 and 255
Returns
the alpha channel of the passed color
pub fn get_alpha_float(&self) -> f32
[src]
Retrieves the alpha channel of self
as a floating point
value between 0.0 and 1.0
Returns
the alpha channel of the passed color
pub fn get_blue(&self) -> f32
[src]
Retrieves the blue channel of self
as a fixed point
value between 0 and 1.0.
Returns
the blue channel of the passed color
pub fn get_blue_byte(&self) -> u8
[src]
Retrieves the blue channel of self
as a byte value
between 0 and 255
Returns
the blue channel of the passed color
pub fn get_blue_float(&self) -> f32
[src]
Retrieves the blue channel of self
as a floating point
value between 0.0 and 1.0
Returns
the blue channel of the passed color
pub fn get_green(&self) -> f32
[src]
Retrieves the green channel of self
as a fixed point
value between 0 and 1.0.
Returns
the green channel of the passed color
pub fn get_green_byte(&self) -> u8
[src]
Retrieves the green channel of self
as a byte value
between 0 and 255
Returns
the green channel of the passed color
pub fn get_green_float(&self) -> f32
[src]
Retrieves the green channel of self
as a floating point
value between 0.0 and 1.0
Returns
the green channel of the passed color
pub fn get_red(&self) -> f32
[src]
Retrieves the red channel of self
as a fixed point
value between 0 and 1.0.
Returns
the red channel of the passed color
pub fn get_red_byte(&self) -> u8
[src]
Retrieves the red channel of self
as a byte value
between 0 and 255
Returns
the red channel of the passed color
pub fn get_red_float(&self) -> f32
[src]
Retrieves the red channel of self
as a floating point
value between 0.0 and 1.0
Returns
the red channel of the passed color
pub fn init_from_4f(&mut self, red: f32, green: f32, blue: f32, alpha: f32)
[src]
Sets the values of the passed channels into a Color
red
value of the red channel, between 0 and 1.0
green
value of the green channel, between 0 and 1.0
blue
value of the blue channel, between 0 and 1.0
alpha
value of the alpha channel, between 0 and 1.0
pub fn init_from_4fv(&mut self, color_array: &[f32])
[src]
Sets the values of the passed channels into a Color
color_array
a pointer to an array of 4 float color components
pub fn init_from_4ub(&mut self, red: u8, green: u8, blue: u8, alpha: u8)
[src]
Sets the values of the passed channels into a Color
.
red
value of the red channel, between 0 and 255
green
value of the green channel, between 0 and 255
blue
value of the blue channel, between 0 and 255
alpha
value of the alpha channel, between 0 and 255
pub fn premultiply(&mut self)
[src]
Converts a non-premultiplied color to a pre-multiplied color. For example, semi-transparent red is (1.0, 0, 0, 0.5) when non-premultiplied and (0.5, 0, 0, 0.5) when premultiplied.
pub fn set_alpha(&mut self, alpha: f32)
[src]
pub fn set_alpha_byte(&mut self, alpha: u8)
[src]
pub fn set_alpha_float(&mut self, alpha: f32)
[src]
pub fn set_blue(&mut self, blue: f32)
[src]
pub fn set_blue_byte(&mut self, blue: u8)
[src]
pub fn set_blue_float(&mut self, blue: f32)
[src]
pub fn set_green(&mut self, green: f32)
[src]
pub fn set_green_byte(&mut self, green: u8)
[src]
pub fn set_green_float(&mut self, green: f32)
[src]
pub fn set_red(&mut self, red: f32)
[src]
pub fn set_red_byte(&mut self, red: u8)
[src]
pub fn set_red_float(&mut self, red: f32)
[src]
pub fn to_hsl(&self) -> (f32, f32, f32)
[src]
Converts self
to the HLS format.
The hue
value is in the 0 .. 360 range. The luminance
and
saturation
values are in the 0 .. 1 range.
hue
return location for the hue value or None
saturation
return location for the saturation value or None
luminance
return location for the luminance value or None
pub fn unpremultiply(&mut self)
[src]
Converts a pre-multiplied color to a non-premultiplied color. For example, semi-transparent red is (0.5, 0, 0, 0.5) when premultiplied and (1.0, 0, 0, 0.5) when non-premultiplied.
pub fn init_from_hsl(hue: f32, saturation: f32, luminance: f32) -> Color
[src]
Converts a color expressed in HLS (hue, luminance and saturation)
values into a Color
.
color
return location for a Color
hue
hue value, in the 0 .. 360 range
saturation
saturation value, in the 0 .. 1 range
luminance
luminance value, in the 0 .. 1 range
Trait Implementations
impl Clone for Color
[src]
impl Debug for Color
[src]
impl Default for Color
[src]
impl Eq for Color
[src]
impl Ord for Color
[src]
fn cmp(&self, other: &Color) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<Color> for Color
[src]
impl PartialOrd<Color> for Color
[src]
fn partial_cmp(&self, other: &Color) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl StaticType for Color
[src]
fn static_type() -> Type
[src]
Auto Trait Implementations
impl RefUnwindSafe for Color
impl !Send for Color
impl !Sync for Color
impl Unpin for Color
impl UnwindSafe for Color
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToSendValue for T where
T: SetValue + Send + ToValue + ?Sized,
[src]
T: SetValue + Send + ToValue + ?Sized,
pub fn to_send_value(&self) -> SendValue
[src]
impl<T> ToValue for T where
T: SetValue + ?Sized,
[src]
T: SetValue + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,