pub struct DrawScopeDefault { /* private fields */ }Implementations§
Source§impl DrawScopeDefault
impl DrawScopeDefault
pub fn new(size: Size) -> Self
Sourcepub fn with_text_measurer(
size: Size,
text_measurer: Rc<dyn DrawTextMeasurer>,
) -> Self
pub fn with_text_measurer( size: Size, text_measurer: Rc<dyn DrawTextMeasurer>, ) -> Self
A scope that measures text with the app’s fonts.
The framework calls this for every draw closure it runs; new exists
for callers that never draw text.
Sourcepub fn with_text_measurer_reusing(
size: Size,
text_measurer: Rc<dyn DrawTextMeasurer>,
storage: CommandRecording,
) -> Self
pub fn with_text_measurer_reusing( size: Size, text_measurer: Rc<dyn DrawTextMeasurer>, storage: CommandRecording, ) -> Self
A scope recording into storage, a recording the caller kept from an
earlier frame so its buffers keep the capacity they earned.
Sourcepub fn content_marker_count(&self) -> u32
pub fn content_marker_count(&self) -> u32
How many draw_content markers this scope has recorded.
Sourcepub fn inset(
&mut self,
insets: EdgeInsets,
draw: impl FnOnce(&mut DrawScopeDefault),
)
pub fn inset( &mut self, insets: EdgeInsets, draw: impl FnOnce(&mut DrawScopeDefault), )
Runs draw in this scope’s rect shrunk by insets, where a draw
modifier placed after layout padding draws: draw sees the inner
size, and what it records lands offset by the leading insets.
Sourcepub fn push_recorded(
&mut self,
primitives: impl IntoIterator<Item = DrawPrimitive>,
)
pub fn push_recorded( &mut self, primitives: impl IntoIterator<Item = DrawPrimitive>, )
Records primitives already built, as if each had been drawn here.
Sourcepub fn finish(self) -> CommandRecording
pub fn finish(self) -> CommandRecording
The recording, in the storage it was recorded into, so the caller can lend it to the same command’s next recording.
Trait Implementations§
Source§impl Default for DrawScopeDefault
impl Default for DrawScopeDefault
Source§impl DrawScope for DrawScopeDefault
impl DrawScope for DrawScopeDefault
fn size(&self) -> Size
fn draw_content(&mut self)
fn draw_rect(&mut self, brush: Brush)
fn draw_rect_blend(&mut self, brush: Brush, blend_mode: BlendMode)
Source§fn draw_rect_at(&mut self, rect: Rect, brush: Brush)
fn draw_rect_at(&mut self, rect: Rect, brush: Brush)
Draws a rectangle at the specified position and size.
fn draw_rect_at_blend( &mut self, rect: Rect, brush: Brush, blend_mode: BlendMode, )
fn draw_round_rect(&mut self, brush: Brush, radii: CornerRadii)
fn draw_round_rect_blend( &mut self, brush: Brush, radii: CornerRadii, blend_mode: BlendMode, )
Source§fn draw_round_rect_at(&mut self, rect: Rect, brush: Brush, radii: CornerRadii)
fn draw_round_rect_at(&mut self, rect: Rect, brush: Brush, radii: CornerRadii)
Draws a rounded rectangle at the specified position and size.
Source§fn draw_rect_stroked(&mut self, brush: Brush, stroke: Stroke)
fn draw_rect_stroked(&mut self, brush: Brush, stroke: Stroke)
Strokes the outline of the whole scope rect.
fn draw_rect_stroked_blend( &mut self, brush: Brush, stroke: Stroke, blend_mode: BlendMode, )
Source§fn draw_rect_at_stroked(&mut self, rect: Rect, brush: Brush, stroke: Stroke)
fn draw_rect_at_stroked(&mut self, rect: Rect, brush: Brush, stroke: Stroke)
Strokes the outline of
rect.fn draw_rect_at_stroked_blend( &mut self, rect: Rect, brush: Brush, stroke: Stroke, blend_mode: BlendMode, )
Source§fn draw_round_rect_stroked(
&mut self,
brush: Brush,
radii: CornerRadii,
stroke: Stroke,
)
fn draw_round_rect_stroked( &mut self, brush: Brush, radii: CornerRadii, stroke: Stroke, )
Strokes the outline of the whole scope rect with rounded corners.
fn draw_round_rect_stroked_blend( &mut self, brush: Brush, radii: CornerRadii, stroke: Stroke, blend_mode: BlendMode, )
Source§fn draw_round_rect_at_stroked(
&mut self,
rect: Rect,
brush: Brush,
radii: CornerRadii,
stroke: Stroke,
)
fn draw_round_rect_at_stroked( &mut self, rect: Rect, brush: Brush, radii: CornerRadii, stroke: Stroke, )
Strokes the outline of
rect with rounded corners.fn draw_round_rect_at_stroked_blend( &mut self, rect: Rect, brush: Brush, radii: CornerRadii, stroke: Stroke, blend_mode: BlendMode, )
Source§fn draw_circle_stroked(
&mut self,
brush: Brush,
center: Point,
radius: f32,
stroke: Stroke,
)
fn draw_circle_stroked( &mut self, brush: Brush, center: Point, radius: f32, stroke: Stroke, )
Strokes a circle outline. Lowers to a stroked rounded rect, so it shares
the fill pipeline and batches with every other shape.
fn draw_circle_stroked_blend( &mut self, brush: Brush, center: Point, radius: f32, stroke: Stroke, blend_mode: BlendMode, )
Source§fn draw_arc(
&mut self,
brush: Brush,
center: Point,
radius: f32,
start_angle: f32,
sweep_angle: f32,
stroke: Stroke,
)
fn draw_arc( &mut self, brush: Brush, center: Point, radius: f32, start_angle: f32, sweep_angle: f32, stroke: Stroke, )
Strokes a circular arc. Read more
fn draw_arc_blend( &mut self, brush: Brush, center: Point, radius: f32, start_angle: f32, sweep_angle: f32, stroke: Stroke, blend_mode: BlendMode, )
Source§fn draw_line(&mut self, brush: Brush, start: Point, end: Point, stroke: Stroke)
fn draw_line(&mut self, brush: Brush, start: Point, end: Point, stroke: Stroke)
Strokes the straight segment from
start to end, centred on it and
stroke.width wide, its ends shaped by stroke.cap: Compose’s
drawLine(brush, start, end, strokeWidth, cap). Nothing is drawn
for a non-positive width, a non-finite end, or a segment of no length
between butt caps; round and square caps draw a dot there.fn draw_line_blend( &mut self, brush: Brush, start: Point, end: Point, stroke: Stroke, blend_mode: BlendMode, )
Source§fn draw_path(&mut self, path: &Path, brush: Brush, style: DrawStyle)
fn draw_path(&mut self, path: &Path, brush: Brush, style: DrawStyle)
Fills or strokes
path with brush: Compose’s
drawPath(path, brush, style). A fill closes every contour and
rasterizes it as draw_vector_path does. A
stroke draws each flattened edge as a line on the GPU, capped at an
open contour’s ends and joined at its corners as
crate::for_each_stroke_line describes; a dashed stroke draws the
dashes its effect cuts. Where edges meet, a translucent stroke is
painted twice.fn draw_path_blend( &mut self, path: &Path, brush: Brush, style: DrawStyle, blend_mode: BlendMode, )
Source§fn draw_annular_sector(
&mut self,
brush: Brush,
center: Point,
inner_radius: f32,
outer_radius: f32,
start_angle: f32,
sweep_angle: f32,
)
fn draw_annular_sector( &mut self, brush: Brush, center: Point, inner_radius: f32, outer_radius: f32, start_angle: f32, sweep_angle: f32, )
Fills an annular sector — the region between
inner_radius and
outer_radius, limited to an angular sweep, with flat radial ends. Read morefn draw_annular_sector_blend( &mut self, brush: Brush, center: Point, inner_radius: f32, outer_radius: f32, start_angle: f32, sweep_angle: f32, blend_mode: BlendMode, )
fn draw_circle(&mut self, brush: Brush, center: Point, radius: f32)
fn draw_circle_blend( &mut self, brush: Brush, center: Point, radius: f32, blend_mode: BlendMode, )
fn draw_image(&mut self, image: ImageBitmap)
fn draw_image_blend(&mut self, image: ImageBitmap, blend_mode: BlendMode)
fn draw_image_at( &mut self, rect: Rect, image: ImageBitmap, alpha: f32, color_filter: Option<ColorFilter>, )
fn draw_image_at_sampled( &mut self, rect: Rect, image: ImageBitmap, alpha: f32, color_filter: Option<ColorFilter>, sampling: ImageSampling, )
fn draw_image_at_blend( &mut self, rect: Rect, image: ImageBitmap, alpha: f32, color_filter: Option<ColorFilter>, blend_mode: BlendMode, )
Source§fn draw_image_src(
&mut self,
image: ImageBitmap,
src_rect: Rect,
dst_rect: Rect,
alpha: f32,
color_filter: Option<ColorFilter>,
)
fn draw_image_src( &mut self, image: ImageBitmap, src_rect: Rect, dst_rect: Rect, alpha: f32, color_filter: Option<ColorFilter>, )
Draws a sub-region of an image.
src_rect is in image-pixel
coordinates; dst_rect is in scope coordinates.fn draw_image_src_sampled( &mut self, image: ImageBitmap, src_rect: Rect, dst_rect: Rect, alpha: f32, color_filter: Option<ColorFilter>, sampling: ImageSampling, )
fn draw_image_src_blend( &mut self, image: ImageBitmap, src_rect: Rect, dst_rect: Rect, alpha: f32, color_filter: Option<ColorFilter>, blend_mode: BlendMode, )
Source§fn draw_vector_path(&mut self, path: &VectorPath, brush: Brush)
fn draw_vector_path(&mut self, path: &VectorPath, brush: Brush)
Fills a parsed SVG path in scope coordinates (path units are dp). Read more
Source§fn measure_text(&self, text: &str, style: &DrawTextStyle) -> TextMeasurement
fn measure_text(&self, text: &str, style: &DrawTextStyle) -> TextMeasurement
Source§fn draw_text_at(
&mut self,
rect: Rect,
brush: Brush,
text: &str,
style: &DrawTextStyle,
)
fn draw_text_at( &mut self, rect: Rect, brush: Brush, text: &str, style: &DrawTextStyle, )
Draws
text inside rect, positioned by DrawTextStyle::align and
DrawTextStyle::vertical_align. Read morefn into_primitives(self) -> Vec<DrawPrimitive>
Source§fn draw_svg_path(&mut self, d: &str, brush: Brush)
fn draw_svg_path(&mut self, d: &str, brush: Brush)
Parses SVG path data (the
d attribute syntax: M/m L/l H/h V/v C/c S/s Q/q T/t A/a Z/z) and fills it. Invalid path data draws
nothing. Prefer crate::VectorPath::parse +
draw_vector_path to avoid re-parsing
and to surface parse errors.Source§fn draw_text(&mut self, brush: Brush, text: &str, style: &DrawTextStyle)
fn draw_text(&mut self, brush: Brush, text: &str, style: &DrawTextStyle)
Draws
text inside the whole scope rect, positioned by
DrawTextStyle::align and DrawTextStyle::vertical_align.Source§fn draw_text_from(
&mut self,
top_left: Point,
brush: Brush,
text: &str,
style: &DrawTextStyle,
)
fn draw_text_from( &mut self, top_left: Point, brush: Brush, text: &str, style: &DrawTextStyle, )
Auto Trait Implementations§
impl !Freeze for DrawScopeDefault
impl !RefUnwindSafe for DrawScopeDefault
impl !Send for DrawScopeDefault
impl !Sync for DrawScopeDefault
impl !UnwindSafe for DrawScopeDefault
impl Unpin for DrawScopeDefault
impl UnsafeUnpin for DrawScopeDefault
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
Mutably borrows from an owned value. Read more