diff options
Diffstat (limited to 'graphics/src/primitive.rs')
-rw-r--r-- | graphics/src/primitive.rs | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/graphics/src/primitive.rs b/graphics/src/primitive.rs index 5f7a344d..5a163a2f 100644 --- a/graphics/src/primitive.rs +++ b/graphics/src/primitive.rs @@ -3,6 +3,7 @@ use iced_native::svg; use iced_native::{Background, Color, Font, Rectangle, Size, Vector}; use crate::alignment; +use crate::gradient::Gradient; use crate::triangle; use std::sync::Arc; @@ -41,7 +42,7 @@ pub enum Primitive { /// The background of the quad background: Background, /// The border radius of the quad - border_radius: f32, + border_radius: [f32; 4], /// The border width of the quad border_width: f32, /// The border color of the quad @@ -59,6 +60,9 @@ pub enum Primitive { /// The path of the SVG file handle: svg::Handle, + /// The [`Color`] filter + color: Option<Color>, + /// The bounds of the viewport bounds: Rectangle, }, @@ -77,17 +81,32 @@ pub enum Primitive { /// The primitive to translate content: Box<Primitive>, }, - /// A low-level primitive to render a mesh of triangles. + /// A low-level primitive to render a mesh of triangles with a solid color. + /// + /// It can be used to render many kinds of geometry freely. + SolidMesh { + /// The vertices and indices of the mesh. + buffers: triangle::Mesh2D<triangle::ColoredVertex2D>, + + /// The size of the drawable region of the mesh. + /// + /// Any geometry that falls out of this region will be clipped. + size: Size, + }, + /// A low-level primitive to render a mesh of triangles with a gradient. /// /// It can be used to render many kinds of geometry freely. - Mesh2D { - /// The vertex and index buffers of the mesh - buffers: triangle::Mesh2D, + GradientMesh { + /// The vertices and indices of the mesh. + buffers: triangle::Mesh2D<triangle::Vertex2D>, /// The size of the drawable region of the mesh. /// /// Any geometry that falls out of this region will be clipped. size: Size, + + /// The [`Gradient`] to apply to the mesh. + gradient: Gradient, }, /// A cached primitive. /// |