mirror of
https://github.com/emilk/egui.git
synced 2026-09-01 14:20:04 -04:00
Use Self everywhere (#3787)
This turns on the clippy lint [`clippy::use_self`](https://rust-lang.github.io/rust-clippy/v0.0.212/index.html#use_self) and fixes it everywhere.
This commit is contained in:
@@ -10,7 +10,7 @@ impl From<Alpha<EncodedSrgb<u8>>> for Color32 {
|
||||
alpha: a,
|
||||
} = srgba;
|
||||
|
||||
Color32::from_rgba_unmultiplied(r, g, b, a)
|
||||
Self::from_rgba_unmultiplied(r, g, b, a)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ impl From<PremultipliedAlpha<EncodedSrgb<u8>>> for Color32 {
|
||||
alpha: a,
|
||||
} = srgba;
|
||||
|
||||
Color32::from_rgba_premultiplied(r, g, b, a)
|
||||
Self::from_rgba_premultiplied(r, g, b, a)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ impl From<Color32> for PremultipliedAlpha<EncodedSrgb<u8>> {
|
||||
fn from(col: Color32) -> Self {
|
||||
let (r, g, b, a) = col.to_tuple();
|
||||
|
||||
PremultipliedAlpha {
|
||||
Self {
|
||||
color: EncodedSrgb { r, g, b },
|
||||
alpha: a,
|
||||
}
|
||||
@@ -51,7 +51,7 @@ impl From<PremultipliedAlpha<EncodedSrgb<f32>>> for Color32 {
|
||||
let b = linear_u8_from_linear_f32(b);
|
||||
let a = linear_u8_from_linear_f32(a);
|
||||
|
||||
Color32::from_rgba_premultiplied(r, g, b, a)
|
||||
Self::from_rgba_premultiplied(r, g, b, a)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ impl From<Color32> for PremultipliedAlpha<EncodedSrgb<f32>> {
|
||||
let b = linear_f32_from_linear_u8(b);
|
||||
let a = linear_f32_from_linear_u8(a);
|
||||
|
||||
PremultipliedAlpha {
|
||||
Self {
|
||||
color: EncodedSrgb { r, g, b },
|
||||
alpha: a,
|
||||
}
|
||||
@@ -85,7 +85,7 @@ impl From<PremultipliedAlpha<LinearSrgb<f32>>> for Rgba {
|
||||
alpha: a,
|
||||
} = srgba;
|
||||
|
||||
Rgba([r, g, b, a])
|
||||
Self([r, g, b, a])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ impl From<Rgba> for PremultipliedAlpha<LinearSrgb<f32>> {
|
||||
fn from(col: Rgba) -> Self {
|
||||
let (r, g, b, a) = col.to_tuple();
|
||||
|
||||
PremultipliedAlpha {
|
||||
Self {
|
||||
color: LinearSrgb { r, g, b },
|
||||
alpha: a,
|
||||
}
|
||||
@@ -113,7 +113,7 @@ impl From<Alpha<Hsv<f32>>> for Hsva {
|
||||
alpha: a,
|
||||
} = srgba;
|
||||
|
||||
Hsva::new(h, s, v, a)
|
||||
Self::new(h, s, v, a)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ impl From<Hsva> for Alpha<Hsv<f32>> {
|
||||
fn from(col: Hsva) -> Self {
|
||||
let Hsva { h, s, v, a } = col;
|
||||
|
||||
Alpha {
|
||||
Self {
|
||||
color: Hsv { h, s, v },
|
||||
alpha: a,
|
||||
}
|
||||
@@ -153,7 +153,7 @@ impl From<HsvaGamma> for Alpha<Hsv<f32>> {
|
||||
fn from(col: HsvaGamma) -> Self {
|
||||
let Hsva { h, s, v, a } = col.into();
|
||||
|
||||
Alpha {
|
||||
Self {
|
||||
color: Hsv { h, s, v },
|
||||
alpha: a,
|
||||
}
|
||||
|
||||
@@ -34,33 +34,33 @@ impl std::ops::IndexMut<usize> for Color32 {
|
||||
impl Color32 {
|
||||
// Mostly follows CSS names:
|
||||
|
||||
pub const TRANSPARENT: Color32 = Color32::from_rgba_premultiplied(0, 0, 0, 0);
|
||||
pub const BLACK: Color32 = Color32::from_rgb(0, 0, 0);
|
||||
pub const DARK_GRAY: Color32 = Color32::from_rgb(96, 96, 96);
|
||||
pub const GRAY: Color32 = Color32::from_rgb(160, 160, 160);
|
||||
pub const LIGHT_GRAY: Color32 = Color32::from_rgb(220, 220, 220);
|
||||
pub const WHITE: Color32 = Color32::from_rgb(255, 255, 255);
|
||||
pub const TRANSPARENT: Self = Self::from_rgba_premultiplied(0, 0, 0, 0);
|
||||
pub const BLACK: Self = Self::from_rgb(0, 0, 0);
|
||||
pub const DARK_GRAY: Self = Self::from_rgb(96, 96, 96);
|
||||
pub const GRAY: Self = Self::from_rgb(160, 160, 160);
|
||||
pub const LIGHT_GRAY: Self = Self::from_rgb(220, 220, 220);
|
||||
pub const WHITE: Self = Self::from_rgb(255, 255, 255);
|
||||
|
||||
pub const BROWN: Color32 = Color32::from_rgb(165, 42, 42);
|
||||
pub const DARK_RED: Color32 = Color32::from_rgb(0x8B, 0, 0);
|
||||
pub const RED: Color32 = Color32::from_rgb(255, 0, 0);
|
||||
pub const LIGHT_RED: Color32 = Color32::from_rgb(255, 128, 128);
|
||||
pub const BROWN: Self = Self::from_rgb(165, 42, 42);
|
||||
pub const DARK_RED: Self = Self::from_rgb(0x8B, 0, 0);
|
||||
pub const RED: Self = Self::from_rgb(255, 0, 0);
|
||||
pub const LIGHT_RED: Self = Self::from_rgb(255, 128, 128);
|
||||
|
||||
pub const YELLOW: Color32 = Color32::from_rgb(255, 255, 0);
|
||||
pub const LIGHT_YELLOW: Color32 = Color32::from_rgb(255, 255, 0xE0);
|
||||
pub const KHAKI: Color32 = Color32::from_rgb(240, 230, 140);
|
||||
pub const YELLOW: Self = Self::from_rgb(255, 255, 0);
|
||||
pub const LIGHT_YELLOW: Self = Self::from_rgb(255, 255, 0xE0);
|
||||
pub const KHAKI: Self = Self::from_rgb(240, 230, 140);
|
||||
|
||||
pub const DARK_GREEN: Color32 = Color32::from_rgb(0, 0x64, 0);
|
||||
pub const GREEN: Color32 = Color32::from_rgb(0, 255, 0);
|
||||
pub const LIGHT_GREEN: Color32 = Color32::from_rgb(0x90, 0xEE, 0x90);
|
||||
pub const DARK_GREEN: Self = Self::from_rgb(0, 0x64, 0);
|
||||
pub const GREEN: Self = Self::from_rgb(0, 255, 0);
|
||||
pub const LIGHT_GREEN: Self = Self::from_rgb(0x90, 0xEE, 0x90);
|
||||
|
||||
pub const DARK_BLUE: Color32 = Color32::from_rgb(0, 0, 0x8B);
|
||||
pub const BLUE: Color32 = Color32::from_rgb(0, 0, 255);
|
||||
pub const LIGHT_BLUE: Color32 = Color32::from_rgb(0xAD, 0xD8, 0xE6);
|
||||
pub const DARK_BLUE: Self = Self::from_rgb(0, 0, 0x8B);
|
||||
pub const BLUE: Self = Self::from_rgb(0, 0, 255);
|
||||
pub const LIGHT_BLUE: Self = Self::from_rgb(0xAD, 0xD8, 0xE6);
|
||||
|
||||
pub const GOLD: Color32 = Color32::from_rgb(255, 215, 0);
|
||||
pub const GOLD: Self = Self::from_rgb(255, 215, 0);
|
||||
|
||||
pub const DEBUG_COLOR: Color32 = Color32::from_rgba_premultiplied(0, 200, 0, 128);
|
||||
pub const DEBUG_COLOR: Self = Self::from_rgba_premultiplied(0, 200, 0, 128);
|
||||
|
||||
/// An ugly color that is planned to be replaced before making it to the screen.
|
||||
///
|
||||
@@ -69,10 +69,10 @@ impl Color32 {
|
||||
///
|
||||
/// This is used as a special color key,
|
||||
/// i.e. often taken to mean "no color".
|
||||
pub const PLACEHOLDER: Color32 = Color32::from_rgba_premultiplied(64, 254, 0, 128);
|
||||
pub const PLACEHOLDER: Self = Self::from_rgba_premultiplied(64, 254, 0, 128);
|
||||
|
||||
#[deprecated = "Renamed to PLACEHOLDER"]
|
||||
pub const TEMPORARY_COLOR: Color32 = Self::PLACEHOLDER;
|
||||
pub const TEMPORARY_COLOR: Self = Self::PLACEHOLDER;
|
||||
|
||||
#[inline]
|
||||
pub const fn from_rgb(r: u8, g: u8, b: u8) -> Self {
|
||||
@@ -198,7 +198,7 @@ impl Color32 {
|
||||
///
|
||||
/// This is perceptually even, and faster that [`Self::linear_multiply`].
|
||||
#[inline]
|
||||
pub fn gamma_multiply(self, factor: f32) -> Color32 {
|
||||
pub fn gamma_multiply(self, factor: f32) -> Self {
|
||||
crate::ecolor_assert!(0.0 <= factor && factor <= 1.0);
|
||||
let Self([r, g, b, a]) = self;
|
||||
Self([
|
||||
@@ -214,7 +214,7 @@ impl Color32 {
|
||||
/// This is using linear space, which is not perceptually even.
|
||||
/// You may want to use [`Self::gamma_multiply`] instead.
|
||||
#[inline]
|
||||
pub fn linear_multiply(self, factor: f32) -> Color32 {
|
||||
pub fn linear_multiply(self, factor: f32) -> Self {
|
||||
crate::ecolor_assert!(0.0 <= factor && factor <= 1.0);
|
||||
// As an unfortunate side-effect of using premultiplied alpha
|
||||
// we need a somewhat expensive conversion to linear space and back.
|
||||
|
||||
@@ -47,20 +47,20 @@ impl FromStr for HexColor {
|
||||
impl Display for HexColor {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
HexColor::Hex3(color) => {
|
||||
Self::Hex3(color) => {
|
||||
let [r, g, b, _] = color.to_srgba_unmultiplied().map(|u| u >> 4);
|
||||
f.write_fmt(format_args!("#{r:x}{g:x}{b:x}"))
|
||||
}
|
||||
HexColor::Hex4(color) => {
|
||||
Self::Hex4(color) => {
|
||||
let [r, g, b, a] = color.to_srgba_unmultiplied().map(|u| u >> 4);
|
||||
f.write_fmt(format_args!("#{r:x}{g:x}{b:x}{a:x}"))
|
||||
}
|
||||
HexColor::Hex6(color) => {
|
||||
Self::Hex6(color) => {
|
||||
let [r, g, b, _] = color.to_srgba_unmultiplied();
|
||||
let u = u32::from_be_bytes([0, r, g, b]);
|
||||
f.write_fmt(format_args!("#{u:06x}"))
|
||||
}
|
||||
HexColor::Hex8(color) => {
|
||||
Self::Hex8(color) => {
|
||||
let [r, g, b, a] = color.to_srgba_unmultiplied();
|
||||
let u = u32::from_be_bytes([r, g, b, a]);
|
||||
f.write_fmt(format_args!("#{u:08x}"))
|
||||
@@ -74,10 +74,7 @@ impl HexColor {
|
||||
#[inline]
|
||||
pub fn color(&self) -> Color32 {
|
||||
match self {
|
||||
HexColor::Hex3(color)
|
||||
| HexColor::Hex4(color)
|
||||
| HexColor::Hex6(color)
|
||||
| HexColor::Hex8(color) => *color,
|
||||
Self::Hex3(color) | Self::Hex4(color) | Self::Hex6(color) | Self::Hex8(color) => *color,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,26 +91,26 @@ impl HexColor {
|
||||
.map_err(ParseHexColorError::InvalidInt)?
|
||||
.to_be_bytes();
|
||||
let [r, g, b] = [r, gb >> 4, gb & 0x0f].map(|u| u << 4 | u);
|
||||
Ok(HexColor::Hex3(Color32::from_rgb(r, g, b)))
|
||||
Ok(Self::Hex3(Color32::from_rgb(r, g, b)))
|
||||
}
|
||||
4 => {
|
||||
let [r_g, b_a] = u16::from_str_radix(s, 16)
|
||||
.map_err(ParseHexColorError::InvalidInt)?
|
||||
.to_be_bytes();
|
||||
let [r, g, b, a] = [r_g >> 4, r_g & 0x0f, b_a >> 4, b_a & 0x0f].map(|u| u << 4 | u);
|
||||
Ok(HexColor::Hex4(Color32::from_rgba_unmultiplied(r, g, b, a)))
|
||||
Ok(Self::Hex4(Color32::from_rgba_unmultiplied(r, g, b, a)))
|
||||
}
|
||||
6 => {
|
||||
let [_, r, g, b] = u32::from_str_radix(s, 16)
|
||||
.map_err(ParseHexColorError::InvalidInt)?
|
||||
.to_be_bytes();
|
||||
Ok(HexColor::Hex6(Color32::from_rgb(r, g, b)))
|
||||
Ok(Self::Hex6(Color32::from_rgb(r, g, b)))
|
||||
}
|
||||
8 => {
|
||||
let [r, g, b, a] = u32::from_str_radix(s, 16)
|
||||
.map_err(ParseHexColorError::InvalidInt)?
|
||||
.to_be_bytes();
|
||||
Ok(HexColor::Hex8(Color32::from_rgba_unmultiplied(r, g, b, a)))
|
||||
Ok(Self::Hex8(Color32::from_rgba_unmultiplied(r, g, b, a)))
|
||||
}
|
||||
_ => Err(ParseHexColorError::InvalidLength)?,
|
||||
}
|
||||
|
||||
@@ -54,13 +54,13 @@ impl Hsva {
|
||||
#![allow(clippy::many_single_char_names)]
|
||||
if a == 0.0 {
|
||||
if r == 0.0 && b == 0.0 && a == 0.0 {
|
||||
Hsva::default()
|
||||
Self::default()
|
||||
} else {
|
||||
Hsva::from_additive_rgb([r, g, b])
|
||||
Self::from_additive_rgb([r, g, b])
|
||||
}
|
||||
} else {
|
||||
let (h, s, v) = hsv_from_rgb([r / a, g / a, b / a]);
|
||||
Hsva { h, s, v, a }
|
||||
Self { h, s, v, a }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,13 +69,13 @@ impl Hsva {
|
||||
pub fn from_rgba_unmultiplied(r: f32, g: f32, b: f32, a: f32) -> Self {
|
||||
#![allow(clippy::many_single_char_names)]
|
||||
let (h, s, v) = hsv_from_rgb([r, g, b]);
|
||||
Hsva { h, s, v, a }
|
||||
Self { h, s, v, a }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn from_additive_rgb(rgb: [f32; 3]) -> Self {
|
||||
let (h, s, v) = hsv_from_rgb(rgb);
|
||||
Hsva {
|
||||
Self {
|
||||
h,
|
||||
s,
|
||||
v,
|
||||
@@ -95,7 +95,7 @@ impl Hsva {
|
||||
#[inline]
|
||||
pub fn from_rgb(rgb: [f32; 3]) -> Self {
|
||||
let (h, s, v) = hsv_from_rgb(rgb);
|
||||
Hsva { h, s, v, a: 1.0 }
|
||||
Self { h, s, v, a: 1.0 }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@@ -145,7 +145,7 @@ impl Hsva {
|
||||
/// Represents additive colors using a negative alpha.
|
||||
#[inline]
|
||||
pub fn to_rgba_unmultiplied(&self) -> [f32; 4] {
|
||||
let Hsva { h, s, v, a } = *self;
|
||||
let Self { h, s, v, a } = *self;
|
||||
let [r, g, b] = rgb_from_hsv((h, s, v));
|
||||
[r, g, b, a]
|
||||
}
|
||||
@@ -176,29 +176,29 @@ impl Hsva {
|
||||
|
||||
impl From<Hsva> for Rgba {
|
||||
#[inline]
|
||||
fn from(hsva: Hsva) -> Rgba {
|
||||
Rgba(hsva.to_rgba_premultiplied())
|
||||
fn from(hsva: Hsva) -> Self {
|
||||
Self(hsva.to_rgba_premultiplied())
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Rgba> for Hsva {
|
||||
#[inline]
|
||||
fn from(rgba: Rgba) -> Hsva {
|
||||
fn from(rgba: Rgba) -> Self {
|
||||
Self::from_rgba_premultiplied(rgba.0[0], rgba.0[1], rgba.0[2], rgba.0[3])
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Hsva> for Color32 {
|
||||
#[inline]
|
||||
fn from(hsva: Hsva) -> Color32 {
|
||||
Color32::from(Rgba::from(hsva))
|
||||
fn from(hsva: Hsva) -> Self {
|
||||
Self::from(Rgba::from(hsva))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Color32> for Hsva {
|
||||
#[inline]
|
||||
fn from(srgba: Color32) -> Hsva {
|
||||
Hsva::from(Rgba::from(srgba))
|
||||
fn from(srgba: Color32) -> Self {
|
||||
Self::from(Rgba::from(srgba))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,21 +18,21 @@ pub struct HsvaGamma {
|
||||
}
|
||||
|
||||
impl From<HsvaGamma> for Rgba {
|
||||
fn from(hsvag: HsvaGamma) -> Rgba {
|
||||
fn from(hsvag: HsvaGamma) -> Self {
|
||||
Hsva::from(hsvag).into()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<HsvaGamma> for Color32 {
|
||||
fn from(hsvag: HsvaGamma) -> Color32 {
|
||||
fn from(hsvag: HsvaGamma) -> Self {
|
||||
Rgba::from(hsvag).into()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<HsvaGamma> for Hsva {
|
||||
fn from(hsvag: HsvaGamma) -> Hsva {
|
||||
fn from(hsvag: HsvaGamma) -> Self {
|
||||
let HsvaGamma { h, s, v, a } = hsvag;
|
||||
Hsva {
|
||||
Self {
|
||||
h,
|
||||
s,
|
||||
v: linear_from_gamma(v),
|
||||
@@ -42,21 +42,21 @@ impl From<HsvaGamma> for Hsva {
|
||||
}
|
||||
|
||||
impl From<Rgba> for HsvaGamma {
|
||||
fn from(rgba: Rgba) -> HsvaGamma {
|
||||
fn from(rgba: Rgba) -> Self {
|
||||
Hsva::from(rgba).into()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Color32> for HsvaGamma {
|
||||
fn from(srgba: Color32) -> HsvaGamma {
|
||||
fn from(srgba: Color32) -> Self {
|
||||
Hsva::from(srgba).into()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Hsva> for HsvaGamma {
|
||||
fn from(hsva: Hsva) -> HsvaGamma {
|
||||
fn from(hsva: Hsva) -> Self {
|
||||
let Hsva { h, s, v, a } = hsva;
|
||||
HsvaGamma {
|
||||
Self {
|
||||
h,
|
||||
s,
|
||||
v: gamma_from_linear(v),
|
||||
|
||||
@@ -35,8 +35,8 @@ pub use hex_color_runtime::*;
|
||||
// Color conversion:
|
||||
|
||||
impl From<Color32> for Rgba {
|
||||
fn from(srgba: Color32) -> Rgba {
|
||||
Rgba([
|
||||
fn from(srgba: Color32) -> Self {
|
||||
Self([
|
||||
linear_f32_from_gamma_u8(srgba.0[0]),
|
||||
linear_f32_from_gamma_u8(srgba.0[1]),
|
||||
linear_f32_from_gamma_u8(srgba.0[2]),
|
||||
@@ -46,8 +46,8 @@ impl From<Color32> for Rgba {
|
||||
}
|
||||
|
||||
impl From<Rgba> for Color32 {
|
||||
fn from(rgba: Rgba) -> Color32 {
|
||||
Color32([
|
||||
fn from(rgba: Rgba) -> Self {
|
||||
Self([
|
||||
gamma_u8_from_linear_f32(rgba.0[0]),
|
||||
gamma_u8_from_linear_f32(rgba.0[1]),
|
||||
gamma_u8_from_linear_f32(rgba.0[2]),
|
||||
|
||||
@@ -50,12 +50,12 @@ impl std::hash::Hash for Rgba {
|
||||
}
|
||||
|
||||
impl Rgba {
|
||||
pub const TRANSPARENT: Rgba = Rgba::from_rgba_premultiplied(0.0, 0.0, 0.0, 0.0);
|
||||
pub const BLACK: Rgba = Rgba::from_rgb(0.0, 0.0, 0.0);
|
||||
pub const WHITE: Rgba = Rgba::from_rgb(1.0, 1.0, 1.0);
|
||||
pub const RED: Rgba = Rgba::from_rgb(1.0, 0.0, 0.0);
|
||||
pub const GREEN: Rgba = Rgba::from_rgb(0.0, 1.0, 0.0);
|
||||
pub const BLUE: Rgba = Rgba::from_rgb(0.0, 0.0, 1.0);
|
||||
pub const TRANSPARENT: Self = Self::from_rgba_premultiplied(0.0, 0.0, 0.0, 0.0);
|
||||
pub const BLACK: Self = Self::from_rgb(0.0, 0.0, 0.0);
|
||||
pub const WHITE: Self = Self::from_rgb(1.0, 1.0, 1.0);
|
||||
pub const RED: Self = Self::from_rgb(1.0, 0.0, 0.0);
|
||||
pub const GREEN: Self = Self::from_rgb(0.0, 1.0, 0.0);
|
||||
pub const BLUE: Self = Self::from_rgb(0.0, 0.0, 1.0);
|
||||
|
||||
#[inline]
|
||||
pub const fn from_rgba_premultiplied(r: f32, g: f32, b: f32, a: f32) -> Self {
|
||||
@@ -220,11 +220,11 @@ impl Rgba {
|
||||
}
|
||||
|
||||
impl std::ops::Add for Rgba {
|
||||
type Output = Rgba;
|
||||
type Output = Self;
|
||||
|
||||
#[inline]
|
||||
fn add(self, rhs: Rgba) -> Rgba {
|
||||
Rgba([
|
||||
fn add(self, rhs: Self) -> Self {
|
||||
Self([
|
||||
self[0] + rhs[0],
|
||||
self[1] + rhs[1],
|
||||
self[2] + rhs[2],
|
||||
@@ -233,12 +233,12 @@ impl std::ops::Add for Rgba {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::Mul<Rgba> for Rgba {
|
||||
type Output = Rgba;
|
||||
impl std::ops::Mul for Rgba {
|
||||
type Output = Self;
|
||||
|
||||
#[inline]
|
||||
fn mul(self, other: Rgba) -> Rgba {
|
||||
Rgba([
|
||||
fn mul(self, other: Self) -> Self {
|
||||
Self([
|
||||
self[0] * other[0],
|
||||
self[1] * other[1],
|
||||
self[2] * other[2],
|
||||
@@ -248,11 +248,11 @@ impl std::ops::Mul<Rgba> for Rgba {
|
||||
}
|
||||
|
||||
impl std::ops::Mul<f32> for Rgba {
|
||||
type Output = Rgba;
|
||||
type Output = Self;
|
||||
|
||||
#[inline]
|
||||
fn mul(self, factor: f32) -> Rgba {
|
||||
Rgba([
|
||||
fn mul(self, factor: f32) -> Self {
|
||||
Self([
|
||||
self[0] * factor,
|
||||
self[1] * factor,
|
||||
self[2] * factor,
|
||||
|
||||
Reference in New Issue
Block a user