diff options
author | 2022-12-02 18:53:21 +0100 | |
---|---|---|
committer | 2022-12-02 18:53:21 +0100 | |
commit | 4029a1cdaaac1abbdcc141b20469a49670cd99b6 (patch) | |
tree | 71fa9d9c4aa1f02ce05771db43a4bb7bc6570e77 /graphics/src/primitive.rs | |
parent | 676d8efe03ebdbeeb95aef96b8097395b788b1ab (diff) | |
parent | 8b55e9b9e6ba0b83038dd491dd34d95b4f9a381b (diff) | |
download | iced-4029a1cdaaac1abbdcc141b20469a49670cd99b6.tar.gz iced-4029a1cdaaac1abbdcc141b20469a49670cd99b6.tar.bz2 iced-4029a1cdaaac1abbdcc141b20469a49670cd99b6.zip |
Merge branch 'master' into non-uniform-border-radius-for-quads
Diffstat (limited to 'graphics/src/primitive.rs')
-rw-r--r-- | graphics/src/primitive.rs | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/graphics/src/primitive.rs b/graphics/src/primitive.rs index 84f04624..6f1b6f26 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. /// |