From cc906c83cdf896d94b7ccf91258466714be631f6 Mon Sep 17 00:00:00 2001 From: Nick Senger Date: Wed, 8 Nov 2023 19:12:53 -0800 Subject: feat: quad shadows --- core/src/renderer.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'core/src/renderer.rs') diff --git a/core/src/renderer.rs b/core/src/renderer.rs index 1b327e56..481048b0 100644 --- a/core/src/renderer.rs +++ b/core/src/renderer.rs @@ -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`]. -- cgit From b7b457a575cdd103915994f640c50262ce30a7c5 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 20 Jan 2024 12:11:18 +0100 Subject: Make `shadow` optional in `renderer::Quad` --- core/src/renderer.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'core/src/renderer.rs') diff --git a/core/src/renderer.rs b/core/src/renderer.rs index 481048b0..1ca62559 100644 --- a/core/src/renderer.rs +++ b/core/src/renderer.rs @@ -5,7 +5,7 @@ mod null; #[cfg(debug_assertions)] pub use null::Null; -use crate::{Background, BorderRadius, Color, Rectangle, Shadow, Vector}; +use crate::{Background, BorderRadius, Color, Rectangle, Shadow, Size, Vector}; /// A component that can be used by widgets to draw themselves on a screen. pub trait Renderer: Sized { @@ -47,7 +47,19 @@ pub struct Quad { pub border_color: Color, /// The shadow of the [`Quad`]. - pub shadow: Shadow, + pub shadow: Option, +} + +impl Default for Quad { + fn default() -> Self { + Self { + bounds: Rectangle::with_size(Size::ZERO), + border_radius: 0.0.into(), + border_width: 0.0, + border_color: Color::TRANSPARENT, + shadow: None, + } + } } /// The styling attributes of a [`Renderer`]. -- cgit From 25f182f933ea6b7c112c8f9a450a98dc9b9eebdd Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 20 Jan 2024 13:29:25 +0100 Subject: Introduce `Border` struct analogous to `Shadow` --- core/src/renderer.rs | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'core/src/renderer.rs') diff --git a/core/src/renderer.rs b/core/src/renderer.rs index 1ca62559..a2a66aa8 100644 --- a/core/src/renderer.rs +++ b/core/src/renderer.rs @@ -5,7 +5,7 @@ mod null; #[cfg(debug_assertions)] pub use null::Null; -use crate::{Background, BorderRadius, Color, Rectangle, Shadow, Size, Vector}; +use crate::{Background, Border, Color, Rectangle, Shadow, Size, Vector}; /// A component that can be used by widgets to draw themselves on a screen. pub trait Renderer: Sized { @@ -37,27 +37,19 @@ pub struct Quad { /// The bounds of the [`Quad`]. pub bounds: Rectangle, - /// The border radius of the [`Quad`]. - pub border_radius: BorderRadius, + /// The [`Border`] of the [`Quad`]. + pub border: Border, - /// The border width of the [`Quad`]. - pub border_width: f32, - - /// The border color of the [`Quad`]. - pub border_color: Color, - - /// The shadow of the [`Quad`]. - pub shadow: Option, + /// The [`Shadow`] of the [`Quad`]. + pub shadow: Shadow, } impl Default for Quad { fn default() -> Self { Self { bounds: Rectangle::with_size(Size::ZERO), - border_radius: 0.0.into(), - border_width: 0.0, - border_color: Color::TRANSPARENT, - shadow: None, + border: Border::default(), + shadow: Shadow::default(), } } } -- cgit