summaryrefslogtreecommitdiffstats
path: root/graphics/src/primitive.rs
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/src/primitive.rs')
-rw-r--r--graphics/src/primitive.rs36
1 files changed, 28 insertions, 8 deletions
diff --git a/graphics/src/primitive.rs b/graphics/src/primitive.rs
index 8a97e6e7..20affaaf 100644
--- a/graphics/src/primitive.rs
+++ b/graphics/src/primitive.rs
@@ -4,6 +4,7 @@ use crate::core::image;
use crate::core::svg;
use crate::core::text;
use crate::core::{Background, Color, Font, Pixels, Point, Rectangle, Vector};
+use crate::text::editor;
use crate::text::paragraph;
use std::sync::Arc;
@@ -13,24 +14,26 @@ use std::sync::Arc;
pub enum Primitive<T> {
/// A text primitive
Text {
- /// The contents of the text
+ /// The contents of the text.
content: String,
- /// The bounds of the text
+ /// The bounds of the text.
bounds: Rectangle,
- /// The color of the text
+ /// The color of the text.
color: Color,
- /// The size of the text in logical pixels
+ /// The size of the text in logical pixels.
size: Pixels,
- /// The line height of the text
+ /// The line height of the text.
line_height: text::LineHeight,
- /// The font of the text
+ /// The font of the text.
font: Font,
- /// The horizontal alignment of the text
+ /// The horizontal alignment of the text.
horizontal_alignment: alignment::Horizontal,
- /// The vertical alignment of the text
+ /// The vertical alignment of the text.
vertical_alignment: alignment::Vertical,
/// The shaping strategy of the text.
shaping: text::Shaping,
+ /// The clip bounds of the text.
+ clip_bounds: Rectangle,
},
/// A paragraph primitive
Paragraph {
@@ -40,7 +43,22 @@ pub enum Primitive<T> {
position: Point,
/// The color of the paragraph.
color: Color,
+ /// The clip bounds of the paragraph.
+ clip_bounds: Rectangle,
},
+ /// An editor primitive
+ Editor {
+ /// The [`editor::Weak`] reference.
+ editor: editor::Weak,
+ /// The position of the editor.
+ position: Point,
+ /// The color of the editor.
+ color: Color,
+ /// The clip bounds of the editor.
+ clip_bounds: Rectangle,
+ },
+ /// A raw `cosmic-text` primitive
+ RawText(crate::text::Raw),
/// A quad primitive
Quad {
/// The bounds of the quad
@@ -58,6 +76,8 @@ pub enum Primitive<T> {
Image {
/// The handle of the image
handle: image::Handle,
+ /// The filter method of the image
+ filter_method: image::FilterMethod,
/// The bounds of the image
bounds: Rectangle,
},