2 个版本
0.10.1 | 2020年7月4日 |
---|---|
0.10.0 | 2020年6月19日 |
#44 在 #raster
755KB
18K SLoC
resvg 的raqote后端
resvg
后端实现使用 raqote 库。
警告:的 raqote
库仍在开发中,相当不稳定。您应该选择其他后端。
此后端故意不提供C API。
构建
目前,这是唯一使用基于Rust的2D库的后端,因此构建过程相当简单。
遗憾的是,您仍然需要一个C++编译器来构建 harfbuzz。
在 Windows 上使用 MSVC
安装 stable-x86_64-pc-windows-msvc
Rust 目标。
使用 x64 Native Tools Command Prompt for VS 2017
shell 构建
set PATH=%userprofile%\.cargo\bin;%PATH%
rustup.exe default stable-x86_64-pc-windows-msvc
cargo.exe build --release
在 Windows 上使用 MSYS2
安装 stable-x86_64-pc-windows-gnu
Rust 目标。然后
pacman -S mingw-w64-x86_64-gcc
rustup default stable-x86_64-pc-windows-gnu
cargo build --release
您可以使用相同的i686目标。
在 Linux 上
使用您的发行版的包管理器安装 harfbuzz
。
在 Ubuntu 上,您可以通过以下方式安装它
sudo apt install libharfbuzz-dev
构建 resvg
cargo build --release
在 macOS 上
cargo build --release
运行时依赖
harfbuzz
在 Linux 上。在其他操作系统上,它将被静态构建。
运行 resvg CLI
cargo run --release -- in.svg out.png
生成的二进制文件位于:target/release/resvg-raqote
运行示例
一个简单的 SVG 到 PNG 转换器
cargo run --example minimal -- in.svg out.png
使用手动构建的 SVG 渲染树渲染图像
cargo run --example custom_rtree
在输入 SVG 上的所有形状周围绘制边界框
cargo run --example draw_bboxes -- bboxes.svg bboxes.png -z 4
许可证
依赖项
~5.5MB
~107K SLoC