pub struct Recorder<'a> { /* private fields */ }Expand description
Renderer adapter that records structured AA draws into a
CommandList. Unstructured ops (draw_text, draw_pixels) and
blend_row forward immediately to a passthrough renderer rather
than recording — see module docs for the lifetime/alloc rationale.
Typical usage:
ⓘ
let mut list = CommandList::new();
{
let mut sink = NullRenderer::default(); // or any "do nothing" renderer
let mut recorder = Recorder::new(&mut list, &mut sink);
widget.draw(&mut recorder);
}
// list now contains the structured drawsImplementations§
Trait Implementations§
Source§impl Renderer for Recorder<'_>
impl Renderer for Recorder<'_>
Source§fn fill_rect(&mut self, rect: Rect, color: Color)
fn fill_rect(&mut self, rect: Rect, color: Color)
Fill the given rectangle with a solid color.
Source§fn blend_rect(&mut self, rect: Rect, color: Color)
fn blend_rect(&mut self, rect: Rect, color: Color)
Blend a rectangle onto the target, honoring the alpha channel of
color
for source-over compositing. Read moreSource§fn fill_obb_aa(&mut self, obb: Obb, color: Color)
fn fill_obb_aa(&mut self, obb: Obb, color: Color)
Fill an oriented bounding box with anti-aliased coverage. Read more
Source§fn fill_disc_aa(&mut self, center: PointF, radius: f32, color: Color)
fn fill_disc_aa(&mut self, center: PointF, radius: f32, color: Color)
Fill a disc (filled circle) with anti-aliased coverage at the
boundary. Sub-pixel center; sqrt is restricted to the 1-pixel AA
ring so the inner-area fast-path stays integer-arithmetic only. Read more
Source§fn fill_arc_aa(
&mut self,
center: PointF,
r_outer: f32,
r_inner: f32,
start_cos: f32,
start_sin: f32,
end_cos: f32,
end_sin: f32,
extent: f32,
color: Color,
)
fn fill_arc_aa( &mut self, center: PointF, r_outer: f32, r_inner: f32, start_cos: f32, start_sin: f32, end_cos: f32, end_sin: f32, extent: f32, color: Color, )
Fill an annular arc / pie slice with anti-aliased coverage.
See
raster::rasterize_arc for the angle convention; in short,
(start_cos, start_sin) and (end_cos, end_sin) are pre-computed
boundary-ray unit vectors and extent is the signed angular
magnitude. r_inner = 0.0 produces a pie slice; r_inner > 0.0
produces a ring segment. Read moreSource§fn stroke_line_aa(&mut self, a: PointF, b: PointF, width: f32, color: Color)
fn stroke_line_aa(&mut self, a: PointF, b: PointF, width: f32, color: Color)
Stroke a line between
a and b with given width, anti-aliased.
Endpoints are square-cut; see raster::rasterize_line. Read moreSource§fn draw_text(&mut self, position: (i32, i32), text: &str, color: Color)
fn draw_text(&mut self, position: (i32, i32), text: &str, color: Color)
Draw UTF‑8 text with its baseline anchored at the provided position using the color.
Source§fn draw_pixels(
&mut self,
position: (i32, i32),
pixels: &[Color],
width: u32,
height: u32,
)
fn draw_pixels( &mut self, position: (i32, i32), pixels: &[Color], width: u32, height: u32, )
Blit a buffer of pixels to the target at the given position. Read more
Source§fn blend_row(&mut self, x: i32, y: i32, color: Color, coverage: &[u8])
fn blend_row(&mut self, x: i32, y: i32, color: Color, coverage: &[u8])
Blend a horizontal run of pixels with per-pixel anti-aliased coverage. Read more
Source§fn draw_text_shaped(
&mut self,
shaped: &ShapedText<'_>,
origin: (i32, i32),
color: Color,
)
fn draw_text_shaped( &mut self, shaped: &ShapedText<'_>, origin: (i32, i32), color: Color, )
Draw a pre-shaped text run using glyph extent information. Read more
Source§fn draw_glyph(
&mut self,
font: &dyn FontMetrics,
ch: char,
origin: (i32, i32),
color: Color,
)
fn draw_glyph( &mut self, font: &dyn FontMetrics, ch: char, origin: (i32, i32), color: Color, )
Source§fn blit_image(
&mut self,
dest: Rect,
descriptor: &ImageDescriptor<'_>,
opts: &BlitOpts,
)
fn blit_image( &mut self, dest: Rect, descriptor: &ImageDescriptor<'_>, opts: &BlitOpts, )
Source§fn fill_gradient(&mut self, rect: Rect, gradient: &GradientDesc<'_>)
fn fill_gradient(&mut self, rect: Rect, gradient: &GradientDesc<'_>)
Fill
rect with a deterministic software gradient. Read moreSource§fn draw_shadow(&mut self, rect: Rect, radius: u8, shadow: &ShadowDesc)
fn draw_shadow(&mut self, rect: Rect, radius: u8, shadow: &ShadowDesc)
Draw a deterministic software box shadow below
rect. Read moreSource§fn submit(&mut self, list: &CommandList)
fn submit(&mut self, list: &CommandList)
Execute a captured
CommandList against this renderer. Read moreAuto Trait Implementations§
impl<'a> !RefUnwindSafe for Recorder<'a>
impl<'a> !Send for Recorder<'a>
impl<'a> !Sync for Recorder<'a>
impl<'a> !UnwindSafe for Recorder<'a>
impl<'a> Freeze for Recorder<'a>
impl<'a> Unpin for Recorder<'a>
impl<'a> UnsafeUnpin for Recorder<'a>
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
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
Source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
Source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
Source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
Source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.