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
impl DrawList
Sourcepub fn push(&mut self, cmd: DrawCommand)
pub fn push(&mut self, cmd: DrawCommand)
Append an arbitrary DrawCommand, automatically updating clip depth
and accumulated bounds.
Sourcepub fn iter(&self) -> Iter<'_, DrawCommand>
pub fn iter(&self) -> Iter<'_, DrawCommand>
Iterate over all commands in submission order.
Sourcepub fn bounds(&self) -> Option<Rect>
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.
Sourcepub fn clip_depth(&self) -> usize
pub fn clip_depth(&self) -> usize
Return the current clip-stack depth. Zero means balanced.
Sourcepub fn is_clip_balanced(&self) -> bool
pub fn is_clip_balanced(&self) -> bool
Return true if the clip stack is balanced (depth == 0).
Sourcepub fn push_stroke_rect(&mut self, rect: Rect, thickness: f32, color: Color)
pub fn push_stroke_rect(&mut self, rect: Rect, thickness: f32, color: Color)
Push a stroked rectangle outline.
Sourcepub fn push_rounded_rect(&mut self, rect: Rect, radius: f32, color: Color)
pub fn push_rounded_rect(&mut self, rect: Rect, radius: f32, color: Color)
Push a filled rectangle with uniform corner radius.
Sourcepub fn push_rounded_rect_per_corner(
&mut self,
rect: Rect,
radii: [f32; 4],
color: Color,
)
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].
Sourcepub fn push_circle(&mut self, center: Point, radius: f32, color: Color)
pub fn push_circle(&mut self, center: Point, radius: f32, color: Color)
Push a filled circle.
Sourcepub fn push_ellipse(&mut self, center: Point, rx: f32, ry: f32, color: Color)
pub fn push_ellipse(&mut self, center: Point, rx: f32, ry: f32, color: Color)
Push a filled ellipse.
Sourcepub fn push_line(&mut self, from: Point, to: Point, color: Color)
pub fn push_line(&mut self, from: Point, to: Point, color: Color)
Push a 1-pixel aliased line segment.
Sourcepub fn push_line_aa(&mut self, from: Point, to: Point, color: Color)
pub fn push_line_aa(&mut self, from: Point, to: Point, color: Color)
Push a 1-pixel anti-aliased line segment.
Sourcepub fn push_line_thick(
&mut self,
from: Point,
to: Point,
width: f32,
color: Color,
)
pub fn push_line_thick( &mut self, from: Point, to: Point, width: f32, color: Color, )
Push a thick, filled line segment.
Sourcepub fn push_line_dashed(
&mut self,
from: Point,
to: Point,
dash_len: f32,
gap_len: f32,
color: Color,
)
pub fn push_line_dashed( &mut self, from: Point, to: Point, dash_len: f32, gap_len: f32, color: Color, )
Push a dashed line segment.
Sourcepub fn push_stroke_path(
&mut self,
path: PathData,
style: StrokeStyle,
color: Color,
)
pub fn push_stroke_path( &mut self, path: PathData, style: StrokeStyle, color: Color, )
Push a stroked path.
Sourcepub fn push_gradient_linear(
&mut self,
rect: Rect,
start: Point,
end: Point,
stops: Vec<GradientStop>,
)
pub fn push_gradient_linear( &mut self, rect: Rect, start: Point, end: Point, stops: Vec<GradientStop>, )
Push a linear gradient fill over rect.
Sourcepub fn push_gradient_radial(
&mut self,
rect: Rect,
center: Point,
radius: f32,
stops: Vec<GradientStop>,
)
pub fn push_gradient_radial( &mut self, rect: Rect, center: Point, radius: f32, stops: Vec<GradientStop>, )
Push a radial gradient fill over rect.
Sourcepub fn push_image(&mut self, image: ImageData, dest: Rect, filter: ImageFilter)
pub fn push_image(&mut self, image: ImageData, dest: Rect, filter: ImageFilter)
Push a scaled image blit.
Sourcepub fn push_nine_slice(
&mut self,
image: ImageData,
dest: Rect,
insets: [u32; 4],
)
pub fn push_nine_slice( &mut self, image: ImageData, dest: Rect, insets: [u32; 4], )
Push a 9-slice scaled image.
Sourcepub fn push_shadow(
&mut self,
rect: Rect,
offset: Point,
blur_radius: f32,
color: Color,
)
pub fn push_shadow( &mut self, rect: Rect, offset: Point, blur_radius: f32, color: Color, )
Push a box shadow.
Sourcepub fn push_text(
&mut self,
rect: Rect,
text: impl Into<String>,
font: FontSpec,
color: Color,
)
pub fn push_text( &mut self, rect: Rect, text: impl Into<String>, font: FontSpec, color: Color, )
Push a text draw command.
Sourcepub fn push_blend_mode(&mut self, mode: BlendMode)
pub fn push_blend_mode(&mut self, mode: BlendMode)
Set the blend mode for all subsequent draw commands.
The mode remains active until the next push_blend_mode call.
The initial mode at the start of every frame is BlendMode::Normal.
Sourcepub fn push_backdrop_blur(&mut self, rect: Rect, blur_radius: f32)
pub fn push_backdrop_blur(&mut self, rect: Rect, blur_radius: f32)
Apply a backdrop blur (frosted-glass effect) to the region rect.
Blurs the previously-rendered content behind rect by blur_radius pixels.
Subsequent commands draw on top of the blurred result.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DrawList
impl RefUnwindSafe for DrawList
impl Send for DrawList
impl Sync for DrawList
impl Unpin for DrawList
impl UnsafeUnpin for DrawList
impl UnwindSafe for DrawList
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