Skip to main content

SceneCommand

Enum SceneCommand 

Source
pub enum SceneCommand {
Show 26 variants FillRect { x: f64, y: f64, w: f64, h: f64, paint: Paint, }, StrokeRect { x: f64, y: f64, w: f64, h: f64, color: Color, stroke_width: f64, stroke_dash: Option<f64>, stroke_gap: Option<f64>, stroke_linecap: Option<LineCap>, }, FillRoundedRect { x: f64, y: f64, w: f64, h: f64, radius: f64, paint: Paint, radii: Option<[f64; 4]>, }, StrokeRoundedRect { x: f64, y: f64, w: f64, h: f64, radius: f64, color: Color, stroke_width: f64, stroke_dash: Option<f64>, stroke_gap: Option<f64>, stroke_linecap: Option<LineCap>, radii: Option<[f64; 4]>, }, FillEllipse { x: f64, y: f64, w: f64, h: f64, paint: Paint, rx: Option<f64>, ry: Option<f64>, }, StrokeEllipse { x: f64, y: f64, w: f64, h: f64, color: Color, stroke_width: f64, stroke_dash: Option<f64>, stroke_gap: Option<f64>, stroke_linecap: Option<LineCap>, rx: Option<f64>, ry: Option<f64>, }, StrokeLine { x1: f64, y1: f64, x2: f64, y2: f64, color: Color, stroke_width: f64, stroke_dash: Option<f64>, stroke_gap: Option<f64>, stroke_linecap: Option<LineCap>, }, FillPolygon { points: Vec<f64>, paint: Paint, even_odd: bool, }, StrokePolyline { points: Vec<f64>, color: Color, stroke_width: f64, closed: bool, align: StrokeAlign, fill_even_odd: bool, }, DrawImage { x: f64, y: f64, w: f64, h: f64, asset_id: String, fit: FitMode, pos_x: f64, pos_y: f64, opacity: f64, clip_shape: Option<ImageClip>, src_rect: Option<SrcRect>, }, DrawSvgAsset { x: f64, y: f64, w: f64, h: f64, asset: String, }, DrawGlyphRun { x: f64, y: f64, font_id: String, font_size: f32, color: Color, stroke_color: Option<Color>, stroke_width: Option<f64>, link: Option<String>, selectable: bool, glyphs: Vec<SceneGlyph>, }, PushClip { x: f64, y: f64, w: f64, h: f64, }, PopClip, PushLayer { opacity: f64, blend_mode: Option<BlendMode>, }, PopLayer, PushTransform { angle_deg: f64, cx: f64, cy: f64, }, PopTransform, BeginShadow { shadows: Vec<ShadowSpec>, }, EndShadow, BeginBlur { radius: f64, }, EndBlur, BeginFilter { filters: Vec<FilterSpec>, }, EndFilter, BeginMask { mask: MaskSpec, }, EndMask,
}
Expand description

A single display-list command in the scene.

All variants are tagged in JSON via #[serde(tag = "op")] so that each serialized command carries an "op" field naming the primitive, e.g. { "op": "FillRect", "x": 0.0, … }.

Variants§

§

FillRect

Fill an axis-aligned rectangle.

Fields

§paint: Paint
§

StrokeRect

Stroke an axis-aligned rectangle (inside the declared edge by default).

Fields

§color: Color
§stroke_width: f64
§stroke_dash: Option<f64>

Dash segment length in pixels. None = solid stroke (byte-identical to prior IR).

§stroke_gap: Option<f64>

Gap length in pixels between dashes. None = solid stroke.

§stroke_linecap: Option<LineCap>

Dash end-cap style. None = Butt (default, byte-identical to prior IR).

§

FillRoundedRect

Fill a rectangle with uniform corner radius (and optional per-corner overrides).

Fields

§radius: f64
§paint: Paint
§radii: Option<[f64; 4]>

Per-corner radii [tl, tr, br, bl]. None = use uniform radius for all corners (byte-identical to prior IR when absent).

§

StrokeRoundedRect

Stroke a rectangle with uniform corner radius (and optional per-corner overrides).

Fields

§radius: f64
§color: Color
§stroke_width: f64
§stroke_dash: Option<f64>

Dash segment length in pixels. None = solid stroke (byte-identical to prior IR).

§stroke_gap: Option<f64>

Gap length in pixels between dashes. None = solid stroke.

§stroke_linecap: Option<LineCap>

Dash end-cap style. None = Butt (default, byte-identical to prior IR).

§radii: Option<[f64; 4]>

Per-corner radii [tl, tr, br, bl]. None = use uniform radius for all corners (byte-identical to prior IR when absent).

§

FillEllipse

Fill an axis-aligned ellipse.

Fields

§paint: Paint
§rx: Option<f64>

Explicit x-radius (overrides w/2). None = inscribed ellipse (byte-identical).

§ry: Option<f64>

Explicit y-radius (overrides h/2). None = inscribed ellipse (byte-identical).

§

StrokeEllipse

Stroke an axis-aligned ellipse (centered on the ellipse path; no stroke-alignment in v0).

Fields

§color: Color
§stroke_width: f64
§stroke_dash: Option<f64>

Dash segment length in pixels. None = solid stroke (byte-identical to prior IR).

§stroke_gap: Option<f64>

Gap length in pixels between dashes. None = solid stroke.

§stroke_linecap: Option<LineCap>

Dash end-cap style. None = Butt (default, byte-identical to prior IR).

§rx: Option<f64>

Explicit x-radius (overrides w/2). None = inscribed ellipse (byte-identical).

§ry: Option<f64>

Explicit y-radius (overrides h/2). None = inscribed ellipse (byte-identical).

§

StrokeLine

Stroke a line segment.

Fields

§x1: f64
§y1: f64
§x2: f64
§y2: f64
§color: Color
§stroke_width: f64
§stroke_dash: Option<f64>

Dash segment length in pixels. None = solid stroke (byte-identical to prior IR).

§stroke_gap: Option<f64>

Gap length in pixels between dashes. None = solid stroke.

§stroke_linecap: Option<LineCap>

Dash end-cap style. None = Butt (default, byte-identical to prior IR).

§

FillPolygon

Fill a closed polygon.

Fields

§points: Vec<f64>

Flat list of [x0, y0, x1, y1, …] vertex coordinates.

§paint: Paint
§even_odd: bool

When true, use the even-odd fill rule; otherwise nonzero (winding).

§

StrokePolyline

Stroke a polyline (open or closed depending on closed).

Fields

§points: Vec<f64>

Flat list of [x0, y0, x1, y1, …] vertex coordinates.

§color: Color
§stroke_width: f64
§closed: bool

When true, the path is closed before stroking (polygon outline).

§align: StrokeAlign

Stroke alignment relative to the closed-path boundary. Only meaningful when closed is true; Center is the open-path/default behavior. Skipped in JSON when Center so existing scenes serialize byte-identically.

§fill_even_odd: bool

Fill rule of the clip region used for Inside/Outside alignment. true = even-odd, false = nonzero. Only meaningful when align != Center and closed is true.

§

DrawImage

Draw a raster image asset clipped to its declared box.

The renderer re-resolves bytes via AssetProvider::by_id using only the asset_id string — no raw image bytes appear in the IR. pos_x/pos_y are the object-position anchors resolved to 0.0..=100.0.

Fields

§asset_id: String

Stable asset id; renderer resolves bytes via AssetProvider::by_id.

§fit: FitMode

How the image scales to fill the box.

§pos_x: f64

Horizontal object-position anchor in 0.0..=100.0.

§pos_y: f64

Vertical object-position anchor in 0.0..=100.0.

§opacity: f64

Effective opacity (node opacity × cascaded ctx opacity), 0.0..=1.0.

§clip_shape: Option<ImageClip>

Optional non-rectangular clip shape inscribed in the box. None = the default rectangular box-clip (existing behavior, unchanged).

§src_rect: Option<SrcRect>

Optional source sub-rectangle selecting a crop of the source image before the fit/object-position math is applied. None = use the full source image (byte-identical to scenes without src_rect). Applies to raster assets only; ignored for SVG.

§

DrawSvgAsset

Draw a pre-resolved SVG asset.

Fields

§asset: String

Asset path (project-relative).

§

DrawGlyphRun

Draw a shaped, positioned glyph run.

x is the text-box origin x in pixels; y is the baseline y in pixels (text_box_top + ascent). The renderer re-resolves font bytes via FontProvider::by_id using only the font_id string — no raw font bytes appear in the IR.

Fields

§x: f64

Text-box origin x in pixels.

§y: f64

Baseline y in pixels (text_box_top + ascent).

§font_id: String

Stable font-face identifier; renderer resolves bytes via FontProvider::by_id.

§font_size: f32

Font size at which glyphs were shaped, in pixels.

§color: Color

Fill color of the glyph run.

§stroke_color: Option<Color>

Optional stroke (outline) color applied after the fill. None means no outline — byte-identical to a run without stroke.

§stroke_width: Option<f64>

Stroke width in pixels. Ignored (and serialized as absent) when stroke_color is None or stroke_width is <= 0.

§link: Option<String>

Optional hyperlink URL for this run. When set and the run is selectable, the PDF backend emits a clickable Link annotation over the run’s bounds. None = no link — byte-identical to a run without one. The raster backend ignores it (no clickable concept).

§selectable: bool

Whether this run’s text is selectable / searchable / indexable in the PDF backend. true (default) → real embedded text + ToUnicode; false → filled glyph outlines (visually identical, not extractable). The raster backend ignores it. Serialized only when false, so default runs stay byte-identical.

§glyphs: Vec<SceneGlyph>

Positioned glyphs, baseline-relative.

§

PushClip

Push an axis-aligned clip rectangle onto the clip stack.

Fields

§

PopClip

Pop the most-recently pushed clip rectangle.

§

PushLayer

Push a compositing layer (for opacity, blend, mask).

opacity is the layer alpha applied when the layer is composited back onto its parent. blend_mode selects the compositing operator used for that composite; None (and Some(BlendMode::Normal)) mean plain source-over and serialize identically to a layer with no blend.

Fields

§opacity: f64
§blend_mode: Option<BlendMode>
§

PopLayer

Pop the most-recently pushed compositing layer.

§

PushTransform

Push an affine rotation around a pivot; composes onto the renderer’s transform stack.

Fields

§angle_deg: f64
§cx: f64
§cy: f64
§

PopTransform

Pop the most recent pushed transform.

§

BeginShadow

Open an isolated capture of the following draw commands. The captured ink is buffered offscreen until the matching SceneCommand::EndShadow.

shadows are painted in reverse order at EndShadow (so the first-declared layer ends up on top of later layers), all behind the crisp ink.

Fields

§shadows: Vec<ShadowSpec>
§

EndShadow

Close the active shadow capture: paint the blurred shadow layers, then composite the captured ink on top.

§

BeginBlur

Open an offscreen capture of the following draw commands and apply a Gaussian blur with radius (sigma in pixels) to the captured ink at SceneCommand::EndBlur. radius == 0 is a no-op (no capture opened).

Fields

§radius: f64
§

EndBlur

Close the active blur capture: blur the captured ink in place, then composite it onto the current target.

§

BeginFilter

Open an offscreen capture; apply filters in order to the captured ink at the matching EndFilter, then composite back. Empty filters opens no capture.

Fields

§filters: Vec<FilterSpec>
§

EndFilter

Close the active filter capture: transform the captured ink in place, composite onto the target.

§

BeginMask

Open an offscreen capture of the following draw commands; at the matching SceneCommand::EndMask the captured ink is composited back through the feathered coverage described by mask.

Fields

§

EndMask

Close the active mask capture: composite the captured ink through the mask coverage onto the current target.

Trait Implementations§

Source§

impl Clone for SceneCommand

Source§

fn clone(&self) -> SceneCommand

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SceneCommand

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for SceneCommand

Source§

fn eq(&self, other: &SceneCommand) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for SceneCommand

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for SceneCommand

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.