summaryrefslogtreecommitdiffstats
path: root/wgpu/src/primitive.rs
diff options
context:
space:
mode:
Diffstat (limited to 'wgpu/src/primitive.rs')
-rw-r--r--wgpu/src/primitive.rs39
1 files changed, 35 insertions, 4 deletions
diff --git a/wgpu/src/primitive.rs b/wgpu/src/primitive.rs
index 9efd74f6..823b4b72 100644
--- a/wgpu/src/primitive.rs
+++ b/wgpu/src/primitive.rs
@@ -1,8 +1,11 @@
use iced_native::{
- Background, Color, Font, HorizontalAlignment, Rectangle, Vector,
- VerticalAlignment,
+ image, svg, Background, Color, Font, HorizontalAlignment, Point, Rectangle,
+ Vector, VerticalAlignment,
};
+use crate::triangle;
+use std::sync::Arc;
+
/// A rendering primitive.
#[derive(Debug, Clone)]
pub enum Primitive {
@@ -38,14 +41,26 @@ pub enum Primitive {
background: Background,
/// The border radius of the quad
border_radius: u16,
+ /// The border width of the quad
+ border_width: u16,
+ /// The border color of the quad
+ border_color: Color,
},
/// An image primitive
Image {
- /// The path of the image
- path: String,
+ /// The handle of the image
+ handle: image::Handle,
/// The bounds of the image
bounds: Rectangle,
},
+ /// An SVG primitive
+ Svg {
+ /// The path of the SVG file
+ handle: svg::Handle,
+
+ /// The bounds of the viewport
+ bounds: Rectangle,
+ },
/// A clip primitive
Clip {
/// The bounds of the clip
@@ -55,4 +70,20 @@ pub enum Primitive {
/// The content of the clip
content: Box<Primitive>,
},
+ /// A low-level primitive to render a mesh of triangles.
+ ///
+ /// It can be used to render many kinds of geometry freely.
+ Mesh2D {
+ /// The top-left coordinate of the mesh
+ origin: Point,
+
+ /// The vertex and index buffers of the mesh
+ buffers: Arc<triangle::Mesh2D>,
+ },
+}
+
+impl Default for Primitive {
+ fn default() -> Primitive {
+ Primitive::None
+ }
}