| Crates.io | skia-rs-canvas |
| lib.rs | skia-rs-canvas |
| version | 0.2.0 |
| created_at | 2026-01-02 20:27:23.082992+00 |
| updated_at | 2026-01-03 18:46:29.715146+00 |
| description | Canvas, surface, and recording for skia-rs |
| homepage | https://github.com/pegasusheavy/skia-rs |
| repository | https://github.com/pegasusheavy/skia-rs |
| max_upload_size | |
| id | 2019165 |
| size | 202,457 |
Canvas, surface, and recording for skia-rs, a pure Rust implementation of the Skia 2D graphics library.
use skia_rs_canvas::Surface;
use skia_rs_core::{Color, Rect, Point};
use skia_rs_paint::Paint;
// Create a surface
let mut surface = Surface::new_raster_n32_premul(800, 600).unwrap();
let canvas = surface.canvas();
// Clear background
canvas.clear(Color::WHITE);
// Draw shapes
let paint = Paint::new();
canvas.draw_rect(&Rect::from_xywh(10.0, 10.0, 100.0, 50.0), &paint);
canvas.draw_circle(Point::new(200.0, 100.0), 50.0, &paint);
// Save and restore state
canvas.save();
canvas.translate(100.0, 100.0);
canvas.rotate(45.0);
canvas.draw_rect(&rect, &paint);
canvas.restore();
MIT OR Apache-2.0
See the main repository for more information.