pub struct SkiaRenderer { /* private fields */ }Expand description
A renderer that produces PNG output via tiny-skia CPU rasterization.
Text is rendered using cosmic-text for shaping/layout and swash for glyph rasterization. The embedded Inter font ensures deterministic rendering across all platforms.
FontSystem is wrapped in RefCell so that measure_text (which receives
&self per the Renderer trait) can still perform shaping.
Implementations§
Source§impl SkiaRenderer
impl SkiaRenderer
Sourcepub fn new(width: u32, height: u32) -> Self
pub fn new(width: u32, height: u32) -> Self
Creates a new renderer with the given dimensions.
Uses the embedded Inter font for deterministic cross-platform text.
§Panics
Panics if width or height is zero, or if the allocation exceeds
platform limits.
Sourcepub fn with_white_background(width: u32, height: u32) -> Self
pub fn with_white_background(width: u32, height: u32) -> Self
Creates a new renderer with the given dimensions and a white background.
Trait Implementations§
Source§impl Renderer for SkiaRenderer
impl Renderer for SkiaRenderer
Source§fn fill_path(&mut self, path: &Path, paint: &Paint, transform: Affine)
fn fill_path(&mut self, path: &Path, paint: &Paint, transform: Affine)
Fills a path with the given paint, under the given transform.
Source§fn stroke_path(
&mut self,
path: &Path,
paint: &Paint,
stroke: &Stroke,
transform: Affine,
)
fn stroke_path( &mut self, path: &Path, paint: &Paint, stroke: &Stroke, transform: Affine, )
Strokes a path with the given paint and stroke style, under the given transform.
Source§fn draw_text(
&mut self,
text: &str,
pos: Point,
style: &TextStyle,
_transform: Affine,
)
fn draw_text( &mut self, text: &str, pos: Point, style: &TextStyle, _transform: Affine, )
Draws text at the given position with the given style, under the given transform.
Source§fn draw_image(&mut self, img: &Image, dst: Rect, transform: Affine)
fn draw_image(&mut self, img: &Image, dst: Rect, transform: Affine)
Draws a raster image into the destination rectangle, under the given transform.
Source§fn push_clip(&mut self, path: &Path, transform: Affine)
fn push_clip(&mut self, path: &Path, transform: Affine)
Pushes a clipping path. All subsequent draws are clipped to this path.
Auto Trait Implementations§
impl !Freeze for SkiaRenderer
impl !RefUnwindSafe for SkiaRenderer
impl !Sync for SkiaRenderer
impl !UnwindSafe for SkiaRenderer
impl Send for SkiaRenderer
impl Unpin for SkiaRenderer
impl UnsafeUnpin for SkiaRenderer
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