From 6448429103c9c82b90040ac5a5a097bdded23f82 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 12 Sep 2023 14:51:00 +0200 Subject: Draft `Editor` API and `TextEditor` widget --- graphics/src/primitive.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'graphics/src/primitive.rs') diff --git a/graphics/src/primitive.rs b/graphics/src/primitive.rs index 8a97e6e7..ce0b734b 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; @@ -41,6 +42,15 @@ pub enum Primitive { /// The color of the paragraph. color: Color, }, + /// An editor primitive + Editor { + /// The [`editor::Weak`] reference. + editor: editor::Weak, + /// The position of the paragraph. + position: Point, + /// The color of the paragraph. + color: Color, + }, /// A quad primitive Quad { /// The bounds of the quad -- cgit From a5125d6fea824df1191777fe3eb53a2f748208b9 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 11 Nov 2023 07:02:01 +0100 Subject: Refactor texture image filtering - Support only `Linear` or `Nearest` - Simplify `Layer` groups - Move `FilterMethod` to `Image` and `image::Viewer` --- graphics/src/primitive.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'graphics/src/primitive.rs') diff --git a/graphics/src/primitive.rs b/graphics/src/primitive.rs index ce0b734b..4ed512c1 100644 --- a/graphics/src/primitive.rs +++ b/graphics/src/primitive.rs @@ -68,6 +68,8 @@ pub enum Primitive { 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, }, -- cgit From 936d480267578d7e80675e78ec1880aaaaab72d6 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 1 Dec 2023 16:04:27 +0100 Subject: Clip text to `viewport` bounds instead of layout bounds --- graphics/src/primitive.rs | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'graphics/src/primitive.rs') diff --git a/graphics/src/primitive.rs b/graphics/src/primitive.rs index 4ed512c1..837eb77a 100644 --- a/graphics/src/primitive.rs +++ b/graphics/src/primitive.rs @@ -14,24 +14,26 @@ use std::sync::Arc; pub enum Primitive { /// 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 viewport of the text. + viewport: Rectangle, }, /// A paragraph primitive Paragraph { @@ -41,15 +43,19 @@ pub enum Primitive { position: Point, /// The color of the paragraph. color: Color, + /// The viewport of the paragraph. + viewport: Rectangle, }, /// An editor primitive Editor { /// The [`editor::Weak`] reference. editor: editor::Weak, - /// The position of the paragraph. + /// The position of the editor. position: Point, - /// The color of the paragraph. + /// The color of the editor. color: Color, + /// The viewport of the editor. + viewport: Rectangle, }, /// A quad primitive Quad { -- cgit From b526ce4958b28208395276dd4078ffe0d780e1d7 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 2 Dec 2023 15:53:02 +0100 Subject: Rename `viewport` to `clip_bounds` --- graphics/src/primitive.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'graphics/src/primitive.rs') diff --git a/graphics/src/primitive.rs b/graphics/src/primitive.rs index 837eb77a..ed75776c 100644 --- a/graphics/src/primitive.rs +++ b/graphics/src/primitive.rs @@ -32,8 +32,8 @@ pub enum Primitive { vertical_alignment: alignment::Vertical, /// The shaping strategy of the text. shaping: text::Shaping, - /// The viewport of the text. - viewport: Rectangle, + /// The clip bounds of the text. + clip_bounds: Rectangle, }, /// A paragraph primitive Paragraph { @@ -43,8 +43,8 @@ pub enum Primitive { position: Point, /// The color of the paragraph. color: Color, - /// The viewport of the paragraph. - viewport: Rectangle, + /// The clip bounds of the paragraph. + clip_bounds: Rectangle, }, /// An editor primitive Editor { @@ -54,8 +54,8 @@ pub enum Primitive { position: Point, /// The color of the editor. color: Color, - /// The viewport of the editor. - viewport: Rectangle, + /// The clip bounds of the editor. + clip_bounds: Rectangle, }, /// A quad primitive Quad { -- cgit From 603832e66c710ea39a95009ddc905de20c6856bd Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 5 Dec 2023 02:19:17 +0100 Subject: Introduce `RawText` to `Primitive` in `iced_graphics` This should allow users to directly render a `cosmic_text::Buffer`. --- graphics/src/primitive.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'graphics/src/primitive.rs') diff --git a/graphics/src/primitive.rs b/graphics/src/primitive.rs index ed75776c..20affaaf 100644 --- a/graphics/src/primitive.rs +++ b/graphics/src/primitive.rs @@ -57,6 +57,8 @@ pub enum Primitive { /// 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 -- cgit