Struct nanovg::Color [−][src]
pub struct Color(_);
A 32-bit color value. Used to fill or stroke paths with solid color.
Methods
impl Color
[src]
impl Color
pub fn new(r: f32, g: f32, b: f32, a: f32) -> Self
[src]
pub fn new(r: f32, g: f32, b: f32, a: f32) -> Self
Create a new color by setting all components manually. Values are in the range 0.0...1.0.
pub fn from_rgb(r: u8, g: u8, b: u8) -> Self
[src]
pub fn from_rgb(r: u8, g: u8, b: u8) -> Self
Create a new color from three 8-bit color channels.
pub fn from_rgba(r: u8, g: u8, b: u8, a: u8) -> Self
[src]
pub fn from_rgba(r: u8, g: u8, b: u8, a: u8) -> Self
Create a new color from three 8-bit color channels and an 8-bit alpha channel.
pub fn from_hsl(h: f32, s: f32, l: f32) -> Self
[src]
pub fn from_hsl(h: f32, s: f32, l: f32) -> Self
Create a new color from three hsl channels.
pub fn from_hsla(h: f32, s: f32, l: f32, a: u8) -> Self
[src]
pub fn from_hsla(h: f32, s: f32, l: f32, a: u8) -> Self
Create a new color from three hsl channels and an 8-bit alpha channel.
pub fn red(&self) -> f32
[src]
pub fn red(&self) -> f32
Get the red component.
pub fn green(&self) -> f32
[src]
pub fn green(&self) -> f32
Get the green component.
pub fn blue(&self) -> f32
[src]
pub fn blue(&self) -> f32
Get the blue component.
pub fn alpha(&self) -> f32
[src]
pub fn alpha(&self) -> f32
Get the alpha component.
pub fn set_red(&mut self, red: f32)
[src]
pub fn set_red(&mut self, red: f32)
Set the red component.
pub fn set_green(&mut self, green: f32)
[src]
pub fn set_green(&mut self, green: f32)
Get the green component.
pub fn set_blue(&mut self, blue: f32)
[src]
pub fn set_blue(&mut self, blue: f32)
Get the blue component.
pub fn set_alpha(&mut self, alpha: f32)
[src]
pub fn set_alpha(&mut self, alpha: f32)
Get the alpha component.
pub fn lerp(a: Color, b: Color, t: f32) -> Color
[src]
pub fn lerp(a: Color, b: Color, t: f32) -> Color
Create a new color by linearly interpolating between two existing colors.
Trait Implementations
impl Clone for Color
[src]
impl Clone for Color
fn clone(&self) -> Color
[src]
fn clone(&self) -> Color
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Copy for Color
[src]
impl Copy for Color
impl Debug for Color
[src]
impl Debug for Color
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Paint for Color
[src]
impl Paint for Color