summaryrefslogtreecommitdiffstats
path: root/graphics/src/primitive.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2022-11-28 20:29:01 +0100
committerLibravatar GitHub <noreply@github.com>2022-11-28 20:29:01 +0100
commit8d67e21d48dcefbbb675cfad07849607ce0fe1b7 (patch)
tree58072c44539d4b7009fff3defe97834438234b1b /graphics/src/primitive.rs
parent457d0560caf91884b148422e1ace3d64a38e0e33 (diff)
parentbb2bf063b472396d44f9f3114a87ba79dfd5f62e (diff)
downloadiced-8d67e21d48dcefbbb675cfad07849607ce0fe1b7.tar.gz
iced-8d67e21d48dcefbbb675cfad07849607ce0fe1b7.tar.bz2
iced-8d67e21d48dcefbbb675cfad07849607ce0fe1b7.zip
Merge pull request #1538 from iced-rs/group-solid-triangles
Group all solid triangles independently of color
Diffstat (limited to '')
-rw-r--r--graphics/src/primitive.rs25
1 files changed, 19 insertions, 6 deletions
diff --git a/graphics/src/primitive.rs b/graphics/src/primitive.rs
index b481ac0b..9759d97a 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;
@@ -77,20 +78,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.
- Mesh2D {
- /// The vertex and index buffers of the mesh
- buffers: triangle::Mesh2D,
+ 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.
+ 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 shader of the mesh
- style: triangle::Style,
+ /// The [`Gradient`] to apply to the mesh.
+ gradient: Gradient,
},
/// A cached primitive.
///