Skip to main content

DrawCommand

Enum DrawCommand 

Source
pub enum DrawCommand {
Show 30 variants DrawRect { bounds: Rect, color: Color, }, DrawRoundedRect { bounds: Rect, color: Color, border_radius: BorderRadius, border_width: EdgeInsets<f32>, border_color: Option<Color>, }, DrawShadow { bounds: Rect, shadow: BoxShadow, border_radius: BorderRadius, }, DrawInsetShadow { bounds: Rect, shadow: BoxShadow, border_radius: BorderRadius, }, DrawLinearGradient { bounds: Rect, angle_deg: f32, stops: Vec<ColorStop>, border_radius: BorderRadius, }, DrawRadialGradient { bounds: Rect, center: (f32, f32), stops: Vec<ColorStop>, border_radius: BorderRadius, }, PushBackdropFilter { bounds: Rect, radius: BorderRadius, filter: BackdropFilter, }, PopBackdropFilter, PushFilter { bounds: Rect, filter: BackdropFilter, }, PopFilter, PushClipPath { bounds: Rect, clip_path: ClipPath, }, PopClipPath, PushBlendMode { mode: BlendMode, }, PopBlendMode, PushIsolation { isolate: bool, }, PopIsolation, PushOpacity { alpha: f32, }, PopOpacity, DrawBorder { bounds: Rect, widths: EdgeInsets<f32>, color: Color, border_radius: BorderRadius, style: BorderStyle, }, DrawText { origin: (f32, f32), bounds_width: Option<f32>, bounds_height: Option<f32>, text_align: TextAlign, text: String, font_size: f32, line_height: f32, font_weight: FontWeight, color: Color, is_monospace: bool, font_family: AtomId, }, DrawTextFragments { fragments: Vec<TextFragment>, }, DrawViewport3D { bounds: Rect, scene: Arc<Scene3D>, }, DrawCanvas2D { bounds: Rect, commands: Vec<CanvasCommand>, }, DrawSvgPath { bounds: Rect, path_data: String, stroke_color: Option<Color>, fill_color: Option<Color>, stroke_width: f32, stroke_linecap: StrokeLineCap, stroke_linejoin: StrokeLineJoin, stroke_dasharray: Vec<f32>, fill_rule: FillRule, view_box: (f32, f32), }, DrawGpuPath { bounds: Rect, path: Path, stroke: Option<StrokeOptions>, fill_color: Option<Color>, stroke_color: Option<Color>, transform: Option<Matrix4x4>, }, DrawImage { bounds: Rect, image: ImageResource, }, PushClip { bounds: Rect, radius: BorderRadius, }, PopClip, PushTransform { matrix: Matrix4x4, }, PopTransform,
}
Expand description

Low-level drawing primitives emitted to GPU command buffers.

Variants§

§

DrawRect

Fields

§bounds: Rect
§color: Color
§

DrawRoundedRect

Fields

§bounds: Rect
§color: Color
§border_radius: BorderRadius
§border_width: EdgeInsets<f32>
§border_color: Option<Color>
§

DrawShadow

Fields

§bounds: Rect
§shadow: BoxShadow
§border_radius: BorderRadius
§

DrawInsetShadow

Fields

§bounds: Rect
§shadow: BoxShadow
§border_radius: BorderRadius
§

DrawLinearGradient

Fields

§bounds: Rect
§angle_deg: f32
§border_radius: BorderRadius
§

DrawRadialGradient

Fields

§bounds: Rect
§center: (f32, f32)
§border_radius: BorderRadius
§

PushBackdropFilter

Fields

§bounds: Rect
§

PopBackdropFilter

§

PushFilter

Fields

§bounds: Rect
§

PopFilter

§

PushClipPath

Fields

§bounds: Rect
§clip_path: ClipPath
§

PopClipPath

§

PushBlendMode

Fields

§

PopBlendMode

§

PushIsolation

Fields

§isolate: bool
§

PopIsolation

§

PushOpacity

Fields

§alpha: f32
§

PopOpacity

§

DrawBorder

Fields

§bounds: Rect
§widths: EdgeInsets<f32>
§color: Color
§border_radius: BorderRadius
§

DrawText

Fields

§origin: (f32, f32)
§bounds_width: Option<f32>
§bounds_height: Option<f32>
§text_align: TextAlign
§text: String
§font_size: f32
§line_height: f32
§font_weight: FontWeight
§color: Color
§is_monospace: bool
§font_family: AtomId
§

DrawTextFragments

Fields

§fragments: Vec<TextFragment>
§

DrawViewport3D

Fields

§bounds: Rect
§scene: Arc<Scene3D>
§

DrawCanvas2D

Fields

§bounds: Rect
§commands: Vec<CanvasCommand>
§

DrawSvgPath

Fields

§bounds: Rect
§path_data: String
§stroke_color: Option<Color>
§fill_color: Option<Color>
§stroke_width: f32
§stroke_linecap: StrokeLineCap
§stroke_linejoin: StrokeLineJoin
§stroke_dasharray: Vec<f32>
§fill_rule: FillRule
§view_box: (f32, f32)
§

DrawGpuPath

Fields

§bounds: Rect
§path: Path
§fill_color: Option<Color>
§stroke_color: Option<Color>
§transform: Option<Matrix4x4>
§

DrawImage

Fields

§bounds: Rect
§

PushClip

Fields

§bounds: Rect
§

PopClip

§

PushTransform

Fields

§matrix: Matrix4x4
§

PopTransform

Implementations§

Source§

impl DrawCommand

Source

pub fn is_clip(&self) -> bool

Returns true if this command is a clipping push or pop instruction.

Source

pub fn is_state_command(&self) -> bool

Returns true if this command mutates the render stack (push or pop).

Stack commands must never be spatially culled, otherwise a pop would be executed without its matching push (for example a Cairo group pop with no group to pop).

Source

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

Returns the bounding rectangle for this drawing command, if applicable.

Trait Implementations§

Source§

impl Clone for DrawCommand

Source§

fn clone(&self) -> Self

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 DrawCommand

Source§

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

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

impl PartialEq for DrawCommand

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for DrawCommand

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

Source§

fn downcast(&self) -> &T

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,