Struct cxx_qt_lib::QColor
source · #[repr(C)]pub struct QColor { /* private fields */ }
Expand description
The QColor class provides colors based on RGB, HSL, HSV or CMYK values.
Implementations§
source§impl QColor
impl QColor
sourcepub fn convert_to(&self, spec: QColorSpec) -> QColor
pub fn convert_to(&self, spec: QColorSpec) -> QColor
Creates a copy of this color in the format specified by colorSpec.
source§impl QColor
impl QColor
sourcepub fn hsl_saturation(&self) -> i32
pub fn hsl_saturation(&self) -> i32
Returns the HSL saturation color component of this color.
source§impl QColor
impl QColor
sourcepub fn hsv_saturation(&self) -> i32
pub fn hsv_saturation(&self) -> i32
Returns the HSV saturation color component of this color.
source§impl QColor
impl QColor
sourcepub fn saturation(&self) -> i32
pub fn saturation(&self) -> i32
Returns the HSV saturation color component of this color.
The color is implicitly converted to HSV.
source§impl QColor
impl QColor
sourcepub fn set_hsl(&mut self, h: i32, s: i32, l: i32, a: i32)
pub fn set_hsl(&mut self, h: i32, s: i32, l: i32, a: i32)
Sets a HSL color value; h is the hue, s is the saturation, l is the lightness and a is the alpha component of the HSL color.
The saturation, value and alpha-channel values must be in the range 0-255, and the hue value must be greater than -1.
source§impl QColor
impl QColor
sourcepub fn set_hsv(&mut self, h: i32, s: i32, v: i32, a: i32)
pub fn set_hsv(&mut self, h: i32, s: i32, v: i32, a: i32)
Sets a HSV color value; h is the hue, s is the saturation, v is the value and a is the alpha component of the HSV color.
The saturation, value and alpha-channel values must be in the range 0-255, and the hue value must be greater than -1.
source§impl QColor
impl QColor
sourcepub fn to_extended_rgb(&self) -> QColor
pub fn to_extended_rgb(&self) -> QColor
Create and returns an extended RGB QColor based on this color.
source§impl QColor
impl QColor
sourcepub fn color_names() -> QStringList
pub fn color_names() -> QStringList
Returns a QStringList containing the color names Qt knows about.
sourcepub fn from_cmyk(c: i32, m: i32, y: i32, k: i32) -> Self
pub fn from_cmyk(c: i32, m: i32, y: i32, k: i32) -> Self
Constructs a QColor from the CMYK value c, m, y, and k.
sourcepub fn from_cmyka(c: i32, m: i32, y: i32, k: i32, a: i32) -> Self
pub fn from_cmyka(c: i32, m: i32, y: i32, k: i32, a: i32) -> Self
Constructs a QColor from the CMYK value c, m, y, k, and the alpha-channel (transparency) value of a.
sourcepub fn from_cmyk_f(c: f32, m: f32, y: f32, k: f32) -> Self
pub fn from_cmyk_f(c: f32, m: f32, y: f32, k: f32) -> Self
Constructs a QColor from the CMYK value c, m, y, and k.
sourcepub fn from_cmyka_f(c: f32, m: f32, y: f32, k: f32, a: f32) -> Self
pub fn from_cmyka_f(c: f32, m: f32, y: f32, k: f32, a: f32) -> Self
Constructs a QColor from the CMYK value c, m, y, k, and the alpha-channel (transparency) value of a.
sourcepub fn from_hsl(h: i32, s: i32, l: i32) -> Self
pub fn from_hsl(h: i32, s: i32, l: i32) -> Self
Constructs a QColor from the HSL value h, s, and l.
sourcepub fn from_hsla(h: i32, s: i32, l: i32, a: i32) -> Self
pub fn from_hsla(h: i32, s: i32, l: i32, a: i32) -> Self
Constructs a QColor from the HSL value h, s, l, and the alpha-channel (transparency) value of a.
sourcepub fn from_hsl_f(h: f32, s: f32, l: f32) -> Self
pub fn from_hsl_f(h: f32, s: f32, l: f32) -> Self
Constructs a QColor from the HSL value h, s, and l.
sourcepub fn from_hsla_f(h: f32, s: f32, l: f32, a: f32) -> Self
pub fn from_hsla_f(h: f32, s: f32, l: f32, a: f32) -> Self
Constructs a QColor from the HSL value h, s, l, and the alpha-channel (transparency) value of a.
sourcepub fn from_hsv(h: i32, s: i32, v: i32) -> Self
pub fn from_hsv(h: i32, s: i32, v: i32) -> Self
Constructs a QColor from the HSV value h, s, and v.
sourcepub fn from_hsva(h: i32, s: i32, v: i32, a: i32) -> Self
pub fn from_hsva(h: i32, s: i32, v: i32, a: i32) -> Self
Constructs a QColor from the HSV value h, s, v, and the alpha-channel (transparency) value of a.
sourcepub fn from_hsv_f(h: f32, s: f32, v: f32) -> Self
pub fn from_hsv_f(h: f32, s: f32, v: f32) -> Self
Constructs a QColor from the HSV value h, s, and v.
sourcepub fn from_hsva_f(h: f32, s: f32, v: f32, a: f32) -> Self
pub fn from_hsva_f(h: f32, s: f32, v: f32, a: f32) -> Self
Constructs a QColor from the HSV value h, s, v, and the alpha-channel (transparency) value of a.
sourcepub fn from_rgb(red: i32, green: i32, blue: i32) -> Self
pub fn from_rgb(red: i32, green: i32, blue: i32) -> Self
Constructs a QColor with the RGB value r, g, and b.
The color is left invalid if any of the arguments are invalid.
sourcepub fn from_rgba(red: i32, green: i32, blue: i32, alpha: i32) -> Self
pub fn from_rgba(red: i32, green: i32, blue: i32, alpha: i32) -> Self
Constructs a QColor with the RGB value r, g, b, and the alpha-channel (transparency) value of a.
The color is left invalid if any of the arguments are invalid.
sourcepub fn from_rgb_f(red: f32, green: f32, blue: f32) -> Self
pub fn from_rgb_f(red: f32, green: f32, blue: f32) -> Self
Constructs a QColor with the RGB value r, g, and b.
sourcepub fn from_rgba_f(red: f32, green: f32, blue: f32, alpha: f32) -> Self
pub fn from_rgba_f(red: f32, green: f32, blue: f32, alpha: f32) -> Self
Constructs a QColor with the RGB value r, g, b, and the alpha-channel (transparency) value of a.
sourcepub fn hsl_saturation_f(&self) -> f32
pub fn hsl_saturation_f(&self) -> f32
Returns the HSL saturation color component of this color.
sourcepub fn hsv_saturation_f(&self) -> f32
pub fn hsv_saturation_f(&self) -> f32
Returns the HSV saturation color component of this color.
sourcepub fn hue_f(self: &QColor) -> f32
pub fn hue_f(self: &QColor) -> f32
Returns the HSV hue color component of this color.
The color is implicitly converted to HSV.
sourcepub fn lightness_f(&self) -> f32
pub fn lightness_f(&self) -> f32
Returns the lightness color component of this color.
sourcepub fn saturation_f(&self) -> f32
pub fn saturation_f(&self) -> f32
Returns the HSV saturation color component of this color.
The color is implicitly converted to HSV.
sourcepub fn set_alpha_f(&mut self, alpha: f32)
pub fn set_alpha_f(&mut self, alpha: f32)
Sets the alpha of this color to alpha. float alpha is specified in the range 0.0-1.0.
sourcepub fn set_blue_f(&mut self, blue: f32)
pub fn set_blue_f(&mut self, blue: f32)
Sets the blue color component of this color to blue.
If blue lies outside the 0.0-1.0 range, the color model will be changed to ExtendedRgb.
sourcepub fn set_cmyk_f(&mut self, c: f32, m: f32, y: f32, k: f32, a: f32)
pub fn set_cmyk_f(&mut self, c: f32, m: f32, y: f32, k: f32, a: f32)
Sets the color to CMYK values, c (cyan), m (magenta), y (yellow), k (black), and a (alpha-channel, i.e. transparency).
All the values must be in the range 0.0-1.0.
sourcepub fn set_green_f(&mut self, green: f32)
pub fn set_green_f(&mut self, green: f32)
Sets the green color component of this color to green.
If green lies outside the 0.0-1.0 range, the color model will be changed to ExtendedRgb.
sourcepub fn set_hsl_f(&mut self, h: f32, s: f32, l: f32, a: f32)
pub fn set_hsl_f(&mut self, h: f32, s: f32, l: f32, a: f32)
Sets a HSL color lightness; h is the hue, s is the saturation, l is the lightness and a is the alpha component of the HSL color.
All the values must be in the range 0.0-1.0.
sourcepub fn set_hsv_f(&mut self, h: f32, s: f32, v: f32, a: f32)
pub fn set_hsv_f(&mut self, h: f32, s: f32, v: f32, a: f32)
Sets a HSV color value; h is the hue, s is the saturation, v is the value and a is the alpha component of the HSV color.
All the values must be in the range 0.0-1.0.
sourcepub fn set_red_f(&mut self, red: f32)
pub fn set_red_f(&mut self, red: f32)
Sets the red color component of this color to red.
If red lies outside the 0.0-1.0 range, the color model will be changed to ExtendedRgb.
sourcepub fn set_rgb_f(&mut self, r: f32, g: f32, b: f32, a: f32)
pub fn set_rgb_f(&mut self, r: f32, g: f32, b: f32, a: f32)
Sets the color channels of this color to r (red), g (green), b (blue) and a (alpha, transparency).
The alpha value must be in the range 0.0-1.0. If any of the other values are outside the range of 0.0-1.0 the color model will be set as ExtendedRgb.