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.
Safe Rust bindings to the Skia Graphics Library.
This packages contains safe Rust wrappers for Skia and uses skia-bindings to build and interface with the Skia C++ library.
For information about the supported build targets and how to run the examples, please visit the github page of the rust-skia project.
Documentation
Function level documentation is not yet available. To get started, take a look at the Rust examples or the Skia documentation.
Bindings & Wrappers
Skia-safe wraps most parts of the public Skia C++ APIs:
- Vector Geometry: Matrix, Rect, Point, Size, etc.
- Most drawing related classes and functions: Surface, Canvas, Paint, Path.
- Effects and Shaders.
- Utility classes we think are useful.
- PDF & SVG rendering
- Skia Modules
- GPU Backends
- Vulkan
- OpenGL
- Metal
Wrappers for functions that take callbacks and virtual classes are not supported right now. While we think they should be wrapped, the use cases related seem to be rather special, so we postponed that for now.
Features
Skia-safe supports the following features that can be configured via cargo:
vulkan
Vulkan support can be enabled by setting the Cargo feature default = ["vulkan"]
in skia-safe/Cargo.toml
, which will cause a rebuild of Skia. To render the examples with Vulkan use cargo run --example skia-org -- [OUTPUT_DIR] --driver vulkan
.
Note that Vulkan drivers need to be available. On Windows, they are most likely available already, on Linux this article on linuxconfig.org might get you started, and on macOS with Metal support, install the Vulkan SDK for Mac and configure MoltenVK by setting the DYLD_LIBRARY_PATH
, VK_LAYER_PATH
, and VK_ICD_FILENAMES
environment variables as described in Documentation/getting_started_macos.html
.
svg
This feature enables the SVG rendering backend. To create a new Skia canvas that renders to SVG, use the function skia_safe::svg::Canvas::new()
.
shaper
The Cargo feature shaper
enables text shaping with Harfbuzz and ICU.
On Windows, the file icudtl.dat
must be available in your executable's directory. To provide the data file, either copy it from the build's output directory (shown when skia-bindings is compiled with cargo build -vv | grep "ninja: Entering directory"
), or - if your executable directory is writable - invoke the function skia_safe::icu::init()
before creating the skia_safe::Shaper
object.
A simple example can be found in the skia-org command line application.
textlayout
This feature makes the Skia module skparagraph available, which contains types that are used to lay out paragraphs. In Rust, the types are available from the skia_safe::textlayout
module.
A code snippet that lays out a paragraph can be found in the skia-org example.