Skip to main content

Recorder

Struct Recorder 

Source
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 draws

Implementations§

Source§

impl<'a> Recorder<'a>

Source

pub fn new(list: &'a mut CommandList, passthrough: &'a mut dyn Renderer) -> Self

Create a recorder writing structured draws into list and forwarding unstructured ops to passthrough.

Trait Implementations§

Source§

impl Renderer for Recorder<'_>

Source§

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)

Blend a rectangle onto the target, honoring the alpha channel of color for source-over compositing. Read more
Source§

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)

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, )

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 more
Source§

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 more
Source§

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, )

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])

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, )

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, )

Draw a single glyph’s coverage with its pen origin on the baseline at origin (the same anchor convention as draw_text). Read more
Source§

fn blit_image( &mut self, dest: Rect, descriptor: &ImageDescriptor<'_>, opts: &BlitOpts, )

Blit an ImageDescriptor into dest using deterministic software sampling. Read more
Source§

fn fill_masked(&mut self, rect: Rect, color: Color, mask: &dyn AlphaMask)

Fill rect with color modulated by an alpha mask. Read more
Source§

fn fill_gradient(&mut self, rect: Rect, gradient: &GradientDesc<'_>)

Fill rect with a deterministic software gradient. Read more
Source§

fn draw_shadow(&mut self, rect: Rect, radius: u8, shadow: &ShadowDesc)

Draw a deterministic software box shadow below rect. Read more
Source§

fn submit(&mut self, list: &CommandList)

Execute a captured CommandList against this renderer. Read more

Auto 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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.