pub struct CpuBackend { /* private fields */ }Expand description
CPU-based rendering backend.
Wraps a tiny-skia Pixmap and implements RenderBackend using
software rasterization. Zero GPU dependencies.
Implementations§
Source§impl CpuBackend
impl CpuBackend
Sourcepub fn new(logical_w: u32, logical_h: u32, scale: f32) -> Option<Self>
pub fn new(logical_w: u32, logical_h: u32, scale: f32) -> Option<Self>
Create a new CPU backend.
logical_w / logical_h are in logical points; scale is the
display scale factor (2.0 on Retina, 1.0 otherwise). The
internal pixmap is sized at logical × scale physical pixels.
Trait Implementations§
Source§impl RenderBackend for CpuBackend
All RenderBackend methods accept coordinates in logical
points. The backend multiplies by self.scale before handing
off to tiny-skia, so the pixmap is rasterized at physical-pixel
density.
impl RenderBackend for CpuBackend
All RenderBackend methods accept coordinates in logical
points. The backend multiplies by self.scale before handing
off to tiny-skia, so the pixmap is rasterized at physical-pixel
density.
Source§fn stroke_circle(
&mut self,
cx: f32,
cy: f32,
radius: f32,
color: Color,
width: f32,
)
fn stroke_circle( &mut self, cx: f32, cy: f32, radius: f32, color: Color, width: f32, )
Stroke a circle outline.
Source§fn stroke_arc(
&mut self,
cx: f32,
cy: f32,
radius: f32,
start_angle: f32,
end_angle: f32,
color: Color,
width: f32,
)
fn stroke_arc( &mut self, cx: f32, cy: f32, radius: f32, start_angle: f32, end_angle: f32, color: Color, width: f32, )
Stroke an arc (portion of a circle).
Source§fn draw_line(
&mut self,
x1: f32,
y1: f32,
x2: f32,
y2: f32,
color: Color,
width: f32,
)
fn draw_line( &mut self, x1: f32, y1: f32, x2: f32, y2: f32, color: Color, width: f32, )
Draw a line between two points.
Source§fn draw_text(&mut self, text: &str, x: f32, y: f32, size: f32, color: Color)
fn draw_text(&mut self, text: &str, x: f32, y: f32, size: f32, color: Color)
Draw text using the embedded TrueType font (fontdue).
Source§fn text_width(&self, text: &str, size: f32) -> f32
fn text_width(&self, text: &str, size: f32) -> f32
Measure the width of a text string in logical points, at the
given logical-point font size.
Source§fn register_image(&mut self, rgba: &[u8], width: u32, height: u32) -> ImageId
fn register_image(&mut self, rgba: &[u8], width: u32, height: u32) -> ImageId
Register an RGBA8 image (premultiplied alpha, row-major, tightly packed). Read more
Source§fn unregister_image(&mut self, id: ImageId)
fn unregister_image(&mut self, id: ImageId)
Remove a previously-registered image. No-op if the id is invalid
or already unregistered.
Auto Trait Implementations§
impl Freeze for CpuBackend
impl RefUnwindSafe for CpuBackend
impl Send for CpuBackend
impl Sync for CpuBackend
impl Unpin for CpuBackend
impl UnsafeUnpin for CpuBackend
impl UnwindSafe for CpuBackend
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