iced/graphics/src/widget/canvas/geometry.rs
Héctor Ramón Jiménez ec8ed9fa8b
Fix canvas::Frame issuing a new layer for Mesh2D in with_clip
Text will still be rendered in its own layer, until we fix the composition bottleneck in `glyph-brush`.
2022-03-10 23:33:58 +07:00

24 lines
612 B
Rust

use crate::Primitive;
/// A bunch of shapes that can be drawn.
///
/// [`Geometry`] can be easily generated with a [`Frame`] or stored in a
/// [`Cache`].
///
/// [`Frame`]: crate::widget::canvas::Frame
/// [`Cache`]: crate::widget::canvas::Cache
#[derive(Debug, Clone)]
pub struct Geometry(Primitive);
impl Geometry {
pub(crate) fn from_primitive(primitive: Primitive) -> Self {
Self(primitive)
}
/// Turns the [`Geometry`] into a [`Primitive`].
///
/// This can be useful if you are building a custom widget.
pub fn into_primitive(self) -> Primitive {
self.0
}
}