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: Vec<DrawPrimitive>,
) -> Self
pub fn with_text_measurer_reusing( size: Size, text_measurer: Rc<dyn DrawTextMeasurer>, storage: Vec<DrawPrimitive>, ) -> Self
Like with_text_measurer, but records
into storage the caller already owns. This is the retained-recording
path: a command that re-records every frame keeps one buffer whose
capacity was earned on earlier frames, instead of walking a fresh
vector through the whole doubling schedule again.
Sourcepub fn with_recording(
size: Size,
text_measurer: Option<Rc<dyn DrawTextMeasurer>>,
recording: CommandRecording,
out: Vec<DrawPrimitive>,
) -> Self
pub fn with_recording( size: Size, text_measurer: Option<Rc<dyn DrawTextMeasurer>>, recording: CommandRecording, out: Vec<DrawPrimitive>, ) -> Self
The full retained-recording form: compact recording buffers AND the materialization target both come from the caller, so a command that re-records every frame allocates nothing in the steady state.
Sourcepub fn content_marker_count(&self) -> u32
pub fn content_marker_count(&self) -> u32
How many DrawPrimitive::Content markers this scope has recorded.
Command consumers split placements around the count instead of
re-scanning thousands of just-recorded primitives to learn “none”.
Sourcepub fn recorded(&self) -> &CommandRecording
pub fn recorded(&self) -> &CommandRecording
The compact recording as recorded so far. Retention verification reads this before materialization decides what to skip.
Sourcepub fn push_recorded(&mut self, primitives: Vec<DrawPrimitive>)
pub fn push_recorded(&mut self, primitives: Vec<DrawPrimitive>)
Appends already-recorded primitives verbatim. This is the replay path for pre-built primitive lists (deferred modifier draws recorded earlier, synthesized commands in tests); the marker count stays authoritative because the batch is scanned once on the way in.
Sourcepub fn finish(self) -> FinishedRecording
pub fn finish(self) -> FinishedRecording
Materializes the recording into the out storage and hands both
back, plus the compact buffers for the caller to retain. This — not
recording — is where solid records become DrawPrimitives and where
arc bands, tight bounds, and the degeneracy drop happen, so the
output is exactly what recording used to produce directly.
Sourcepub fn finish_replay(
self,
center: Point,
outcome: ReplayOutcome,
bypass: &mut dyn FnMut(u32) -> bool,
) -> (FinishedRecording, Option<CommandReplayFrame>)
pub fn finish_replay( self, center: Point, outcome: ReplayOutcome, bypass: &mut dyn FnMut(u32) -> bool, ) -> (FinishedRecording, Option<CommandReplayFrame>)
Like Self::finish, but for a verified command: a retained span
whose slot bypass approves is NOT materialized — its records cease
to exist as per-frame primitives, which is the entire point of
retention — and the replay frame comes back with primitive ranges
assigned during the same single tape walk. Every other span
materializes exactly as Self::finish would. AllDynamic
degenerates to plain finish.
Trait Implementations§
Source§impl Default for DrawScopeDefault
impl Default for DrawScopeDefault
Source§fn default() -> DrawScopeDefault
fn default() -> 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)
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)
Source§fn draw_rect_stroked(&mut self, brush: Brush, stroke: Stroke)
fn draw_rect_stroked(&mut self, brush: Brush, stroke: Stroke)
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)
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, )
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, )
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, )
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, )
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_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, )
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>, )
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)
Source§fn measure_text(&self, text: &str, style: &TextStyle) -> TextMeasurement
fn measure_text(&self, text: &str, style: &TextStyle) -> TextMeasurement
fn 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)
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: &TextStyle)
fn draw_text(&mut self, brush: Brush, text: &str, style: &TextStyle)
text inside the whole scope rect, positioned by
TextStyle::align and TextStyle::vertical_align.