Skip to main content

DrawOp

Enum DrawOp 

Source
pub enum DrawOp {
    Quad {
        id: String,
        rect: Rect,
        scissor: Option<Rect>,
        shader: ShaderHandle,
        uniforms: UniformBlock,
    },
    GlyphRun {
Show 18 fields id: String, rect: Rect, scissor: Option<Rect>, shader: ShaderHandle, color: Color, text: String, size: f32, line_height: f32, family: FontFamily, mono_family: FontFamily, weight: FontWeight, mono: bool, wrap: TextWrap, anchor: TextAnchor, layout: TextLayout, underline: bool, strikethrough: bool, link: Option<String>,
}, AttributedText { id: String, rect: Rect, scissor: Option<Rect>, shader: ShaderHandle, runs: Vec<(String, RunStyle)>, size: f32, line_height: f32, wrap: TextWrap, anchor: TextAnchor, layout: TextLayout, }, Icon { id: String, rect: Rect, scissor: Option<Rect>, source: IconSource, color: Color, size: f32, stroke_width: f32, }, Image { id: String, rect: Rect, scissor: Option<Rect>, image: Image, tint: Option<Color>, radius: Corners, fit: ImageFit, }, AppTexture { id: String, rect: Rect, scissor: Option<Rect>, texture: AppTexture, alpha: SurfaceAlpha, fit: ImageFit, transform: Affine2, }, Vector { id: String, rect: Rect, scissor: Option<Rect>, asset: Arc<VectorAsset>, render_mode: VectorRenderMode, }, BackdropSnapshot, }
Expand description

One paint operation in the laid-out frame.

Variants§

§

Quad

A rectangular region painted by a shader (typically stock::rounded_rect, but custom shaders also emit Quad).

Fields

§rect: Rect
§scissor: Option<Rect>
§uniforms: UniformBlock
§

GlyphRun

A run of text. The draw op carries the author text and measured layout; backends shape/rasterize through the shared glyph atlas path.

Fields

§rect: Rect
§scissor: Option<Rect>
§color: Color

Carried explicitly on the op for SVG fallback and backend text shaping.

§text: String
§size: f32
§line_height: f32
§family: FontFamily
§mono_family: FontFamily

Monospace face used when mono is set. Stamped from the source El’s mono_font_family (themed via Theme::mono_font_family).

§weight: FontWeight
§mono: bool
§anchor: TextAnchor
§layout: TextLayout
§underline: bool

Underline / strikethrough state lifted from the source El’s text_underline / text_strikethrough. Backends fold them into the synthesized RunStyle before shaping so the decoration pass in crate::text::atlas runs uniformly for standalone leaves and attributed paragraphs.

§strikethrough: bool
§link: Option<String>

Optional link URL from the El’s text_link. Carried for future hit-test work; today it just pins color + underline via RunStyle::with_link.

§

AttributedText

An attributed paragraph: a sequence of styled runs that flow together inside one rect. The runtime hands runs straight to crate::text::atlas::GlyphAtlas::shape_and_rasterize_runs so wrapping decisions cross run boundaries (real prose, not glued segments). layout is an approximate pre-shaping measurement from text::metrics — backends shape for accurate placement; SVG uses it to lay tspan baselines.

Fields

§rect: Rect
§scissor: Option<Rect>
§runs: Vec<(String, RunStyle)>

Source-order styled spans. Each String may contain embedded \n to express in-paragraph hard breaks.

§size: f32
§line_height: f32
§anchor: TextAnchor
§layout: TextLayout
§

Icon

A vector icon scaled into rect. The source is either a built-in crate::tree::IconName (24x24 lucide-style) or an app-supplied crate::SvgIcon. SVG bundle output renders the vector paths directly; wgpu/vulkano backends bake an MTSDF (or tessellate for non-flat materials); backends without a native vector painter fall back to a glyph for built-ins.

Fields

§rect: Rect
§scissor: Option<Rect>
§source: IconSource
§color: Color
§size: f32
§stroke_width: f32
§

Image

A raster image painted into rect. The image carries the pixel data (Arc-shared with the source El) and is keyed by image.content_hash() in backend texture caches. rect is the post-fit destination; for Cover it can extend past the El’s content area and is clipped via scissor. SVG bundle output emits a placeholder rect labelled with the image’s hash.

Fields

§rect: Rect
§scissor: Option<Rect>
§image: Image
§radius: Corners
§

AppTexture

An app-owned GPU texture composited into the paint stream. Unlike DrawOp::Image, the backend does not upload pixels — it samples the existing texture identified by texture during paint, keying its bind-group cache on crate::surface::AppTextureId. rect is the post-fit destination rect; for Cover it can extend past the El’s content area and is clipped via scissor. transform is an affine applied to the textured quad in destination space, around the centre of rect. alpha selects the blend path. SVG bundle output emits a placeholder rect labelled with the texture’s id.

Fields

§rect: Rect
§scissor: Option<Rect>
§texture: AppTexture
§transform: Affine2
§

Vector

An app-supplied vector asset. render_mode decides whether the backend preserves authored paint or treats the asset as a one-colour mask. SVG bundle output emits a placeholder rect labelled with the asset’s hash.

Fields

§rect: Rect
§scissor: Option<Rect>
§render_mode: VectorRenderMode
§

BackdropSnapshot

Mid-frame snapshot of the current target into a sampled texture, scheduled before any backdrop-sampling pass.

Implementations§

Source§

impl DrawOp

Source

pub fn id(&self) -> &str

Source

pub fn shader(&self) -> Option<&ShaderHandle>

Source

pub fn scissor(&self) -> Option<Rect>

Trait Implementations§

Source§

impl Clone for DrawOp

Source§

fn clone(&self) -> DrawOp

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 DrawOp

Source§

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

Formats the value using the given formatter. Read more

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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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.