Expand description
§skia-rs
A pure Rust implementation of Google’s Skia 2D graphics library.
This crate provides a comprehensive 2D graphics API for rendering shapes, images, text, and more. It is designed to be a drop-in replacement for the original Skia library while providing a safe, idiomatic Rust API.
§Quick Start
use skia_rs::prelude::*;
// Create a surface to draw on
let mut surface = Surface::new_raster_n32_premul(800, 600).unwrap();
let mut canvas = surface.canvas();
// Create a paint for styling
let mut paint = Paint::default();
paint.set_color(Color::RED.into());
paint.set_anti_alias(true);
// Draw a circle
canvas.draw_circle(Point::new(400.0, 300.0), 100.0, &paint);§Feature Flags
This crate uses feature flags to control which components are included:
- default =
["std", "codec", "svg"]- Standard features for most use cases - std - Standard library support (disable for
no_stdenvironments) - serde - Serialization support via serde
§Image Codecs
- codec - Base image codec support
- codec-png - PNG encoding/decoding
- codec-jpeg - JPEG encoding/decoding
- codec-webp - WebP encoding/decoding
- codec-gif - GIF decoding
- codec-avif - AVIF encoding/decoding
- codec-raw - RAW image processing
- codec-all - All image codecs
§Specialized Modules
- svg - SVG parsing and rendering
- pdf - PDF document generation
- text - Advanced text rendering and shaping
- skottie - Lottie animation support
§GPU Backends
- gpu - Base GPU support
- vulkan - Vulkan backend
- opengl - OpenGL backend
- metal - Metal backend (macOS/iOS only)
- wgpu-backend / webgpu - wgpu backend (cross-platform)
§FFI
- ffi - C FFI bindings for interoperability
§Full Features
- full - Enables all features except platform-specific GPU backends
§Module Organization
core- Fundamental types:Scalar,Point,Rect,Color,Matrixpath- Path geometry:Path,PathBuilder,PathOps,PathEffectpaint- Styling:Paint,Shader,BlendMode,Filtercanvas- Drawing:Canvas,Surface,Picturesafe- High-level ergonomic API (recommended for most users)
Optional modules (enabled via features):
Re-exports§
pub use skia_rs_core as core;pub use skia_rs_path as path;pub use skia_rs_paint as paint;pub use skia_rs_canvas as canvas;pub use skia_rs_safe as safe;pub use skia_rs_text as text;textpub use skia_rs_codec as codec;codecpub use skia_rs_svg as svg;svgpub use skia_rs_pdf as pdf;pdfpub use skia_rs_gpu as gpu;gpupub use skia_rs_skottie as skottie;skottiepub use skia_rs_ffi as ffi;ffi