Skip to main content

DrawList

Struct DrawList 

Source
pub struct DrawList { /* private fields */ }
Expand description

An ordered buffer of DrawCommands, with integrated clip-stack and bounds tracking.

Build a list with the typed push_* helpers (or the low-level push) then pass it to a RenderBackend::execute call.

Implementations§

Source§

impl DrawList

Source

pub fn new() -> Self

Construct an empty DrawList.

Source

pub fn push(&mut self, cmd: DrawCommand)

Append an arbitrary DrawCommand, automatically updating clip depth and accumulated bounds.

Source

pub fn len(&self) -> usize

Return the number of commands in the list.

Source

pub fn is_empty(&self) -> bool

Return true if the list contains no commands.

Source

pub fn iter(&self) -> Iter<'_, DrawCommand>

Iterate over all commands in submission order.

Source

pub fn clear(&mut self)

Remove all commands and reset clip depth and bounds.

Source

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

Return the accumulated axis-aligned bounding box of all non-clip draw commands, or None if no draw commands have been pushed.

Source

pub fn clip_depth(&self) -> usize

Return the current clip-stack depth. Zero means balanced.

Source

pub fn is_clip_balanced(&self) -> bool

Return true if the clip stack is balanced (depth == 0).

Source

pub fn push_rect(&mut self, rect: Rect, color: Color)

Push a solid-filled rectangle.

Source

pub fn push_stroke_rect(&mut self, rect: Rect, thickness: f32, color: Color)

Push a stroked rectangle outline.

Source

pub fn push_rounded_rect(&mut self, rect: Rect, radius: f32, color: Color)

Push a filled rectangle with uniform corner radius.

Source

pub fn push_rounded_rect_per_corner( &mut self, rect: Rect, radii: [f32; 4], color: Color, )

Push a filled rectangle with per-corner radii [tl, tr, br, bl].

Source

pub fn push_circle(&mut self, center: Point, radius: f32, color: Color)

Push a filled circle.

Source

pub fn push_ellipse(&mut self, center: Point, rx: f32, ry: f32, color: Color)

Push a filled ellipse.

Source

pub fn push_line(&mut self, from: Point, to: Point, color: Color)

Push a 1-pixel aliased line segment.

Source

pub fn push_line_aa(&mut self, from: Point, to: Point, color: Color)

Push a 1-pixel anti-aliased line segment.

Source

pub fn push_line_thick( &mut self, from: Point, to: Point, width: f32, color: Color, )

Push a thick, filled line segment.

Source

pub fn push_line_dashed( &mut self, from: Point, to: Point, dash_len: f32, gap_len: f32, color: Color, )

Push a dashed line segment.

Source

pub fn push_clip(&mut self, rect: Rect)

Push a clip rectangle onto the clip stack.

Source

pub fn pop_clip(&mut self)

Pop the top clip rectangle from the clip stack.

Source

pub fn push_path(&mut self, path: PathData, color: Color)

Push a solid-filled path.

Source

pub fn push_stroke_path( &mut self, path: PathData, style: StrokeStyle, color: Color, )

Push a stroked path.

Source

pub fn push_gradient_linear( &mut self, rect: Rect, start: Point, end: Point, stops: Vec<GradientStop>, )

Push a linear gradient fill over rect.

Source

pub fn push_gradient_radial( &mut self, rect: Rect, center: Point, radius: f32, stops: Vec<GradientStop>, )

Push a radial gradient fill over rect.

Source

pub fn push_image(&mut self, image: ImageData, dest: Rect, filter: ImageFilter)

Push a scaled image blit.

Source

pub fn push_nine_slice( &mut self, image: ImageData, dest: Rect, insets: [u32; 4], )

Push a 9-slice scaled image.

Source

pub fn push_shadow( &mut self, rect: Rect, offset: Point, blur_radius: f32, color: Color, )

Push a box shadow.

Source

pub fn push_text( &mut self, rect: Rect, text: impl Into<String>, font: FontSpec, color: Color, )

Push a text draw command.

Trait Implementations§

Source§

impl Clone for DrawList

Source§

fn clone(&self) -> DrawList

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 DrawList

Source§

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

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

impl Default for DrawList

Source§

fn default() -> DrawList

Returns the “default value” for a type. 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> 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.