pub enum DrawCommand {
Rect {
rect: Rect,
color: Color,
},
RoundedRect {
rect: Rect,
radii: BorderRadii,
color: Color,
},
RoundedBorderRing {
outer_rect: Rect,
outer_radii: BorderRadii,
inner_rect: Rect,
inner_radii: BorderRadii,
color: Color,
},
Border {
rect: Rect,
widths: BorderWidths,
colors: BorderColors,
styles: BorderStyles,
},
Text {
x: f32,
y: f32,
runs: Vec<ShapedTextRun>,
},
Image {
source_id: u64,
dest: Rect,
_object_fit: u8,
},
Line {
x0: f32,
y0: f32,
x1: f32,
y1: f32,
width: f32,
color: Color,
},
Outline {
rect: Rect,
radii: BorderRadii,
width: f32,
offset: f32,
color: Color,
},
BoxShadow {
rect: Rect,
offset_x: f32,
offset_y: f32,
blur: f32,
spread: f32,
color: Color,
},
}Expand description
A concrete draw command — the actual pixels to put on screen.
Chrome equivalent: the PaintOp variants that draw things
(DrawRect, DrawRRect, DrawTextBlob, DrawImageRect, etc.).
Variants§
Rect
Fill a rectangle with a solid color.
Chrome: PaintOp::DrawRectOp + PaintFlags::kFill.
RoundedRect
Fill a rounded rectangle with a solid color.
Chrome: PaintOp::DrawRRectOp.
RoundedBorderRing
Draw a rounded border ring (outer rounded rect minus inner rounded rect).
Chrome: PaintOp::DrawDRRectOp — draws the difference between two rounded rects.
Used for borders on elements with border-radius. Fills ONLY the ring area,
not the interior — so rgba backgrounds behind it show correctly.
Border
Draw a border (four edges, each with its own width, color, and style).
Chrome: PaintOp::DrawDRRectOp or individual edge drawing.
The styles field tells the renderer to draw solid/dashed/dotted/etc.
Text
Draw pre-shaped glyph runs at a position.
Chrome: PaintOp::DrawTextBlobOp — carries a SkTextBlob (pre-shaped).
Glyphs shaped ONCE during layout (Parley + HarfRust).
Renderer just draws them — ZERO font logic in the GPU layer.
Fields
runs: Vec<ShapedTextRun>Pre-shaped glyph runs from layout. Each run has: font data, font size, glyph IDs + positions, color.
Image
Draw an image in a destination rectangle.
Chrome: PaintOp::DrawImageRectOp.
Fields
Line
Draw a line (for underlines, strikethroughs, hr, etc.).
Chrome: PaintOp::DrawLineOp.
Outline
Draw an outline (like border but outside the box, doesn’t affect layout).
Chrome: PaintOp::DrawDRRectOp for the outline ring.
CSS: outline: 2px solid blue; — painted outside the border-box.
Fields
radii: BorderRadiiBorder radii (outline follows the element’s border-radius).
BoxShadow
Draw a box shadow.
Chrome: painted via PaintOp::DrawRRectOp with blur filter.
Trait Implementations§
Source§impl Clone for DrawCommand
impl Clone for DrawCommand
Source§fn clone(&self) -> DrawCommand
fn clone(&self) -> DrawCommand
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for DrawCommand
impl !RefUnwindSafe for DrawCommand
impl Send for DrawCommand
impl Sync for DrawCommand
impl Unpin for DrawCommand
impl UnsafeUnpin for DrawCommand
impl !UnwindSafe for DrawCommand
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more