skia-canvas 0.1.0

GPU-accelerated, multi-threaded HTML Canvas-compatible 2D rendering for Rust and Node, powered by Skia.
docs.rs failed to build skia-canvas-0.1.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.

skia-canvas

crates.io docs.rs CI License: MIT

GPU-accelerated, multi-threaded HTML Canvas-compatible 2D rendering for Rust and Node.js, powered by Skia.

A fork of samizdatco/skia-canvas that adds:

  • F16/F32 pixel formats for HDR compositing.
  • Extended color spaces: Display P3, Rec.2020, HDR10 (PQ), HLG, plus linear variants.
  • OkLab gradient interpolation in OkLab, OkLCH, Lab, LCH, HSL, HWB.
  • CanvasKit filter parity (ColorFilter, ImageFilter).
  • Font registration from buffers without writing to disk.
  • Variable font axis control (wght, wdth, opsz, slnt, custom axes).
  • Linear-light premultiplied colors plumbed through paint, gradient, filter, text.
  • ParagraphBuilder/Paragraph rich text with mixed styles, per-run shadows, hit-testing, line metrics.

Rust

[dependencies]
skia-canvas = { version = "0.1", default-features = false, features = ["vulkan", "freetype"] }

The stable Rust API lives under skia_canvas::native. Public signatures never expose skia_safe or neon types -- a compile-time pin in tests/native_studio_renderer_adapter.rs enforces this.

use skia_canvas::native::{
    LinearColorSpace, NativeBackend, NativePaint, Rect, RgbaLinear, SurfaceOptions,
};

let backend = NativeBackend::new();
let mut surface = backend.create_surface(
    1920,
    1080,
    SurfaceOptions {
        color_space: LinearColorSpace::DisplayP3,
        ..SurfaceOptions::default()
    },
)?;

surface.with_canvas(|canvas| {
    canvas.clear(RgbaLinear::new_premultiplied(0.0, 0.0, 0.0, 0.0));
    canvas.draw_rect(
        Rect::from_xywh(100.0, 100.0, 200.0, 100.0),
        &NativePaint::fill(RgbaLinear::opaque(1.0, 0.0, 0.0)),
    );
});

let frame = surface.read_pixels()?; // tight RGBA8, sRGB-gamma, unpremultiplied

See docs/api/native-rust.md for the reference and examples/ for runnable code.

Cargo features

Feature Notes
vulkan Vulkan backend (Linux / Windows).
metal Metal backend (macOS).
window winit-backed event loop.
freetype Bundle FreeType + WOFF2 (recommended on minimal containers).
node-addon Register the #[neon::main] Node addon entry point. Pure-Rust consumers leave this off.

Default feature set is empty; opt in to the backend you need.

Skia version

skia-canvas skia-safe Skia milestone
0.1.x 0.97.x M148

The Skia revision is pinned by skia-safe; bumping skia-safe is a skia-canvas minor-version event.

Node.js

The same source tree also produces the phyron-skia-canvas npm package.

npm install phyron-skia-canvas
import { Canvas } from "phyron-skia-canvas";

let canvas = new Canvas(1920, 1080, {
  colorType: "rgbaf16",
  colorSpace: "rec2020-pq", // HDR10
});

See docs/node.md for installation, platform support (Linux / Docker / AWS Lambda / Next.js), the JavaScript API, and benchmarks.

Acknowledgements

Built on top of the rust-skia project (skia-safe + skia-bindings). Forked from samizdatco/skia-canvas; many thanks to its contributors.

License

MIT. See LICENSE.

© 2020–2026 Samizdat Drafting Co., Phyron AB and contributors.