Skip to main content

skia_rs_safe/
lib.rs

1//! High-level safe Rust API for skia-rs.
2//!
3//! This crate provides a convenient, idiomatic Rust API that wraps
4//! the lower-level crates with ergonomic types and methods.
5//!
6//! # Features
7//!
8//! - `std` (default) - Enable standard library support
9//! - `serde` - Enable serialization support
10//! - `codec` - Enable image codec support (PNG, JPEG, etc.)
11//! - `codec-all` - Enable all image codecs
12//! - `svg` - Enable SVG support
13//! - `pdf` - Enable PDF generation
14//! - `text` - Enable text rendering
15//! - `skottie` - Enable Lottie animation support
16//! - `gpu` - Enable GPU rendering
17//! - `wgpu-backend` - Enable WGPU backend
18//! - `vulkan` - Enable Vulkan backend
19//! - `opengl` - Enable OpenGL backend
20//! - `metal` - Enable Metal backend (macOS/iOS only)
21//! - `full` - Enable all features
22
23#![warn(missing_docs)]
24#![warn(clippy::all)]
25#![cfg_attr(docsrs, feature(doc_cfg))]
26
27// Core crates (always included)
28pub use skia_rs_canvas as canvas;
29pub use skia_rs_core as core;
30pub use skia_rs_paint as paint;
31pub use skia_rs_path as path;
32
33// Optional features
34#[cfg(feature = "text")]
35#[cfg_attr(docsrs, doc(cfg(feature = "text")))]
36pub use skia_rs_text as text;
37
38#[cfg(feature = "codec")]
39#[cfg_attr(docsrs, doc(cfg(feature = "codec")))]
40pub use skia_rs_codec as codec;
41
42#[cfg(feature = "svg")]
43#[cfg_attr(docsrs, doc(cfg(feature = "svg")))]
44pub use skia_rs_svg as svg;
45
46#[cfg(feature = "pdf")]
47#[cfg_attr(docsrs, doc(cfg(feature = "pdf")))]
48pub use skia_rs_pdf as pdf;
49
50#[cfg(feature = "skottie")]
51#[cfg_attr(docsrs, doc(cfg(feature = "skottie")))]
52pub use skia_rs_skottie as skottie;
53
54#[cfg(feature = "gpu")]
55#[cfg_attr(docsrs, doc(cfg(feature = "gpu")))]
56pub use skia_rs_gpu as gpu;
57
58// WASM support
59#[cfg(target_arch = "wasm32")]
60mod wasm;
61#[cfg(target_arch = "wasm32")]
62pub use wasm::*;
63
64// Android support
65#[cfg(target_os = "android")]
66#[cfg_attr(docsrs, doc(cfg(target_os = "android")))]
67pub mod android;
68
69/// Convenience prelude for common types.
70pub mod prelude {
71    pub use skia_rs_canvas::{Canvas, Surface};
72    pub use skia_rs_core::{Color, Color4f, Matrix, Point, Rect, Scalar};
73    pub use skia_rs_paint::{Paint, Style};
74    pub use skia_rs_path::{Path, PathBuilder};
75}