diff options
author | 2023-06-29 08:09:45 +0200 | |
---|---|---|
committer | 2023-06-29 08:09:45 +0200 | |
commit | c6b583113da7c9d9ceaeb5a3bf676ae62d8931e1 (patch) | |
tree | ed833fab41f64c57a7522fea400ea42eec788e9f /wgpu/src/primitive.rs | |
parent | 8d65e40a1174ecb8225ce9973575bced36e7aeb5 (diff) | |
parent | 6921564c9f66e8103e19ec658099c5f5c32e8cc5 (diff) | |
download | iced-c6b583113da7c9d9ceaeb5a3bf676ae62d8931e1.tar.gz iced-c6b583113da7c9d9ceaeb5a3bf676ae62d8931e1.tar.bz2 iced-c6b583113da7c9d9ceaeb5a3bf676ae62d8931e1.zip |
Merge pull request #1932 from iced-rs/generic-graphics-primitive
Backend-specific primitives
Diffstat (limited to 'wgpu/src/primitive.rs')
-rw-r--r-- | wgpu/src/primitive.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/wgpu/src/primitive.rs b/wgpu/src/primitive.rs new file mode 100644 index 00000000..8dbf3008 --- /dev/null +++ b/wgpu/src/primitive.rs @@ -0,0 +1,21 @@ +//! Draw using different graphical primitives. +use crate::core::Rectangle; +use crate::graphics::{Damage, Mesh}; + +/// The graphical primitives supported by `iced_wgpu`. +pub type Primitive = crate::graphics::Primitive<Custom>; + +/// The custom primitives supported by `iced_wgpu`. +#[derive(Debug, Clone, PartialEq)] +pub enum Custom { + /// A mesh primitive. + Mesh(Mesh), +} + +impl Damage for Custom { + fn bounds(&self) -> Rectangle { + match self { + Self::Mesh(mesh) => mesh.bounds(), + } + } +} |