pub enum PaintOp {
DrawRect {
fill: Option<Fill>,
stroke: Option<Stroke>,
corner_radius: f32,
shadow: Option<BoxShadow>,
},
DrawText {
text: String,
size: f32,
color: Color,
underline: bool,
caret_index: Option<usize>,
},
DrawRichText {
runs: Vec<TextRun>,
caret_index: Option<usize>,
},
DrawImage {
source: String,
fit: ImageFit,
},
DrawPath {
path: String,
fill: Option<Fill>,
stroke: Option<Stroke>,
},
DrawSvg {
content: String,
fill: Option<Fill>,
stroke: Option<Stroke>,
},
}Expand description
A paint operation that draws something on screen.
Paint nodes do not participate in layout sizing – their visual output is
painted into the bounding box determined by their parent layout node. The
renderer walks paint ops to build the final DisplayList.
Variants§
DrawRect
Draws a filled and/or stroked rectangle with optional rounded corners and shadow.
This is the workhorse of the paint pipeline – backgrounds, borders, cards,
buttons, and dividers all compile down to DrawRect.
Fields
DrawText
Draws a single-style text string.
Use this for simple labels where the entire string shares one style. For
mixed-style text (e.g., syntax highlighting), use DrawRichText.
Fields
DrawRichText
Draws multi-style (rich) text composed of TextRuns.
Each run can have a different font size, color, underline, and background highlight. Used for code editors, formatted messages, and any text where inline styling varies.
Fields
DrawImage
Draws a raster image from a URI or asset path.
Fields
DrawPath
Draws an SVG-style path string, optionally filled and/or stroked.
The path uses SVG path data syntax (e.g., "M 0 0 L 10 10 Z").
Fields
DrawSvg
Draws inline SVG content, optionally overriding fill and stroke colors.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for PaintOp
impl<'de> Deserialize<'de> for PaintOp
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<PaintOp, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<PaintOp, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for PaintOp
impl Serialize for PaintOp
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for PaintOp
Auto Trait Implementations§
impl Freeze for PaintOp
impl RefUnwindSafe for PaintOp
impl Send for PaintOp
impl Sync for PaintOp
impl Unpin for PaintOp
impl UnsafeUnpin for PaintOp
impl UnwindSafe for PaintOp
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.