Make Color alpha functions const
This commit is contained in:
parent
7de22f9bd4
commit
2aadd0d57a
|
@ -173,13 +173,13 @@ impl Color {
|
|||
)
|
||||
}
|
||||
|
||||
pub fn alpha_multiply(&self, mul: u8) -> Self {
|
||||
pub const fn alpha_multiply(&self, mul: u8) -> Self {
|
||||
let a = self.0 as u8 as u16;
|
||||
let multiplied = ((a * (mul as u16)) >> 8) as u8;
|
||||
self.with_alpha(multiplied)
|
||||
}
|
||||
|
||||
pub fn with_alpha(&self, alpha: u8) -> Self {
|
||||
pub const fn with_alpha(&self, alpha: u8) -> Self {
|
||||
Self(self.0 & 0xffffff00 | alpha as u32)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue