feat: quad shadows

This commit is contained in:
Nick Senger 2023-11-08 19:12:53 -08:00 committed by Héctor Ramón Jiménez
parent b3e3f6e3c9
commit cc906c83cd
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
33 changed files with 305 additions and 25 deletions

View file

@ -540,6 +540,7 @@ where
border_color: color,
border_width: 1.0,
border_radius: 0.0.into(),
shadow: Default::default()
},
Color::TRANSPARENT,
);

View file

@ -27,6 +27,7 @@ pub mod layout;
pub mod mouse;
pub mod overlay;
pub mod renderer;
pub mod shadow;
pub mod svg;
pub mod text;
pub mod time;
@ -70,6 +71,7 @@ pub use pixels::Pixels;
pub use point::Point;
pub use rectangle::Rectangle;
pub use renderer::Renderer;
pub use shadow::Shadow;
pub use shell::Shell;
pub use size::Size;
pub use text::Text;

View file

@ -5,7 +5,7 @@ mod null;
#[cfg(debug_assertions)]
pub use null::Null;
use crate::{Background, BorderRadius, Color, Rectangle, Vector};
use crate::{Background, BorderRadius, Color, Rectangle, Shadow, Vector};
/// A component that can be used by widgets to draw themselves on a screen.
pub trait Renderer: Sized {
@ -45,6 +45,9 @@ pub struct Quad {
/// The border color of the [`Quad`].
pub border_color: Color,
/// The shadow of the [`Quad`].
pub shadow: Shadow,
}
/// The styling attributes of a [`Renderer`].

15
core/src/shadow.rs Normal file
View file

@ -0,0 +1,15 @@
//! Shadow
use crate::{Color, Vector};
/// A shadow
#[derive(Debug, Clone, Copy, PartialEq, Default)]
pub struct Shadow {
/// The color of the shadow
pub color: Color,
/// The offset of the shadow
pub offset: Vector,
/// The blur_radius of the shadow
pub blur_radius: f32,
}