pub struct DrawContext { /* private fields */ }Expand description
A batched immediate drawing command recorder.
Application code normally receives this from CustomDrawable or
Bitmap::canvas, rather than constructing
it directly.
Implementations§
Source§impl DrawContext
impl DrawContext
Sourcepub fn flush(&self)
pub fn flush(&self)
Sends the current ordered command batch to the active host canvas.
Normal CustomDrawable callbacks are flushed automatically.
Sourcepub fn clip_rect(&self, x: f32, y: f32, w: f32, h: f32)
pub fn clip_rect(&self, x: f32, y: f32, w: f32, h: f32)
Intersects the current clip with an axis-aligned rectangle.
Sourcepub fn clip_round_rect(
&self,
x: f32,
y: f32,
w: f32,
h: f32,
tl: f32,
tr: f32,
br: f32,
bl: f32,
)
pub fn clip_round_rect( &self, x: f32, y: f32, w: f32, h: f32, tl: f32, tr: f32, br: f32, bl: f32, )
Intersects the current clip with a per-corner rounded rectangle.
Sourcepub fn draw_line(
&self,
x1: f32,
y1: f32,
x2: f32,
y2: f32,
color: u32,
stroke_width: f32,
)
pub fn draw_line( &self, x1: f32, y1: f32, x2: f32, y2: f32, color: u32, stroke_width: f32, )
Draws a line segment.
Sourcepub fn draw_round_rect(
&self,
x: f32,
y: f32,
w: f32,
h: f32,
rx: f32,
ry: f32,
paint: Paint,
)
pub fn draw_round_rect( &self, x: f32, y: f32, w: f32, h: f32, rx: f32, ry: f32, paint: Paint, )
Draws a rounded rectangle.
Sourcepub fn draw_path(&self, path: &Path, paint: Paint)
pub fn draw_path(&self, path: &Path, paint: Paint)
Draws a retained path and keeps it alive through the current batch.
Sourcepub fn draw_text_node<T: Node>(&self, node: &T, x: f32, y: f32)
pub fn draw_text_node<T: Node>(&self, node: &T, x: f32, y: f32)
Draws a built retained text node at logical coordinates.
Sourcepub fn draw_text_layout(&self, layout: &TextLayout, x: f32, y: f32)
pub fn draw_text_layout(&self, layout: &TextLayout, x: f32, y: f32)
Draws a ready retained text layout.
Sourcepub fn draw_dynamic_text_layout(
&self,
layout: &DynamicTextLayout,
x: f32,
y: f32,
)
pub fn draw_dynamic_text_layout( &self, layout: &DynamicTextLayout, x: f32, y: f32, )
Draws a ready frequently-changing fixed-charset text layout.
Sourcepub fn draw_image(&self, texture_id: u32, x: f32, y: f32, w: f32, h: f32)
pub fn draw_image(&self, texture_id: u32, x: f32, y: f32, w: f32, h: f32)
Draws a texture with default linear sampling.
Sourcepub fn draw_image_sampling(
&self,
texture_id: u32,
x: f32,
y: f32,
w: f32,
h: f32,
sampling: ImageSampling,
)
pub fn draw_image_sampling( &self, texture_id: u32, x: f32, y: f32, w: f32, h: f32, sampling: ImageSampling, )
Draws a texture with explicit sampling policy.
Trait Implementations§
Source§impl Clone for DrawContext
impl Clone for DrawContext
Source§fn clone(&self) -> DrawContext
fn clone(&self) -> DrawContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more