pub struct FillColor(/* private fields */);Expand description
Represents the fill color of a rectangle
Can be a single color or a simple gradient with different colors for each corner
Implementations§
Source§impl FillColor
impl FillColor
Sourcepub const TRANSPARENT: Self
pub const TRANSPARENT: Self
Transparent background (alpha = 0)
pub const fn new(corners: Corners<Vec4>) -> Self
Sourcepub const fn transparent() -> Self
pub const fn transparent() -> Self
Transparent background (alpha = 0)
Sourcepub fn is_transparent(&self) -> bool
pub fn is_transparent(&self) -> bool
Check if the fill color is completely transparent
(i.e. all corners have an alpha value of 0.0)
Sourcepub fn is_opaque(&self) -> bool
pub fn is_opaque(&self) -> bool
Check if the fill color is completely opaque
(i.e. all corners have an alpha value of 1.0)
Sourcepub const fn rgba(r: f32, g: f32, b: f32, a: f32) -> Self
pub const fn rgba(r: f32, g: f32, b: f32, a: f32) -> Self
Construct a solid color fill from values representing the red, green, blue and alpha channels
Sourcepub const fn rgb(r: f32, g: f32, b: f32) -> Self
pub const fn rgb(r: f32, g: f32, b: f32) -> Self
Construct a solid color fill from three values representing the red, green and blue channels
Sourcepub const fn from_corners(corners: Corners<Vec4>) -> Self
pub const fn from_corners(corners: Corners<Vec4>) -> Self
Construct a solid color fill from colors for each corner
Sourcepub fn interpolate(&self, uv: Vec2) -> Vec4
pub fn interpolate(&self, uv: Vec2) -> Vec4
Interpolate color on position, assuming a linear gradient
Trait Implementations§
Source§impl From<((f32, f32, f32), (f32, f32, f32), (f32, f32, f32), (f32, f32, f32))> for FillColor
impl From<((f32, f32, f32), (f32, f32, f32), (f32, f32, f32), (f32, f32, f32))> for FillColor
Source§impl From<((f32, f32, f32, f32), (f32, f32, f32, f32), (f32, f32, f32, f32), (f32, f32, f32, f32))> for FillColor
impl From<((f32, f32, f32, f32), (f32, f32, f32, f32), (f32, f32, f32, f32), (f32, f32, f32, f32))> for FillColor
impl Copy for FillColor
impl StructuralPartialEq for FillColor
Auto Trait Implementations§
impl Freeze for FillColor
impl RefUnwindSafe for FillColor
impl Send for FillColor
impl Sync for FillColor
impl Unpin for FillColor
impl UnwindSafe for FillColor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more