skia-safe
Safe, idiomatic Rust bindings for Google's Skia 2D graphics library
Repository Health
Technical Analysis
skia-safe provides safe, idiomatic Rust bindings for Skia, the C++ 2D graphics engine that powers Chrome, Android, Flutter, and Firefox’s rendering. It wraps Skia’s canvas, paint, path, image, and text-layout APIs behind Rust ownership and borrowing rules, so applications get GPU-accelerated 2D rendering without touching unsafe C++ interop directly.
The crate is part of the rust-skia workspace, which also builds and vendors Skia’s C++ source via the companion skia-bindings crate. It supports multiple GPU backends (OpenGL, Vulkan, Metal, Direct3D) and CPU rasterization, plus optional modules for SVG rendering, Skottie (Lottie animation) playback, PDF output, and WebP encode/decode, all gated behind Cargo features so consumers only pay for what they use.
What You Get
- Safe Rust wrappers over Skia’s core 2D drawing primitives:
Canvas,Paint,Path,Surface,Image, andPicture - GPU backend support for OpenGL, Vulkan, Metal, and Direct3D via Cargo features (
gl,vulkan,metal,d3d), plus software rasterization - Text layout and shaping through the
textlayoutfeature, and PDF document generation via thepdffeature - SVG parsing/rendering and Skottie (Lottie-style) animation playback as optional modules
- Prebuilt binary caching (
binary-cachefeature) so most consumers don’t need a local C++ toolchain to build Skia from source
Common Use Cases
- Building a custom 2D rendering engine or canvas-based UI toolkit in Rust (e.g. a GUI framework’s drawing backend)
- Rendering vector graphics, charts, or design tools that need pixel-accurate paths, gradients, and text layout
- Generating PDF or SVG output programmatically from a Rust application
- Playing back Lottie/Skottie animations inside a native Rust application
Under The Hood
Architecture - rust-skia is a Cargo workspace with skia-safe as the public-facing crate, skia-bindings handling the C++ build/FFI layer (compiling or fetching a prebuilt Skia binary and generating raw bindgen bindings), and smaller support crates (skia-svg-macros, comment-converter, skia-org as an example/docs app). skia-safe/src mirrors Skia’s own module boundaries (core, gpu, effects, codec, svg, skottie, modules), with a prelude/wrapper layer providing the Handle/RCHandle/RefHandle abstractions that turn Skia’s C++ reference-counted and value types into safe, ergonomic Rust structs.
Tech Stack - The crate targets Rust edition 2024 (MSRV 1.85) and depends on bitflags, optional base64/percent-encoding for SVG/Skottie, and platform-specific crates like windows for Direct3D support. The heavy lifting is the vendored Skia C++ source (tracked as a submodule pinned to a specific Chrome milestone) built via skia-bindings’ build script, with bindgen-generated raw FFI as the boundary skia-safe wraps.
Code Quality - Tests are distributed across roughly 65 of the crate’s 281 source files as inline #[test] modules, covering individual Skia wrapper types (paths, paints, colors, matrices) rather than full end-to-end rendering; there’s no single comprehensive integration test suite, which is typical for a binding crate where most correctness depends on the underlying C++ engine. Code is organized consistently by Skia subsystem, uses feature-gated mod/cfg blocks extensively, and several #[allow(clippy::...)] directives at the crate root acknowledge known lint noise from the FFI-heavy code rather than suppressing it silently.
API Design - Because the API surface mirrors Skia’s own C++ naming and structure closely, developers already familiar with Skia (or with Flutter/Chrome’s rendering internals) will find the mapping predictable, though newcomers face a real learning curve given Skia’s large surface area. Feature flags (all-linux, all-windows, all-macos) bundle sensible platform defaults so getting a working build config doesn’t require hand-picking each GPU backend feature individually, and binary-cache removes the need for a local C++ toolchain in the common case.
Used by 3 apps in this directory
Cap
Team Chat · Video Conferencing
Open source Loom alternative with GPU-accelerated recording, instant share links, AI summaries, and full self-hosting via Docker Compose.
OpenPencil
AI Design Tools
An open-source, AI-native vector design tool with concurrent agent teams, design-as-code, a built-in MCP server, and multi-model intelligence — a distinct project from the similarly-named Figma-file-reading "open-pencil" editor.
Penpot
Design Tools
Open-source design platform with GPU-accelerated canvas, native design tokens, and MCP-powered AI workflows for teams that ship fast.