diff options
author | 2024-02-02 14:54:56 +0100 | |
---|---|---|
committer | 2024-02-02 14:54:56 +0100 | |
commit | aea172543cb49f1f1e3625f60b49336f59e26c00 (patch) | |
tree | e99e7a55873678ac37fd695a0f46c1350b30dd2f /wgpu/src/layer | |
parent | 759f0e922598504705b543185bc7140a652b726a (diff) | |
parent | b3adf3184594c9bf60e0548a0362d30c512f3966 (diff) | |
download | iced-aea172543cb49f1f1e3625f60b49336f59e26c00.tar.gz iced-aea172543cb49f1f1e3625f60b49336f59e26c00.tar.bz2 iced-aea172543cb49f1f1e3625f60b49336f59e26c00.zip |
Merge pull request #2120 from iced-rs/transform-primitive
`Transform` primitive
Diffstat (limited to 'wgpu/src/layer')
-rw-r--r-- | wgpu/src/layer/mesh.rs | 17 | ||||
-rw-r--r-- | wgpu/src/layer/text.rs | 10 |
2 files changed, 16 insertions, 11 deletions
diff --git a/wgpu/src/layer/mesh.rs b/wgpu/src/layer/mesh.rs index 7c6206cd..5ed7c654 100644 --- a/wgpu/src/layer/mesh.rs +++ b/wgpu/src/layer/mesh.rs @@ -1,5 +1,5 @@ //! A collection of triangle primitives. -use crate::core::{Point, Rectangle}; +use crate::core::{Rectangle, Transformation}; use crate::graphics::mesh; /// A mesh of triangles. @@ -7,8 +7,8 @@ use crate::graphics::mesh; pub enum Mesh<'a> { /// A mesh of triangles with a solid color. Solid { - /// The origin of the vertices of the [`Mesh`]. - origin: Point, + /// The [`Transformation`] for the vertices of the [`Mesh`]. + transformation: Transformation, /// The vertex and index buffers of the [`Mesh`]. buffers: &'a mesh::Indexed<mesh::SolidVertex2D>, @@ -18,8 +18,8 @@ pub enum Mesh<'a> { }, /// A mesh of triangles with a gradient color. Gradient { - /// The origin of the vertices of the [`Mesh`]. - origin: Point, + /// The [`Transformation`] for the vertices of the [`Mesh`]. + transformation: Transformation, /// The vertex and index buffers of the [`Mesh`]. buffers: &'a mesh::Indexed<mesh::GradientVertex2D>, @@ -31,11 +31,10 @@ pub enum Mesh<'a> { impl Mesh<'_> { /// Returns the origin of the [`Mesh`]. - pub fn origin(&self) -> Point { + pub fn transformation(&self) -> Transformation { match self { - Self::Solid { origin, .. } | Self::Gradient { origin, .. } => { - *origin - } + Self::Solid { transformation, .. } + | Self::Gradient { transformation, .. } => *transformation, } } diff --git a/wgpu/src/layer/text.rs b/wgpu/src/layer/text.rs index 37ee5247..b3a00130 100644 --- a/wgpu/src/layer/text.rs +++ b/wgpu/src/layer/text.rs @@ -1,6 +1,6 @@ use crate::core::alignment; use crate::core::text; -use crate::core::{Color, Font, Pixels, Point, Rectangle}; +use crate::core::{Color, Font, Pixels, Point, Rectangle, Transformation}; use crate::graphics; use crate::graphics::text::editor; use crate::graphics::text::paragraph; @@ -15,6 +15,7 @@ pub enum Text<'a> { position: Point, color: Color, clip_bounds: Rectangle, + transformation: Transformation, }, /// An editor. #[allow(missing_docs)] @@ -23,11 +24,16 @@ pub enum Text<'a> { position: Point, color: Color, clip_bounds: Rectangle, + transformation: Transformation, }, /// Some cached text. Cached(Cached<'a>), /// Some raw text. - Raw(graphics::text::Raw), + #[allow(missing_docs)] + Raw { + raw: graphics::text::Raw, + transformation: Transformation, + }, } #[derive(Debug, Clone)] |