diff options
author | 2022-11-03 18:57:09 +0100 | |
---|---|---|
committer | 2022-11-03 18:57:09 +0100 | |
commit | d222b5c8b0befab665c20ba0112b28199df0ae44 (patch) | |
tree | 0ac3a59f04e1c1ca89ff43800efbefd825b015ea /graphics/src/layer/quad.rs | |
parent | a8f510c39917b2ac42fcc854f0a7eff13aee9838 (diff) | |
parent | f31c8f2504ea7c004c5caed8913e5da28d2e50e2 (diff) | |
download | iced-d222b5c8b0befab665c20ba0112b28199df0ae44.tar.gz iced-d222b5c8b0befab665c20ba0112b28199df0ae44.tar.bz2 iced-d222b5c8b0befab665c20ba0112b28199df0ae44.zip |
Merge pull request #1448 from bungoboingo/fear/linear-gradients
Add linear gradient support to canvas widget
Diffstat (limited to 'graphics/src/layer/quad.rs')
-rw-r--r-- | graphics/src/layer/quad.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/graphics/src/layer/quad.rs b/graphics/src/layer/quad.rs new file mode 100644 index 00000000..4def8427 --- /dev/null +++ b/graphics/src/layer/quad.rs @@ -0,0 +1,30 @@ +/// A colored rectangle with a border. +/// +/// This type can be directly uploaded to GPU memory. +#[derive(Debug, Clone, Copy)] +#[repr(C)] +pub struct Quad { + /// The position of the [`Quad`]. + pub position: [f32; 2], + + /// The size of the [`Quad`]. + pub size: [f32; 2], + + /// The color of the [`Quad`], in __linear RGB__. + pub color: [f32; 4], + + /// The border color of the [`Quad`], in __linear RGB__. + pub border_color: [f32; 4], + + /// The border radius of the [`Quad`]. + pub border_radius: f32, + + /// The border width of the [`Quad`]. + pub border_width: f32, +} + +#[allow(unsafe_code)] +unsafe impl bytemuck::Zeroable for Quad {} + +#[allow(unsafe_code)] +unsafe impl bytemuck::Pod for Quad {} |