pax_global_header 0000666 0000000 0000000 00000000064 13525763757 0014536 g ustar 00root root 0000000 0000000 52 comment=9183f919c077c0b008e308c2953cc75964c1471a
resvg-0.8.0/ 0000775 0000000 0000000 00000000000 13525763757 0012671 5 ustar 00root root 0000000 0000000 resvg-0.8.0/.github/ 0000775 0000000 0000000 00000000000 13525763757 0014231 5 ustar 00root root 0000000 0000000 resvg-0.8.0/.github/chart.svg 0000664 0000000 0000000 00000005244 13525763757 0016060 0 ustar 00root root 0000000 0000000
resvg-0.8.0/.github/official_chart.svg 0000664 0000000 0000000 00000005237 13525763757 0017716 0 ustar 00root root 0000000 0000000
resvg-0.8.0/.github/perf-elementary.svg 0000664 0000000 0000000 00000005126 13525763757 0020055 0 ustar 00root root 0000000 0000000
resvg-0.8.0/.github/perf-oxygen.svg 0000664 0000000 0000000 00000005131 13525763757 0017215 0 ustar 00root root 0000000 0000000
resvg-0.8.0/.gitignore 0000664 0000000 0000000 00000000165 13525763757 0014663 0 ustar 00root root 0000000 0000000 .directory
target
.idea
*.pro.user
*.pro.user.*
.qmake.stash
Makefile
*.o
moc_*.cpp
moc_*.h
qrc_*.cpp
ui_*.h
build-*
resvg-0.8.0/.travis.yml 0000664 0000000 0000000 00000000570 13525763757 0015004 0 ustar 00root root 0000000 0000000 dist: xenial
language: rust
rust:
- stable
install:
- ./testing-tools/ci-install.sh
# prepare custom Qt
- if [ "$RESVG_QT_BACKEND" = true ]; then
source /opt/qt56/bin/qt56-env.sh;
fi
script: ./testing-tools/run-tests.py
env:
matrix:
- RESVG_QT_BACKEND=true
- RESVG_CAIRO_BACKEND=true
- RESVG_RAQOTE_BACKEND=true
- RESVG_SKIA_BACKEND=true
resvg-0.8.0/BUILD.adoc 0000775 0000000 0000000 00000017622 13525763757 0014373 0 ustar 00root root 0000000 0000000 :toc:
:toc-title:
= How to build *resvg*
== Intro
*resvg* doesn't include a 2D graphics library and uses external ones.
Their support is implemented separately, therefore we call them _backends_.
You can build them separately or together. +
At the moment, there are four backends: https://www.qt.io/[Qt],
https://www.cairographics.org/[cairo], https://skia.org/[Skia] and
https://github.com/jrmuizel/raqote[raqote].
Since *resvg* is a https://www.rust-lang.org/[Rust] library, you should build it via `cargo`. +
To enable a backend use the `--features` option:
```bash
# Build with a Qt backend
cargo build --release --features="qt-backend"
# or with a cairo backend
cargo build --release --features="cairo-backend"
# or with a raqote backend
cargo build --release --features="raqote-backend"
# or with a skia backend
cargo build --release --features="skia-backend"
# or with all
cargo build --release --all-features
```
== Dependencies
* The library requires the latest stable
https://www.rust-lang.org/tools/install[Rust].
* All backends depend on https://github.com/harfbuzz/harfbuzz[harfbuzz],
which will be built automatically by `cargo` and will be linked statically.
https://cmake.org/download/[CMake] is required as a build-time dependency.
* The _Qt backend_ requires only `QtCore` and `QtGui` libraries. +
Technically, any Qt 5 version should work, but we only support Qt >= 5.6.
* The _cairo backend_ requires https://www.cairographics.org/[cairo] >= 1.12.
* The _raqote backend_ doesn't require any external dependencies.
* The _skia backend_ requires the https://skia.org/[Skia] itself.
* (Linux, runtime) _fontconfig_. Specifically `fc-match`.
== Windows
=== Qt backend via MSVC
Install:
* `stable-x86_64-pc-windows-msvc` https://www.rust-lang.org/tools/install[Rust] target.
* https://cmake.org/download/[CMake] (required to build harfbuzz).
* Qt built with MSVC via an http://download.qt.io/official_releases/online_installers/qt-unified-windows-x86-online.exe[official installer].
Build using `x64 Native Tools Command Prompt for VS 2017` shell:
```batch
set PATH=%userprofile%\.cargo\bin;%PATH%
set QT_DIR=C:\Qt\5.12.0\msvc2017_64
cargo.exe build --release --features "qt-backend"
```
Instead of `msvc2017_64` you can use any other Qt MSVC build. Even 32-bit one.
We are using Qt 5.12.0 just for example.
=== Qt backend via MinGW
Install:
* `stable-x86_64-pc-windows-gnu` https://www.rust-lang.org/tools/install[Rust] target.
* https://cmake.org/download/[CMake] (required to build harfbuzz).
* Qt built with MinGW 64-bit via an http://download.qt.io/official_releases/online_installers/qt-unified-windows-x86-online.exe[official installer].
Build using `cmd.exe`:
```batch
set PATH=C:\Qt\5.12.0\mingw73_64\bin;C:\Qt\Tools\mingw730_64\bin;%userprofile%\.cargo\bin;%PATH%
set QT_DIR=C:\Qt\5.12.0\mingw73_64
cargo.exe build --release --features "qt-backend"
```
Instead of `mingw73_64` you can use any other Qt mingw build.
We are using Qt 5.12.0 just for example.
=== cairo backend via MSYS2
Install `stable-x86_64-pc-windows-gnu` https://www.rust-lang.org/tools/install[Rust] target.
And then:
```bash
pacman -S mingw-w64-x86_64-cmake mingw-w64-x86_64-cairo
cargo.exe build --release --features "cairo-backend"
```
You can use i686 target in the same way.
=== raqote backend via MSVC
Install:
* `stable-x86_64-pc-windows-msvc` https://www.rust-lang.org/tools/install[Rust] target.
* https://cmake.org/download/[CMake] (required to build harfbuzz).
Build using `x64 Native Tools Command Prompt for VS 2017` shell:
```batch
set PATH=%userprofile%\.cargo\bin;C:\Program Files\CMake\bin;%PATH%
cargo.exe build --release --features "raqote-backend"
```
=== raqote backend via MSYS2
Install `stable-x86_64-pc-windows-gnu` https://www.rust-lang.org/tools/install[Rust] target.
And then:
```bash
# install harfbuzz dependencies:
pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake
cargo.exe build --release --features "raqote-backend"
```
You can use i686 target in the same way.
=== Skia backend via MSVC
Install:
* `stable-x86_64-pc-windows-msvc` https://www.rust-lang.org/tools/install[Rust] target.
* https://cmake.org/download/[CMake] (required to build harfbuzz).
* Skia itself (we assume that you have already built one).
`SKIA_DIR` should point to a Skia directory that contains the Skia `include` directory.
`SKIA_LIB_DIR` should point to a Skia directory that contains `skia.dll`.
Build using `x64 Native Tools Command Prompt for VS 2017` shell:
```batch
set PATH=%userprofile%\.cargo\bin;C:\Program Files\CMake\bin;%PATH%
set SKIA_DIR=path
set SKIA_LIB_DIR=path
cargo.exe build --release --features "skia-backend"
```
== Linux
=== Qt backend
Install Qt 5 and `harfbuzz` using your distributive's package manager.
On Ubuntu you can install them via:
```
sudo apt install qtbase5-dev libharfbuzz-dev
```
Build `resvg`:
```bash
cargo build --release --features "qt-backend"
```
If you don't want to use a system Qt, you can alter it with the `PKG_CONFIG_PATH` variable.
```bash
PKG_CONFIG_PATH='/path_to_qt/lib/pkgconfig' cargo build --release --features "qt-backend"
```
=== cairo backend
Install `cairo` and `harfbuzz` using your distributive's package manager.
On Ubuntu you can install them via:
```
sudo apt install libcairo2-dev libharfbuzz-dev
```
Build `resvg`:
```bash
cargo build --release --features "cairo-backend"
```
=== raqote backend
Install `harfbuzz` using your distributive's package manager.
On Ubuntu you can install it via:
```
sudo apt install libharfbuzz-dev
```
Build `resvg`:
```bash
cargo build --release --features "raqote-backend"
```
=== Skia backend
We assume that you have already built Skia itself.
Install `harfbuzz` using your distributive's package manager.
On Ubuntu you can install it via:
```
sudo apt install libharfbuzz-dev
```
`SKIA_DIR` should point to a Skia directory that contains the Skia `include` directory.
`SKIA_LIB_DIR` should point to a Skia directory that contains `libskia.so`.
```sh
SKIA_DIR=path SKIA_LIB_DIR=path cargo build --release --features "skia-backend"
```
== macOS
=== Qt backend
Using https://brew.sh/[homebrew]:
```bash
brew install qt
QT_DIR=/usr/local/opt/qt cargo build --release --features "qt-backend"
```
Or an
http://download.qt.io/official_releases/online_installers/qt-unified-mac-x64-online.dmg[official Qt installer]:
```bash
QT_DIR=/Users/$USER/Qt/5.12.0/clang_64 cargo build --release --features "qt-backend"
```
We are using Qt 5.12.0 just for example.
=== cairo backend
Using https://brew.sh/[homebrew]:
```bash
brew install cairo
cargo build --release --features "cairo-backend"
```
=== raqote backend
```bash
cargo build --release --features "raqote-backend"
```
=== Skia backend
We assume that you have already built Skia itself.
Install `harfbuzz` using Homebrew via:
```
brew install harfbuzz
```
`SKIA_DIR` should point to a Skia directory that contains the Skia `include` directory.
`SKIA_LIB_DIR` should point to a Skia directory that contains `libskia.dylib`.
```sh
SKIA_DIR=path SKIA_LIB_DIR=path cargo build --release --features "skia-backend"
```
== For maintainers
*resvg* consists of 4 parts:
- the Rust library (link:./src[src])
- the C library/bindings (link:./capi[capi])
- the CLI tool to render SVG (link:./tools/rendersvg[tools/rendersvg])
- the CLI tool to simplify SVG (link:./tools/usvg[tools/usvg])
All of them are optional and each one, except `usvg`, can be built with a specific backend.
No need to build `rendersvg` for each backend separately since it has a CLI switch
to choose which one to use in runtime.
Not sure how the Rust library can be packaged, but the C libraries should probably be built
separately.
So the final package can look like this:
```
/bin/rendersvg (does not depend on libresvg-*.so)
/bin/usvg (completely optional)
/include/resvg/resvg.h (from capi/include)
/include/resvg/ResvgQt.h (from capi/include, only for Qt backend)
/lib/libresvg-cairo.so
/lib/libresvg-qt.so
/lib/libresvg-raqote.so
/lib/libresvg-skia.so
```
resvg-0.8.0/CHANGELOG.md 0000664 0000000 0000000 00000026735 13525763757 0014517 0 ustar 00root root 0000000 0000000 # Change Log
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
This changelog also contains important changes in dependencies.
## [Unreleased]
## [0.8.0] - 2019-08-17
### Added
- A [Skia](https://skia.org/) backend thanks to
[JaFenix](https://github.com/JaFenix).
- `feComponentTransfer` support.
- `feColorMatrix` support.
- A better CSS support.
- An `*.otf` fonts support.
- (usvg) `dx`, `dy` are supported inside `textPath` now.
- Use a box blur for `feGaussianBlur` with `stdDeviation`>=2.
This is 4-8 times faster than IIR blur.
Thanks to [Shnatsel](https://github.com/Shnatsel).
### Changed
- All backends are using the `image` crate for raster images loading now.
- Use `pico-args` instead of `gumdrop` to reduced the build time of `tools/rendersvg`
and `tools/usvg`.
- (usvg) The `xmlwriter` is used for SVG generation now.
Almost 2x faster than generating an `svgdom`.
- (usvg) Optimize font database initialization. Almost 50% faster.
- Use a lower PNG compression ratio to speed up PNG generation.
Depending on a backend and image can be 2-4x faster.
- `OutputImage::save` -> `OutputImage::save_png`.
- (usvg) `Path::segments` -> `Path::data`.
- Cairo backend compilation is 2x faster now due to overall changes.
- Performance improvements (Oxygen Icon theme SVG-to-PNG):
- cairo-backend: 22% faster
- qt-backend: 20% faster
- raqote-backend: 34% faster
### Fixed
- (qt-api) A default font resolving.
- (usvg) `baseline-shift` processing inside `textPath`.
- (usvg) Remove all `tref` element children.
- (usvg) `tref` with `xml:space` resolving.
- (usvg) Ignore nested `tref`.
- (usvg) Ignore invalid `clipPath` children that were referenced via `use`.
- (usvg) `currentColor` will always fallback to black now.
Previously, `stroke` was set to `none` which is incorrect.
- (usvg) `use` can reference an element inside a non-SVG element now.
- (usvg) Collect all styles for generic fonts and not only *Regular*.
- (svgdom) Parse only presentation attributes from the `style` element and attribute.
### Removed
- (cairo-backend) `gdk-pixbuf` dependency.
- (qt-backend) JPEG image format plugin dependency.
- `svgdom` dependency.
## [0.7.0] - 2019-06-19
### Added
- New text layout implementation:
- `textPath` support.
- `writing-mode` support, aka vertical text.
- [Text BIDI reordering](http://www.unicode.org/reports/tr9/).
- Better text shaping.
- `word-spacing` is supported for all backends now.
- [`harfbuzz`](https://github.com/harfbuzz/harfbuzz) dependency.
- Subscript, superscript offsets are extracted from font and not hardcoded now.
- `shape-rendering`, `text-rendering` and `image-rendering` support.
- The `arithmetic` operator for `feComposite`.
- (usvg) `--quiet` argument.
- (c-api) `resvg_get_image_bbox`.
- (qt-api) `ResvgRenderer::boundingBox`.
- (resvg) A [raqote](https://github.com/jrmuizel/raqote) backend thanks to
[jrmuizel](https://github.com/jrmuizel). Still experimental.
### Changed
- Text will be converted into paths on the `usvg` side now.
- (resvg) Do not rescale images before rendering. This is faster and better.
- (usvg) An `image` element with a zero or negative size will be skipped now.
Previously, a linked image size was used, which is incorrect.
- Geometry primitives (`Rect`, `Size`, etc) are immutable and always valid now.
- (usvg) The default `color-interpolation-filters` attribute will not be exported now.
### Removed
- (usvg) All text related structures and enums. Text will be converted into `Path` now.
- `InitObject` and `init()` because they are no longer needed.
- (c-api) `resvg_handle`, `resvg_init`, `resvg_destroy`.
- (c-api) `resvg_cairo_get_node_bbox` and `resvg_qt_get_node_bbox`.
Use backend-independent `resvg_get_node_bbox` instead.
- (cairo-backend) `pango` dependency.
- (resvg) `Backend::calc_node_bbox`. Use `Node::calculate_bbox()` instead.
### Fixed
- `letter-spacing` on cursive scripts (like Arabic).
- (rctree) Prevent stack overflow on a huge, deeply nested SVG.
- (c-api) `resvg_is_image_empty` was always returning `false`.
- (resvg) Panic when `filter` with `objectBoudningBox` was set on an empty group.
- (usvg) `mask` with `objectBoundingBox` resolving.
- (usvg) `pattern`'s `viewBox` attribute resolving via `href`.
- (roxmltree) Namespace resolving.
## [0.6.1] - 2019-03-16
### Fixed
- (usvg) `transform` multiplication.
- (usvg) `use` inside `clipPath` resolving.
## [0.6.0] - 2019-03-16
### Added
- Nested `baseline-shift` support.
- (qt-api) `renderToImage`.
- (usvg) A better algorithm for unused defs (`defs` element children, like gradients) removal.
- (usvg) `Error::InvalidSize`.
- (c-api) `RESVG_ERROR_INVALID_SIZE`.
### Changed
- (usvg) A major rewrite.
- `baseline-shift` with `sub`, `super` and percent values calculation.
- Marker resolving moved completely to `usvg`.
- If an SVG doesn't have a valid size than an error will occur.
Previously, an empty tree was produced.
- (qt-api) `render` methods are `const` now.
- (usvg) Disable default attributes exporting.
### Removed
- (usvg) Marker element and attributes. Markers will be resolved just like `use` now.
### Fixed
- (resvg) During the `tspan` rendering, the `text` bbox will be used instead
of the `tspan` bbox itself. This is the correct behaviour by the SVG spec.
- (cairo-backend) `font-family` parsing.
- (usvg) `filter:none` processing.
- (usvg) `text` inside `text` processing.
- (usvg) Endless loop during `use` resolving.
- (usvg) Endless loop when SVG has indirect recursive `xlink:href` links.
- (usvg) Endless loop when SVG has recursive `marker-*` links.
- (usvg) Panic during `use` resolving.
- (usvg) Panic during inherited attributes resolving.
- (usvg) Groups regrouping.
- (usvg) `dx`/`dy` processing on `text`.
- (usvg) `textAnchor` resolving.
- (usvg) Ignore `fill-rule` on `text`.
- (svgtypes) Style with comments parsing.
- (roxmltree) Namespaces resolving.
## [0.5.0] - 2019-01-04
### Added
- `marker` support.
- Partial `baseline-shift` support.
- `letter-spacing` support.
- (qt-backend) `word-spacing` support.
Does not work on the cairo backend.
- tools/explorer-thumbnailer
- tools/kde-dolphin-thumbnailer
### Fixed
- Object bounding box calculation.
- Pattern scaling.
- Nested `objectBoundigBox` support.
- (usvg) `color` on `use` resolving.
- (usvg) `offset` attribute resolving inside the `stop` element.
- (usvg) Ungrouping of groups with non-inheritable attributes.
- (usvg) `rotate` attribute resolving.
- (usvg) Paths without stroke and fill will no longer be removed.
Required for a proper bbox resolving.
- (usvg) Coordinates resolving when units are `userSpaceOnUse`.
- (usvg) Groups regrouping. Caused an incorrect rendering of `clipPath`
that had `filter` on a child.
- (usvg) Style attributes resolving on the root `svg` element.
- (usvg) `SmoothCurveTo` and `SmoothQuadratic` conversion.
- (usvg) `symbol` resolving.
- (cairo-backend) Font ascent calculation.
- (qt-backend) Stroking of LineTo specified as CurveTo.
- (svgdom) `stroke-miterlimit` attribute parsing.
- (svgdom) `length` and `number` attribute types parsing.
- (svgdom) `offset` attribute parsing.
- (svgdom) IRI resolving order when SVG has duplicated ID's.
## [0.4.0] - 2018-12-13
### Added
- (resvg) Initial filters support.
- (resvg) Nested `clipPath` and `mask` support.
- (resvg) MSVC support.
- (rendersvg) `font-family`, `font-size` and `languages` to args.
- (usvg) `systemLanguage` attribute support.
- (usvg) Default font family and size is configurable now.
- (c-api) `RESVG_ERROR_PARSING_FAILED`.
- (c-api) `font_family`, `font_size` and `languages` to `resvg_options`.
- (qt-api) `ResvgRenderer::setDevicePixelRatio`.
### Changed
- (rendersvg) Use `gumdrop` instead of `getopts`.
- (c-api) Qt wrapper is header-only now.
### Fixed
- (cairo-backend) Text layout.
- (cairo-backend) Rendering of a zero length subpath with a square cap.
- (qt-backend) Transform retrieving via Qt bindings.
- (resvg) Recursive SVG images via `image` tag.
- (resvg) Bbox calculation of the text with rotate.
- (resvg) Invisible elements processing.
- (qt-api) SVG from QByteArray loading when data is invalid.
- (usvg) `display` attribute processing.
- (usvg) Recursive `mask` resolving.
- (usvg) `inherit` attribute value resolving.
- (svgdom) XML namespaces resolving.
### Removed
- (rendersvg) `failure` dependency.
## [0.3.0] - 2018-05-23
### Added
- (c-api) `resvg_is_image_empty`.
- (c-api) `resvg_error` enum.
- (c-api) Qt wrapper.
- (resvg) Advanced text layout support (lists of x, y, dx, dy and rotate).
- (resvg) SVG support for `image` element.
- (usvg) `symbol` element support.
- (usvg) Nested `svg` elements support.
- (usvg) Paint fallback resolving.
- (usvg) Bbox validation for shapes that use painting servers.
- (svgdom) Elements from ENTITY resolving.
### Changed
- (c-api) `resvg_parse_tree_from_file`, `resvg_parse_tree_from_data`
`resvg_cairo_render_to_image` and `resvg_qt_render_to_image`
will return an error code now.
- (cairo-backend) Use `gdk-pixbuf` crate instead of `image`.
- (resvg) `Render::render_to_image` and `Render::render_node_to_image` will return
`Option` and not `Result` now.
- (resvg) New geometry primitives implementation.
- (resvg) Rename `render_*` modules to `backend_`.
- (rendersvg) Use `getopts` instead of `clap` to reduce the executable size.
- (svgtypes) `StreamExt::parse_iri` and `StreamExt::parse_func_iri` will parse
not only well-formed data now.
### Fixed
- (qt-backend) Gradient with `objectBoundingBox` rendering.
- (qt-backend) Text bounding box detection during the rendering.
- (cairo-backend) `image` element clipping.
- (cairo-backend) Layers management.
- (c-api) `resvg_get_node_transform` will return a correct transform now.
- (resvg) `text-decoration` thickness.
- (resvg) `pattern` scaling.
- (resvg) `image` without size rendering.
- (usvg) Panic during `visibility` resolving.
- (usvg) Gradients with one stop resolving.
- (usvg) `use` attributes resolving.
- (usvg) `clipPath` and `mask` attributes resolving.
- (usvg) `offset` attribute in `stop` element resolving.
- (usvg) Incorrect `font-size` attribute resolving.
- (usvg) Gradient stops resolving.
- (usvg) `switch` element resolving.
- (svgdom) Mixed `xml:space` processing.
- (svgtypes) `Paint::from_span` poor performance.
### Removed
- (c-api) `resvg_error_msg_destroy`.
- (resvg) `parse_rtree_*` methods. Use `usvg::Tree::from_` instead.
- (resvg) `Error`.
## [0.2.0] - 2018-04-24
### Added
- (svg) Partial `clipPath` support.
- (svg) Partial `mask` support.
- (svg) Partial `pattern` support.
- (svg) `preserveAspectRatio` support.
- (svg) Check that an external image is PNG or JPEG.
- (rendersvg) Added `--query-all` and `--export-id` arguments to render SVG items by ID.
- (rendersvg) Added `--perf` argument for a simple performance stats.
### Changed
- (resvg) API is completely new.
### Fixed
- `font-size` attribute inheritance during `use` resolving.
[Unreleased]: https://github.com/RazrFalcon/resvg/compare/v0.8.0...HEAD
[0.8.0]: https://github.com/RazrFalcon/resvg/compare/v0.7.0...v0.8.0
[0.7.0]: https://github.com/RazrFalcon/resvg/compare/v0.6.1...v0.7.0
[0.6.1]: https://github.com/RazrFalcon/resvg/compare/v0.6.0...v0.6.1
[0.6.0]: https://github.com/RazrFalcon/resvg/compare/v0.5.0...v0.6.0
[0.5.0]: https://github.com/RazrFalcon/resvg/compare/v0.4.0...v0.5.0
[0.4.0]: https://github.com/RazrFalcon/resvg/compare/v0.3.0...v0.4.0
[0.3.0]: https://github.com/RazrFalcon/resvg/compare/v0.2.0...v0.3.0
[0.2.0]: https://github.com/RazrFalcon/resvg/compare/v0.1.0...v0.2.0
resvg-0.8.0/Cargo.lock 0000664 0000000 0000000 00000063453 13525763757 0014611 0 ustar 00root root 0000000 0000000 # This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "adler32"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "arrayvec"
version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "autocfg"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "base64"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "bitflags"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "byteorder"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "cairo-rs"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cairo-sys-rs"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cc"
version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "cfg-if"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "cmake"
version = "0.1.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "core-foundation"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "core-foundation-sys"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "core-graphics"
version = "0.17.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "core-text"
version = "13.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)",
"foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "crc32fast"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "data-url"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "deflate"
version = "0.7.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "euclid"
version = "0.20.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "fern"
version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "float-cmp"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "foreign-types"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "foreign-types-shared"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "freetype"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
"servo-freetype-sys 4.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "harfbuzz-sys"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cmake 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
"core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)",
"core-text 13.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"freetype 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "harfbuzz_rs"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"harfbuzz-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "inflate"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "jpeg-decoder"
version = "0.1.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "kurbo"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "libc"
version = "0.2.62"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "libflate"
version = "0.1.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rle-decode-fast 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "log"
version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "lyon_geom"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "matches"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "memmap"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "nodrop"
version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "num-traits"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "pico-args"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "pkg-config"
version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "png"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"deflate 0.7.20 (registry+https://github.com/rust-lang/crates.io-index)",
"inflate 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "raqote"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"euclid 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lyon_geom 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
"png 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
"sw-composite 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
"typed-arena 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rctree"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "redox_syscall"
version = "0.1.56"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "rendersvg"
version = "0.8.0"
dependencies = [
"fern 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"pico-args 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"resvg 0.8.0",
"time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "resvg"
version = "0.8.0"
dependencies = [
"cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"jpeg-decoder 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"png 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
"raqote 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"resvg-qt 0.8.0",
"resvg-skia 0.8.0",
"rgb 0.8.13 (registry+https://github.com/rust-lang/crates.io-index)",
"usvg 0.8.0",
]
[[package]]
name = "resvg-capi"
version = "0.8.0"
dependencies = [
"cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"fern 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"resvg 0.8.0",
]
[[package]]
name = "resvg-qt"
version = "0.8.0"
dependencies = [
"cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "resvg-skia"
version = "0.8.0"
dependencies = [
"cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rgb"
version = "0.8.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "rle-decode-fast"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "roxmltree"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"xmlparser 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "servo-freetype-sys"
version = "4.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cmake 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "simplecss"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "siphasher"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "svgtypes"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"float-cmp 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "sw-composite"
version = "0.5.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "take_mut"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "time"
version = "0.1.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "ttf-parser"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "typed-arena"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "unicode-bidi"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "unicode-script"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "unicode-vo"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "usvg"
version = "0.8.0"
dependencies = [
"base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"data-url 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"harfbuzz_rs 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"kurbo 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"libflate 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rctree 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"roxmltree 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"simplecss 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"svgtypes 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ttf-parser 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-script 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-vo 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"xmlwriter 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "usvg-cli"
version = "0.8.0"
dependencies = [
"fern 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"pico-args 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"usvg 0.8.0",
]
[[package]]
name = "winapi"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "xmlparser"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "xmlwriter"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[metadata]
"checksum adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7e522997b529f05601e05166c07ed17789691f562762c7f3b987263d2dedee5c"
"checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba"
"checksum autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "22130e92352b948e7e82a49cdb0aa94f2211761117f29e052dd397c1ac33542b"
"checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e"
"checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd"
"checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5"
"checksum cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e05db47de3b0f09a222fa4bba2eab957d920d4243962a86b2d77ab401e4a359c"
"checksum cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "90a1ec04603a78c111886a385edcec396dbfbc57ea26b9e74aeea6a1fe55dcca"
"checksum cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "b548a4ee81fccb95919d4e22cfea83c7693ebfd78f0495493178db20b3139da7"
"checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33"
"checksum cmake 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "3c84c596dcf125d6781f58e3f4254677ec2a6d8aa56e8501ac277100990b3229"
"checksum core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "25b9e03f145fd4f2bf705e07b900cd41fc636598fe5dc452fd0db1441c3f496d"
"checksum core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b"
"checksum core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)" = "56790968ab1c8a1202a102e6de05fc6e1ec87da99e4e93e9a7d13efbfc1e95a9"
"checksum core-text 13.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "12684243b314c95600a2b49628fb775f91d97bbe18424522f665b77014f2a640"
"checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1"
"checksum data-url 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d33fe99ccedd6e84bc035f1931bb2e6be79739d6242bd895e7311c886c50dc9c"
"checksum deflate 0.7.20 (registry+https://github.com/rust-lang/crates.io-index)" = "707b6a7b384888a70c8d2e8650b3e60170dfc6a67bb4aa67b6dfca57af4bedb4"
"checksum euclid 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)" = "89c879a4e57d6a2785d517b0771ea6857916173debef0102bf81142d36ca9254"
"checksum fern 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)" = "29d26fa0f4d433d1956746e66ec10d6bf4d6c8b93cd39965cceea7f7cc78c7dd"
"checksum float-cmp 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7ef4eee449a2818084dad09f4fcd6e6e8932c482d8d94298493226782bb45b5e"
"checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
"checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
"checksum freetype 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "11926b2b410b469d0e9399eca4cbbe237a9ef02176c485803b29216307e8e028"
"checksum harfbuzz-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e1042ab0b3e7bc1ff64f7f5935778b644ff2194a1cae5ec52167127d3fd23961"
"checksum harfbuzz_rs 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "534c8e9b15d8db6e69654b07dad955f4132757194e7d2bba620d38cf08996088"
"checksum inflate 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "1cdb29978cc5797bd8dcc8e5bf7de604891df2a8dc576973d71a281e916db2ff"
"checksum jpeg-decoder 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "c8b7d43206b34b3f94ea9445174bda196e772049b9bddbc620c9d29b2d20110d"
"checksum kurbo 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e6076333105a72e8d2c227ba6a6da0dc3c8e5f53f02053f598a6087a1ea8991"
"checksum libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)" = "34fcd2c08d2f832f376f4173a231990fa5aef4e99fb569867318a227ef4c06ba"
"checksum libflate 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)" = "45c97cf62125b79dcac52d506acdc4799f21a198597806947fd5f40dc7b93412"
"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
"checksum lyon_geom 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "69589b8844c0b3745cc031a35b62bc33b0fb9e5ba7613756d802c52861dcdb4c"
"checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
"checksum memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b"
"checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945"
"checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32"
"checksum pico-args 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2fce25154205cf4360b456fd7d48994afe20663b77e3bd3d0a353a2fccf7f22c"
"checksum pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c1d2cfa5a714db3b5f24f0915e74fcdf91d09d496ba61329705dda7774d2af"
"checksum png 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8422b27bb2c013dd97b9aef69e161ce262236f49aaf46a0489011c8ff0264602"
"checksum raqote 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d433a1b1cbf1892f7228392d41242e041d3347bdb90e9bab33dcc251ab0604db"
"checksum rctree 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "be9e29cb19c8fe84169fcb07f8f11e66bc9e6e0280efd4715c54818296f8a4a8"
"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"
"checksum rgb 0.8.13 (registry+https://github.com/rust-lang/crates.io-index)" = "4f089652ca87f5a82a62935ec6172a534066c7b97be003cc8f702ee9a7a59c92"
"checksum rle-decode-fast 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cabe4fa914dec5870285fa7f71f602645da47c486e68486d2b4ceb4a343e90ac"
"checksum roxmltree 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "153c367ce9fb8ef7afe637ef92bd083ba0f88b03ef3fcf0287d40be05ae0a61c"
"checksum servo-freetype-sys 4.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2c4ccb6d0d32d277d3ef7dea86203d8210945eb7a45fba89dd445b3595dd0dfc"
"checksum simplecss 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "596554e63596d556a0dbd681416342ca61c75f1a45203201e7e77d3fa2fa9014"
"checksum siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac"
"checksum svgtypes 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9c536faaff1a10837cfe373142583f6e27d81e96beba339147e77b67c9f260ff"
"checksum sw-composite 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)" = "5eba1755094da86216f071f7a28b0453345c3e6e558ea2fd7821c55eef8fb9b2"
"checksum take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60"
"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f"
"checksum ttf-parser 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2efc0a53b6497df87f6a12b428a3d78b45c2916c70cd212138ca4781b02f4c0e"
"checksum typed-arena 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7f70f5c346cc11bc044ae427ab2feae213350dca9e2d637047797d5ff316a646"
"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5"
"checksum unicode-script 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "09f03ad95feb4fde244d79985bfd79eb34ff2702fedb441d2ba3f4ff813efd19"
"checksum unicode-vo 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b1d386ff53b415b7fe27b50bb44679e2cc4660272694b7b6f3326d8480823a94"
"checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770"
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
"checksum xmlparser 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ecec95f00fb0ff019153e64ea520f87d1409769db3e8f4db3ea588638a3e1cee"
"checksum xmlwriter 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9"
resvg-0.8.0/Cargo.toml 0000664 0000000 0000000 00000002533 13525763757 0014624 0 ustar 00root root 0000000 0000000 [package]
name = "resvg"
version = "0.8.0"
authors = ["Evgeniy Reizner "]
keywords = ["svg", "render", "raster"]
license = "MPL-2.0"
edition = "2018"
description = "An SVG rendering library."
documentation = "https://docs.rs/resvg/"
repository = "https://github.com/RazrFalcon/resvg"
readme = "README.md"
categories = ["multimedia::images"]
[workspace]
members = [
"bindings/resvg-qt",
"bindings/resvg-skia",
"capi",
"tools/rendersvg",
"tools/usvg",
"usvg",
]
[badges]
travis-ci = { repository = "RazrFalcon/resvg" }
[dependencies]
log = "0.4"
rgb = "0.8"
usvg = { path = "usvg", version = "0.8" }
png = { version = "0.15", default-features = false }
jpeg-decoder = { version = "0.1.15", default-features = false }
# cairo backend
cairo-rs = { version = "0.7.1", default-features = false, features = ["png"], optional = true }
# qt backend
resvg-qt = { path = "bindings/resvg-qt", version = "0.8", optional = true }
# raqote backend
raqote = { version = "0.6.1", default-features = false, optional = true }
# skia backend
resvg-skia = { path = "bindings/resvg-skia", version = "0.8", optional = true }
[features]
cairo-backend = ["cairo-rs", "png/png-encoding"]
qt-backend = ["resvg-qt"]
raqote-backend = ["raqote"]
skia-backend = ["resvg-skia"]
[package.metadata.docs.rs]
all-features = true
[lib]
doctest = false
resvg-0.8.0/LICENSE.txt 0000664 0000000 0000000 00000040526 13525763757 0014523 0 ustar 00root root 0000000 0000000 Mozilla Public License Version 2.0
==================================
1. Definitions
--------------
1.1. "Contributor"
means each individual or legal entity that creates, contributes to
the creation of, or owns Covered Software.
1.2. "Contributor Version"
means the combination of the Contributions of others (if any) used
by a Contributor and that particular Contributor's Contribution.
1.3. "Contribution"
means Covered Software of a particular Contributor.
1.4. "Covered Software"
means Source Code Form to which the initial Contributor has attached
the notice in Exhibit A, the Executable Form of such Source Code
Form, and Modifications of such Source Code Form, in each case
including portions thereof.
1.5. "Incompatible With Secondary Licenses"
means
(a) that the initial Contributor has attached the notice described
in Exhibit B to the Covered Software; or
(b) that the Covered Software was made available under the terms of
version 1.1 or earlier of the License, but not also under the
terms of a Secondary License.
1.6. "Executable Form"
means any form of the work other than Source Code Form.
1.7. "Larger Work"
means a work that combines Covered Software with other material, in
a separate file or files, that is not Covered Software.
1.8. "License"
means this document.
1.9. "Licensable"
means having the right to grant, to the maximum extent possible,
whether at the time of the initial grant or subsequently, any and
all of the rights conveyed by this License.
1.10. "Modifications"
means any of the following:
(a) any file in Source Code Form that results from an addition to,
deletion from, or modification of the contents of Covered
Software; or
(b) any new file in Source Code Form that contains any Covered
Software.
1.11. "Patent Claims" of a Contributor
means any patent claim(s), including without limitation, method,
process, and apparatus claims, in any patent Licensable by such
Contributor that would be infringed, but for the grant of the
License, by the making, using, selling, offering for sale, having
made, import, or transfer of either its Contributions or its
Contributor Version.
1.12. "Secondary License"
means either the GNU General Public License, Version 2.0, the GNU
Lesser General Public License, Version 2.1, the GNU Affero General
Public License, Version 3.0, or any later versions of those
licenses.
1.13. "Source Code Form"
means the form of the work preferred for making modifications.
1.14. "You" (or "Your")
means an individual or a legal entity exercising rights under this
License. For legal entities, "You" includes any entity that
controls, is controlled by, or is under common control with You. For
purposes of this definition, "control" means (a) the power, direct
or indirect, to cause the direction or management of such entity,
whether by contract or otherwise, or (b) ownership of more than
fifty percent (50%) of the outstanding shares or beneficial
ownership of such entity.
2. License Grants and Conditions
--------------------------------
2.1. Grants
Each Contributor hereby grants You a world-wide, royalty-free,
non-exclusive license:
(a) under intellectual property rights (other than patent or trademark)
Licensable by such Contributor to use, reproduce, make available,
modify, display, perform, distribute, and otherwise exploit its
Contributions, either on an unmodified basis, with Modifications, or
as part of a Larger Work; and
(b) under Patent Claims of such Contributor to make, use, sell, offer
for sale, have made, import, and otherwise transfer either its
Contributions or its Contributor Version.
2.2. Effective Date
The licenses granted in Section 2.1 with respect to any Contribution
become effective for each Contribution on the date the Contributor first
distributes such Contribution.
2.3. Limitations on Grant Scope
The licenses granted in this Section 2 are the only rights granted under
this License. No additional rights or licenses will be implied from the
distribution or licensing of Covered Software under this License.
Notwithstanding Section 2.1(b) above, no patent license is granted by a
Contributor:
(a) for any code that a Contributor has removed from Covered Software;
or
(b) for infringements caused by: (i) Your and any other third party's
modifications of Covered Software, or (ii) the combination of its
Contributions with other software (except as part of its Contributor
Version); or
(c) under Patent Claims infringed by Covered Software in the absence of
its Contributions.
This License does not grant any rights in the trademarks, service marks,
or logos of any Contributor (except as may be necessary to comply with
the notice requirements in Section 3.4).
2.4. Subsequent Licenses
No Contributor makes additional grants as a result of Your choice to
distribute the Covered Software under a subsequent version of this
License (see Section 10.2) or under the terms of a Secondary License (if
permitted under the terms of Section 3.3).
2.5. Representation
Each Contributor represents that the Contributor believes its
Contributions are its original creation(s) or it has sufficient rights
to grant the rights to its Contributions conveyed by this License.
2.6. Fair Use
This License is not intended to limit any rights You have under
applicable copyright doctrines of fair use, fair dealing, or other
equivalents.
2.7. Conditions
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
in Section 2.1.
3. Responsibilities
-------------------
3.1. Distribution of Source Form
All distribution of Covered Software in Source Code Form, including any
Modifications that You create or to which You contribute, must be under
the terms of this License. You must inform recipients that the Source
Code Form of the Covered Software is governed by the terms of this
License, and how they can obtain a copy of this License. You may not
attempt to alter or restrict the recipients' rights in the Source Code
Form.
3.2. Distribution of Executable Form
If You distribute Covered Software in Executable Form then:
(a) such Covered Software must also be made available in Source Code
Form, as described in Section 3.1, and You must inform recipients of
the Executable Form how they can obtain a copy of such Source Code
Form by reasonable means in a timely manner, at a charge no more
than the cost of distribution to the recipient; and
(b) You may distribute such Executable Form under the terms of this
License, or sublicense it under different terms, provided that the
license for the Executable Form does not attempt to limit or alter
the recipients' rights in the Source Code Form under this License.
3.3. Distribution of a Larger Work
You may create and distribute a Larger Work under terms of Your choice,
provided that You also comply with the requirements of this License for
the Covered Software. If the Larger Work is a combination of Covered
Software with a work governed by one or more Secondary Licenses, and the
Covered Software is not Incompatible With Secondary Licenses, this
License permits You to additionally distribute such Covered Software
under the terms of such Secondary License(s), so that the recipient of
the Larger Work may, at their option, further distribute the Covered
Software under the terms of either this License or such Secondary
License(s).
3.4. Notices
You may not remove or alter the substance of any license notices
(including copyright notices, patent notices, disclaimers of warranty,
or limitations of liability) contained within the Source Code Form of
the Covered Software, except that You may alter any license notices to
the extent required to remedy known factual inaccuracies.
3.5. Application of Additional Terms
You may choose to offer, and to charge a fee for, warranty, support,
indemnity or liability obligations to one or more recipients of Covered
Software. However, You may do so only on Your own behalf, and not on
behalf of any Contributor. You must make it absolutely clear that any
such warranty, support, indemnity, or liability obligation is offered by
You alone, and You hereby agree to indemnify every Contributor for any
liability incurred by such Contributor as a result of warranty, support,
indemnity or liability terms You offer. You may include additional
disclaimers of warranty and limitations of liability specific to any
jurisdiction.
4. Inability to Comply Due to Statute or Regulation
---------------------------------------------------
If it is impossible for You to comply with any of the terms of this
License with respect to some or all of the Covered Software due to
statute, judicial order, or regulation then You must: (a) comply with
the terms of this License to the maximum extent possible; and (b)
describe the limitations and the code they affect. Such description must
be placed in a text file included with all distributions of the Covered
Software under this License. Except to the extent prohibited by statute
or regulation, such description must be sufficiently detailed for a
recipient of ordinary skill to be able to understand it.
5. Termination
--------------
5.1. The rights granted under this License will terminate automatically
if You fail to comply with any of its terms. However, if You become
compliant, then the rights granted under this License from a particular
Contributor are reinstated (a) provisionally, unless and until such
Contributor explicitly and finally terminates Your grants, and (b) on an
ongoing basis, if such Contributor fails to notify You of the
non-compliance by some reasonable means prior to 60 days after You have
come back into compliance. Moreover, Your grants from a particular
Contributor are reinstated on an ongoing basis if such Contributor
notifies You of the non-compliance by some reasonable means, this is the
first time You have received notice of non-compliance with this License
from such Contributor, and You become compliant prior to 30 days after
Your receipt of the notice.
5.2. If You initiate litigation against any entity by asserting a patent
infringement claim (excluding declaratory judgment actions,
counter-claims, and cross-claims) alleging that a Contributor Version
directly or indirectly infringes any patent, then the rights granted to
You by any and all Contributors for the Covered Software under Section
2.1 of this License shall terminate.
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
end user license agreements (excluding distributors and resellers) which
have been validly granted by You or Your distributors under this License
prior to termination shall survive termination.
************************************************************************
* *
* 6. Disclaimer of Warranty *
* ------------------------- *
* *
* Covered Software is provided under this License on an "as is" *
* basis, without warranty of any kind, either expressed, implied, or *
* statutory, including, without limitation, warranties that the *
* Covered Software is free of defects, merchantable, fit for a *
* particular purpose or non-infringing. The entire risk as to the *
* quality and performance of the Covered Software is with You. *
* Should any Covered Software prove defective in any respect, You *
* (not any Contributor) assume the cost of any necessary servicing, *
* repair, or correction. This disclaimer of warranty constitutes an *
* essential part of this License. No use of any Covered Software is *
* authorized under this License except under this disclaimer. *
* *
************************************************************************
************************************************************************
* *
* 7. Limitation of Liability *
* -------------------------- *
* *
* Under no circumstances and under no legal theory, whether tort *
* (including negligence), contract, or otherwise, shall any *
* Contributor, or anyone who distributes Covered Software as *
* permitted above, be liable to You for any direct, indirect, *
* special, incidental, or consequential damages of any character *
* including, without limitation, damages for lost profits, loss of *
* goodwill, work stoppage, computer failure or malfunction, or any *
* and all other commercial damages or losses, even if such party *
* shall have been informed of the possibility of such damages. This *
* limitation of liability shall not apply to liability for death or *
* personal injury resulting from such party's negligence to the *
* extent applicable law prohibits such limitation. Some *
* jurisdictions do not allow the exclusion or limitation of *
* incidental or consequential damages, so this exclusion and *
* limitation may not apply to You. *
* *
************************************************************************
8. Litigation
-------------
Any litigation relating to this License may be brought only in the
courts of a jurisdiction where the defendant maintains its principal
place of business and such litigation shall be governed by laws of that
jurisdiction, without reference to its conflict-of-law provisions.
Nothing in this Section shall prevent a party's ability to bring
cross-claims or counter-claims.
9. Miscellaneous
----------------
This License represents the complete agreement concerning the subject
matter hereof. If any provision of this License is held to be
unenforceable, such provision shall be reformed only to the extent
necessary to make it enforceable. Any law or regulation which provides
that the language of a contract shall be construed against the drafter
shall not be used to construe this License against a Contributor.
10. Versions of the License
---------------------------
10.1. New Versions
Mozilla Foundation is the license steward. Except as provided in Section
10.3, no one other than the license steward has the right to modify or
publish new versions of this License. Each version will be given a
distinguishing version number.
10.2. Effect of New Versions
You may distribute the Covered Software under the terms of the version
of the License under which You originally received the Covered Software,
or under the terms of any subsequent version published by the license
steward.
10.3. Modified Versions
If you create software not governed by this License, and you want to
create a new license for such software, you may create and use a
modified version of this License if you rename the license and remove
any references to the name of the license steward (except to note that
such modified license differs from this License).
10.4. Distributing Source Code Form that is Incompatible With Secondary
Licenses
If You choose to distribute Source Code Form that is Incompatible With
Secondary Licenses under the terms of this version of the License, the
notice described in Exhibit B of this License must be attached.
Exhibit A - Source Code Form License Notice
-------------------------------------------
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
If it is not possible or desirable to put the notice in a particular
file, then You may include the notice in a location (such as a LICENSE
file in a relevant directory) where a recipient would be likely to look
for such a notice.
You may add additional accurate notices of copyright ownership.
Exhibit B - "Incompatible With Secondary Licenses" Notice
---------------------------------------------------------
This Source Code Form is "Incompatible With Secondary Licenses", as
defined by the Mozilla Public License, v. 2.0.
resvg-0.8.0/README.md 0000664 0000000 0000000 00000011745 13525763757 0014160 0 ustar 00root root 0000000 0000000 ## resvg
[](https://travis-ci.org/RazrFalcon/resvg)
[](https://crates.io/crates/resvg)
[](https://docs.rs/resvg)
*resvg* is an [SVG](https://en.wikipedia.org/wiki/Scalable_Vector_Graphics) rendering library.
## Purpose
*resvg* can be used as:
- a Rust library
- a C library (see [capi](./capi))
- a CLI application (see [tools/rendersvg](./tools/rendersvg))
to render SVG files based on a
[static](http://www.w3.org/TR/SVG11/feature#SVG-static)
[SVG Full 1.1](https://www.w3.org/TR/SVG/Overview.html) subset to raster images or
to a backend's canvas (e.g. to a QWidget via QPainter).
The core idea is to make a fast, small, portable, multiple-backend SVG library
designed for edge-cases.
Another major difference from other SVG rendering libraries is that *resvg* does a lot
of preprocessing before rendering. It converts an input SVG into a simplified one
called [Micro SVG](./docs/usvg_spec.adoc) and only then it begins rendering.
So it's very easy to implement a new rendering backend.
And you can also access *Micro SVG* as XML directly via [usvg](./tools/usvg) tool.
## SVG support
*resvg* is aiming to support only the [static](http://www.w3.org/TR/SVG11/feature#SVG-static)
SVG subset; e.g. no `a`, `script`, `view` or `cursor` elements, no events and no animations.
A list of unsupported features can be found [here](docs/unsupported.md).
[SVG Tiny 1.2](https://www.w3.org/TR/SVGTiny12/) and [SVG 2.0](https://www.w3.org/TR/SVG2/)
are not supported and not planned.
Results of the static subset of the [SVG test suite](https://www.w3.org/Graphics/SVG/Test/20110816/):

Results of the [resvg test suite](https://github.com/RazrFalcon/resvg-test-suite):

You can find a complete table of supported features
[here](https://razrfalcon.github.io/resvg-test-suite/svg-support-table.html).
It also includes alternative libraries.
## Performance
Note that all tested applications have a different SVG support, which impacts the performance.
Also, we do not test against Chrome, Firefox, Inkscape and Batik because they have a huge startup time.

- Elementary Icon Theme contains 3417 files.
- Qt backend is slow because `QRasterPaintEngine` is slow.

- The Oxygen icon theme contains 4947 files.
- All images were converted from `.svgz` to `.svg` beforehand.
- `resvg` is slower than `librsvg` because the Oxygen icon theme uses Gaussian blur heavily,
and `librsvg` has a faster blur implementation.
Also, `librsvg` uses native `cairo` clipping, [which is incorrect](https://razrfalcon.github.io/resvg-test-suite/svg-support-table.html#e-clipPath) but faster.
- QtSvg doesn't support `filter`, `clipPath`, `mask` and `pattern` that are heavily used in the Oxygen icon theme.
So it's actually very slow.
## Project structure
- `resvg` – rendering backends implementation
- [`usvg`](./usvg) – an SVG simplification tool
- [`roxmltree`](https://github.com/RazrFalcon/roxmltree) – a DOM-like XML tree
- [`xmlparser`](https://github.com/RazrFalcon/xmlparser) – an XML parser
- [`svgtypes`](https://github.com/RazrFalcon/svgtypes) – SVG types parser and writer
- [`simplecss`](https://github.com/RazrFalcon/simplecss) – a simple CSS2 parser
- [`ttf-parser`](https://github.com/RazrFalcon/ttf-parser) – a TrueType/OpenType parser
- [`xmlwriter`](https://github.com/RazrFalcon/xmlwriter) – a simple XML writer
- [`rctree`](https://github.com/RazrFalcon/rctree) – a DOM-like tree
- [`resvg-qt`](./bindings/resvg-qt) – minimal bindings to [Qt]
- [`resvg-skia`](./bindings/resvg-skia) – minimal bindings to [Skia]
All other dependencies aren't written by me for this project.
## Directory structure
- `bindings` – minimal bindings to Qt and Skia used by *resvg*
- `capi` – C interface for *resvg*
- `docs` – basic documentation
- `examples` – usage examples for *resvg* as a library
- `src` – source code
- `testing-tools` – scripts used for testing
- `tools` – useful tools
- `usvg` – an SVG simplification library used by *resvg*
## Safety
- The library must not panic. Any panic should be considered a critical bug and should be reported.
There are only a few methods that can produce a panic.
- The core library structure (see above) does not use any `unsafe`,
but since all backends are implemented via FFI, we are stuck with `unsafe` anyway.
Also, `usvg` uses unsafe for fonts memory mapping.
## License
*resvg* is licensed under the [MPLv2.0](https://www.mozilla.org/en-US/MPL/).
[Inkscape]: https://www.inkscape.org
[librsvg]: https://wiki.gnome.org/action/show/Projects/LibRsvg
[QtSvg]: https://doc.qt.io/qt-5/qtsvg-index.html
[cairo]: https://www.cairographics.org/
[Qt]: https://www.qt.io/
[Skia]: https://skia.org/
[GNOME]: https://www.gnome.org/
resvg-0.8.0/bindings/ 0000775 0000000 0000000 00000000000 13525763757 0014466 5 ustar 00root root 0000000 0000000 resvg-0.8.0/bindings/resvg-qt/ 0000775 0000000 0000000 00000000000 13525763757 0016236 5 ustar 00root root 0000000 0000000 resvg-0.8.0/bindings/resvg-qt/Cargo.toml 0000664 0000000 0000000 00000000520 13525763757 0020163 0 ustar 00root root 0000000 0000000 [package]
name = "resvg-qt"
version = "0.8.0"
authors = ["Reizner Evgeniy "]
keywords = ["qt", "ffi"]
license = "MIT"
edition = "2018"
description = "A minimal bindings to Qt used by resvg."
repository = "https://github.com/RazrFalcon/resvg"
workspace = "../.."
[build-dependencies]
cc = "1.0"
pkg-config = "0.3"
resvg-0.8.0/bindings/resvg-qt/LICENSE.txt 0000664 0000000 0000000 00000002060 13525763757 0020057 0 ustar 00root root 0000000 0000000 MIT License
Copyright (c) 2019 Reizner Evgeniy
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
resvg-0.8.0/bindings/resvg-qt/README.md 0000664 0000000 0000000 00000000105 13525763757 0017511 0 ustar 00root root 0000000 0000000 # resvg-qt
*resvg-qt* is a minimal Qt bindings used by the *resvg*.
resvg-0.8.0/bindings/resvg-qt/build.rs 0000664 0000000 0000000 00000003727 13525763757 0017714 0 ustar 00root root 0000000 0000000 #[cfg(target_os = "linux")]
fn main() {
let mut build = cc::Build::new();
build.cpp(true);
build.flag("-std=c++11");
build.file("cpp/qt_capi.cpp").include("cpp");
let lib = pkg_config::find_library("Qt5Gui").expect("Unable to find Qt5Gui");
for path in lib.include_paths {
build.include(path.to_str().expect("Failed to convert include path to str"));
}
build.compile("libqtc.a");
}
#[cfg(target_os = "windows")]
fn main() {
let qt_dir = std::env::var("QT_DIR").expect("QT_DIR is not set");
let qt_path = std::path::Path::new(&qt_dir);
let mut build = cc::Build::new();
let tool = build.get_compiler();
build.cpp(true);
build.file("cpp/qt_capi.cpp").include("cpp");
build.include(qt_path.join("include"));
build.include(qt_path.join("include").join("QtCore"));
build.include(qt_path.join("include").join("QtGui"));
if tool.is_like_msvc() {
build.compile("libqtc.lib");
} else {
build.flag("-std=c++11");
build.compile("libqtc.a");
}
println!("cargo:rustc-link-search={}", qt_path.join("bin").display()); // for MinGW
println!("cargo:rustc-link-search={}", qt_path.join("lib").display()); // for MSVC
println!("cargo:rustc-link-lib=Qt5Core");
println!("cargo:rustc-link-lib=Qt5Gui");
}
#[cfg(target_os = "macos")]
fn main() {
let qt_dir = std::env::var("QT_DIR").expect("QT_DIR is not set");
let qt_path = std::path::Path::new(&qt_dir);
let mut build = cc::Build::new();
build.cpp(true);
build.flag("-std=c++11");
build.flag(&format!("-F{}/lib", qt_dir));
build.file("cpp/qt_capi.cpp").include("cpp");
build.include(qt_path.join("lib/QtGui.framework/Headers"));
build.include(qt_path.join("lib/QtCore.framework/Headers"));
build.compile("libqtc.a");
println!("cargo:rustc-link-search=framework={}/lib", qt_dir);
println!("cargo:rustc-link-lib=framework=QtCore");
println!("cargo:rustc-link-lib=framework=QtGui");
}
resvg-0.8.0/bindings/resvg-qt/cpp/ 0000775 0000000 0000000 00000000000 13525763757 0017020 5 ustar 00root root 0000000 0000000 resvg-0.8.0/bindings/resvg-qt/cpp/qt_capi.cpp 0000664 0000000 0000000 00000025603 13525763757 0021152 0 ustar 00root root 0000000 0000000 #include
#include
#include
#include
#include
#include "qt_capi.hpp"
#define IMAGE_CAST reinterpret_cast(c_img)
#define PAINTER_CAST reinterpret_cast(c_p)
#define PATH_CAST reinterpret_cast(c_pp)
#define TRANSFORM_CAST reinterpret_cast(c_ts)
#define PEN_CAST reinterpret_cast(c_pen)
#define BRUSH_CAST reinterpret_cast(c_brush)
#define LG_CAST reinterpret_cast(c_lg)
#define RG_CAST reinterpret_cast(c_rg)
extern "C" {
// QImage
qtc_qimage * qtc_qimage_create_rgba_premultiplied(uint32_t width, uint32_t height)
{
QImage *img = new QImage(width, height, QImage::Format_ARGB32_Premultiplied);
if (img->isNull()) {
return 0;
}
return reinterpret_cast(img);
}
qtc_qimage * qtc_qimage_create_rgba(uint32_t width, uint32_t height)
{
QImage *img = new QImage(width, height, QImage::Format_ARGB32);
if (img->isNull()) {
return 0;
}
return reinterpret_cast(img);
}
uint8_t* qtc_qimage_get_data(qtc_qimage *c_img)
{
return IMAGE_CAST->bits();
}
uint32_t qtc_qimage_get_byte_count(qtc_qimage *c_img)
{
return IMAGE_CAST->byteCount();
}
qtc_qimage* qtc_qimage_resize(qtc_qimage *c_img, uint32_t width, uint32_t height, AspectRatioMode ratio,
bool smoothTransformation)
{
const auto mode = smoothTransformation ? Qt::SmoothTransformation : Qt::FastTransformation;
const QImage rImg = IMAGE_CAST->scaled(width, height, Qt::AspectRatioMode(ratio), mode);
return reinterpret_cast(new QImage(rImg));
}
qtc_qimage* qtc_qimage_copy(qtc_qimage *c_img, uint32_t x, uint32_t y, uint32_t width, uint32_t height)
{
const QImage rImg = IMAGE_CAST->copy(x, y, width, height);
return reinterpret_cast(new QImage(rImg));
}
void qtc_qimage_fill(qtc_qimage *c_img, uint8_t r, uint8_t g, uint8_t b, uint8_t a)
{
IMAGE_CAST->fill(QColor(r, g, b, a));
}
qtc_qimage* qtc_qimage_to_rgba(qtc_qimage *c_img)
{
const QImage rImg = IMAGE_CAST->convertToFormat(QImage::Format_ARGB32);
return reinterpret_cast(new QImage(rImg));
}
uint32_t qtc_qimage_get_width(qtc_qimage *c_img)
{
return IMAGE_CAST->width();
}
uint32_t qtc_qimage_get_height(qtc_qimage *c_img)
{
return IMAGE_CAST->height();
}
bool qtc_qimage_save(qtc_qimage *c_img, const char *path)
{
QImageWriter writer(QString::fromUtf8(path));
writer.setCompression(20); // Use a lower ratio to speed up compression.
return writer.write(*IMAGE_CAST);
}
void qtc_qimage_destroy(qtc_qimage *c_img)
{
delete IMAGE_CAST;
}
// QPainter
qtc_qpainter *qtc_qpainter_create(qtc_qimage *c_img)
{
auto p = new QPainter();
p->begin(IMAGE_CAST);
p->setPen(Qt::NoPen);
p->setBrush(Qt::NoBrush);
p->setRenderHint(QPainter::Antialiasing, true);
p->setRenderHint(QPainter::SmoothPixmapTransform, true);
return reinterpret_cast(p);
}
void qtc_qpainter_set_antialiasing(qtc_qpainter *c_p, bool flag)
{
PAINTER_CAST->setRenderHint(QPainter::Antialiasing, flag);
}
void qtc_qpainter_set_smooth_pixmap_transform(qtc_qpainter *c_p, bool flag)
{
PAINTER_CAST->setRenderHint(QPainter::SmoothPixmapTransform, flag);
}
void qtc_qpainter_set_pen(qtc_qpainter *c_p, qtc_qpen *c_pen)
{
PAINTER_CAST->setPen(*PEN_CAST);
}
void qtc_qpainter_reset_pen(qtc_qpainter *c_p)
{
PAINTER_CAST->setPen(Qt::NoPen);
}
void qtc_qpainter_set_brush(qtc_qpainter *c_p, qtc_qbrush *c_brush)
{
PAINTER_CAST->setBrush(*BRUSH_CAST);
}
void qtc_qpainter_reset_brush(qtc_qpainter *c_p)
{
PAINTER_CAST->setBrush(Qt::NoBrush);
}
void qtc_qpainter_set_opacity(qtc_qpainter *c_p, double opacity)
{
PAINTER_CAST->setOpacity(opacity);
}
void qtc_qpainter_draw_path(qtc_qpainter *c_p, qtc_qpainterpath *c_pp)
{
PAINTER_CAST->drawPath(*PATH_CAST);
}
void qtc_qpainter_draw_image(qtc_qpainter *c_p, double x, double y, qtc_qimage *c_img)
{
PAINTER_CAST->drawImage(QPointF(x, y), *IMAGE_CAST);
}
void qtc_qpainter_draw_image_rect(qtc_qpainter *c_p, double x, double y, double w, double h, qtc_qimage *c_img)
{
PAINTER_CAST->drawImage(QRectF(x, y, w, h), *IMAGE_CAST);
}
void qtc_qpainter_draw_text(qtc_qpainter *c_p, double x, double y, const char *c_text)
{
auto p = PAINTER_CAST;
const QString text = QString::fromUtf8(c_text);
QPainterPath path;
path.addText(QPointF(x, y + p->fontMetrics().ascent()), p->font(), text);
p->drawPath(path);
}
void qtc_qpainter_draw_rect(qtc_qpainter *c_p, double x, double y, double w, double h)
{
PAINTER_CAST->drawRect(QRectF(x, y, w, h));
}
void qtc_qpainter_translate(qtc_qpainter *c_p, double tx, double ty)
{
PAINTER_CAST->translate(tx, ty);
}
void qtc_qpainter_scale(qtc_qpainter *c_p, double sx, double sy)
{
PAINTER_CAST->scale(sx, sy);
}
qtc_qtransform *qtc_qpainter_get_transform(qtc_qpainter *c_p)
{
const auto ts = PAINTER_CAST->transform();
return reinterpret_cast(new QTransform(ts));
}
void qtc_qpainter_set_transform(qtc_qpainter *c_p, qtc_qtransform *c_ts, bool combine)
{
PAINTER_CAST->setTransform(*TRANSFORM_CAST, combine);
}
void qtc_qpainter_set_clip_rect(qtc_qpainter *c_p, double x, double y, double w, double h)
{
PAINTER_CAST->setClipRect(QRectF(x, y, w, h));
}
void qtc_qpainter_set_clip_path(qtc_qpainter *c_p, qtc_qpainterpath *c_pp)
{
PAINTER_CAST->setClipPath(*PATH_CAST);
}
void qtc_qpainter_reset_clip_path(qtc_qpainter *c_p)
{
PAINTER_CAST->setClipPath(QPainterPath(), Qt::NoClip);
}
void qtc_qpainter_set_composition_mode(qtc_qpainter *c_p, CompositionMode mode)
{
PAINTER_CAST->setCompositionMode(QPainter::CompositionMode(mode));
}
void qtc_qpainter_end(qtc_qpainter *c_p)
{
PAINTER_CAST->end();
}
void qtc_qpainter_destroy(qtc_qpainter *c_p)
{
delete PAINTER_CAST;
}
// QPainterPath
qtc_qpainterpath *qtc_qpainterpath_create()
{
return reinterpret_cast(new QPainterPath());
}
void qtc_qpainterpath_move_to(qtc_qpainterpath *c_pp, double x, double y)
{
PATH_CAST->moveTo(x, y);
}
void qtc_qpainterpath_line_to(qtc_qpainterpath *c_pp, double x, double y)
{
PATH_CAST->lineTo(x, y);
}
void qtc_qpainterpath_curve_to(qtc_qpainterpath *c_pp, double x1, double y1, double x2, double y2,
double x, double y)
{
PATH_CAST->cubicTo(x1, y1, x2, y2, x, y);
}
void qtc_qpainterpath_close_path(qtc_qpainterpath *c_pp)
{
PATH_CAST->closeSubpath();
}
void qtc_qpainterpath_set_fill_rule(qtc_qpainterpath *c_pp, FillRule rule)
{
PATH_CAST->setFillRule(Qt::FillRule(rule));
}
void qtc_qpainterpath_destroy(qtc_qpainterpath *c_pp)
{
delete PATH_CAST;
}
// QTransform
qtc_qtransform *qtc_qtransform_create()
{
return reinterpret_cast(new QTransform());
}
qtc_qtransform *qtc_qtransform_create_from(double a, double b, double c, double d, double e, double f)
{
return reinterpret_cast(new QTransform(a, b, c, d, e, f));
}
qtc_transform qtc_qtransform_get_data(qtc_qtransform *c_ts)
{
const auto ts = TRANSFORM_CAST;
qtc_transform raw_ts;
raw_ts.a = ts->m11();
raw_ts.b = ts->m12();
raw_ts.c = ts->m21();
raw_ts.d = ts->m22();
raw_ts.e = ts->m31();
raw_ts.f = ts->m32();
return raw_ts;
}
void qtc_qtransform_destroy(qtc_qtransform *c_ts)
{
delete TRANSFORM_CAST;
}
// QPen
qtc_qpen *qtc_qpen_create()
{
return reinterpret_cast(new QPen());
}
void qtc_qpen_destroy(qtc_qpen *c_pen)
{
delete PEN_CAST;
}
void qtc_qpen_set_color(qtc_qpen *c_pen, uint8_t r, uint8_t g, uint8_t b, uint8_t a)
{
PEN_CAST->setColor(QColor(r, g, b, a));
}
void qtc_qpen_set_brush(qtc_qpen *c_pen, qtc_qbrush *c_brush)
{
PEN_CAST->setBrush(*BRUSH_CAST);
}
void qtc_qpen_set_line_cap(qtc_qpen *c_pen, PenCapStyle s)
{
PEN_CAST->setCapStyle(Qt::PenCapStyle(s));
}
void qtc_qpen_set_line_join(qtc_qpen *c_pen, PenJoinStyle s)
{
PEN_CAST->setJoinStyle(Qt::PenJoinStyle(s));
}
void qtc_qpen_set_width(qtc_qpen *c_pen, double width)
{
PEN_CAST->setWidthF(width);
}
void qtc_qpen_set_miter_limit(qtc_qpen *c_pen, double limit)
{
PEN_CAST->setMiterLimit(limit);
}
void qtc_qpen_set_dash_offset(qtc_qpen *c_pen, double offset)
{
qreal w = PEN_CAST->widthF();
if (w == 0) {
w = 1;
}
PEN_CAST->setDashOffset(offset / w);
}
void qtc_qpen_set_dash_array(qtc_qpen *c_pen, const double *array, int len)
{
QVector dashes;
dashes.reserve(len);
qreal w = PEN_CAST->widthF();
if (qFuzzyIsNull(w)) {
w = 1;
}
for (int i = 0; i < len; ++i) {
dashes << array[i] / w;
}
PEN_CAST->setDashPattern(dashes);
}
// QBrush
qtc_qbrush *qtc_qbrush_create()
{
return reinterpret_cast(new QBrush(Qt::SolidPattern));
}
void qtc_qbrush_set_color(qtc_qbrush *c_brush, uint8_t r, uint8_t g, uint8_t b, uint8_t a)
{
BRUSH_CAST->setColor(QColor(r, g, b, a));
}
void qtc_qbrush_set_linear_gradient(qtc_qbrush *c_brush, qtc_qlineargradient *c_lg)
{
*BRUSH_CAST = QBrush(*LG_CAST);
}
void qtc_qbrush_set_radial_gradient(qtc_qbrush *c_brush, qtc_qradialgradient *c_rg)
{
*BRUSH_CAST = QBrush(*RG_CAST);
}
void qtc_qbrush_set_pattern(qtc_qbrush *c_brush, qtc_qimage *c_img)
{
BRUSH_CAST->setTextureImage(*IMAGE_CAST);
}
void qtc_qbrush_set_transform(qtc_qbrush *c_brush, qtc_qtransform *c_ts)
{
BRUSH_CAST->setTransform(*TRANSFORM_CAST);
}
void qtc_qbrush_destroy(qtc_qbrush *c_brush)
{
delete BRUSH_CAST;
}
// QLinearGradient
qtc_qlineargradient *qtc_qlineargradient_create(double x1, double y1, double x2, double y2)
{
auto lg = new QLinearGradient(x1, y1, x2, y2);
lg->setInterpolationMode(QGradient::ComponentInterpolation);
return reinterpret_cast(lg);
}
void qtc_qlineargradient_set_color_at(qtc_qlineargradient *c_lg, double offset,
uint8_t r, uint8_t g, uint8_t b, uint8_t a)
{
LG_CAST->setColorAt(offset, QColor(r, g, b, a));
}
void qtc_qlineargradient_set_spread(qtc_qlineargradient *c_lg, Spread s)
{
LG_CAST->setSpread(QGradient::Spread(s));
}
void qtc_qlineargradient_destroy(qtc_qlineargradient *c_lg)
{
delete LG_CAST;
}
// QRadialGradient
qtc_qradialgradient *qtc_qradialgradient_create(double cx, double cy, double fx, double fy, double r)
{
auto rg = new QRadialGradient(cx, cy, r, fx, fy);
rg->setInterpolationMode(QGradient::ComponentInterpolation);
return reinterpret_cast(rg);
}
void qtc_qradialgradient_set_color_at(qtc_qradialgradient *c_rg, double offset,
uint8_t r, uint8_t g, uint8_t b, uint8_t a)
{
RG_CAST->setColorAt(offset, QColor(r, g, b, a));
}
void qtc_qradialgradient_set_spread(qtc_qradialgradient *c_rg, Spread s)
{
RG_CAST->setSpread(QGradient::Spread(s));
}
void qtc_qradialgradient_destroy(qtc_qradialgradient *c_rg)
{
delete RG_CAST;
}
}
resvg-0.8.0/bindings/resvg-qt/cpp/qt_capi.hpp 0000664 0000000 0000000 00000016104 13525763757 0021153 0 ustar 00root root 0000000 0000000 #ifndef QT_CAPI_H
#define QT_CAPI_H
#include
#define INIT_STRUCT(x) \
struct x; \
typedef struct x x;
INIT_STRUCT(qtc_qimage)
INIT_STRUCT(qtc_qpainter)
INIT_STRUCT(qtc_qpainterpath)
INIT_STRUCT(qtc_qtransform)
INIT_STRUCT(qtc_qpen)
INIT_STRUCT(qtc_qbrush)
INIT_STRUCT(qtc_qlineargradient)
INIT_STRUCT(qtc_qradialgradient)
#undef INIT_STRUCT
struct qtc_transform {
double a;
double b;
double c;
double d;
double e;
double f;
};
// A direct copy from qnamespace.h.
enum PenCapStyle {
FlatCap = 0x00,
SquareCap = 0x10,
RoundCap = 0x20,
};
// A direct copy from qnamespace.h.
enum PenJoinStyle {
BevelJoin = 0x40,
RoundJoin = 0x80,
MiterJoin = 0x100,
};
// A direct copy from qnamespace.h.
enum FillRule {
OddEvenFill,
WindingFill,
};
// A direct copy from qbrush.h.
enum Spread {
PadSpread,
ReflectSpread,
RepeatSpread,
};
// TODO: remove prefix somehow
// A direct copy from qpainter.h.
enum CompositionMode {
CompositionMode_SourceOver,
CompositionMode_DestinationOver,
CompositionMode_Clear,
CompositionMode_Source,
CompositionMode_Destination,
CompositionMode_SourceIn,
CompositionMode_DestinationIn,
CompositionMode_SourceOut,
CompositionMode_DestinationOut,
CompositionMode_SourceAtop,
CompositionMode_DestinationAtop,
CompositionMode_Xor,
// SVG 1.2 blend modes
CompositionMode_Plus,
CompositionMode_Multiply,
CompositionMode_Screen,
CompositionMode_Overlay,
CompositionMode_Darken,
CompositionMode_Lighten,
CompositionMode_ColorDodge,
CompositionMode_ColorBurn,
CompositionMode_HardLight,
CompositionMode_SoftLight,
CompositionMode_Difference,
CompositionMode_Exclusion,
};
enum AspectRatioMode {
IgnoreAspectRatio,
KeepAspectRatio,
KeepAspectRatioByExpanding,
};
extern "C" {
// QImage
qtc_qimage* qtc_qimage_create_rgba_premultiplied(uint32_t width, uint32_t height);
qtc_qimage* qtc_qimage_create_rgba(uint32_t width, uint32_t height);
uint8_t* qtc_qimage_get_data(qtc_qimage *c_img);
uint32_t qtc_qimage_get_byte_count(qtc_qimage *c_img);
qtc_qimage* qtc_qimage_resize(qtc_qimage *c_img, uint32_t width, uint32_t height, AspectRatioMode ratio,
bool smoothTransformation);
qtc_qimage* qtc_qimage_copy(qtc_qimage *c_img, uint32_t x, uint32_t y, uint32_t width, uint32_t height);
void qtc_qimage_fill(qtc_qimage *c_img, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
qtc_qimage *qtc_qimage_to_rgba(qtc_qimage *c_img);
uint32_t qtc_qimage_get_width(qtc_qimage *c_img);
uint32_t qtc_qimage_get_height(qtc_qimage *c_img);
bool qtc_qimage_save(qtc_qimage *c_img, const char *path);
void qtc_qimage_destroy(qtc_qimage *c_img);
// QPainter
qtc_qpainter* qtc_qpainter_create(qtc_qimage *c_img);
void qtc_qpainter_set_antialiasing(qtc_qpainter *c_p, bool flag);
void qtc_qpainter_set_smooth_pixmap_transform(qtc_qpainter *c_p, bool flag);
void qtc_qpainter_set_pen(qtc_qpainter *c_p, qtc_qpen *c_pen);
void qtc_qpainter_reset_pen(qtc_qpainter *c_p);
void qtc_qpainter_set_brush(qtc_qpainter *c_p, qtc_qbrush *c_brush);
void qtc_qpainter_reset_brush(qtc_qpainter *c_p);
void qtc_qpainter_set_opacity(qtc_qpainter *c_p, double opacity);
void qtc_qpainter_draw_path(qtc_qpainter *c_p, qtc_qpainterpath *c_pp);
void qtc_qpainter_draw_image(qtc_qpainter *c_p, double x, double y, qtc_qimage *c_img);
void qtc_qpainter_draw_image_rect(qtc_qpainter *c_p, double x, double y, double w, double h, qtc_qimage *c_img);
void qtc_qpainter_draw_text(qtc_qpainter *c_p, double x, double y, const char *c_text);
void qtc_qpainter_draw_rect(qtc_qpainter *c_p, double x, double y, double w, double h);
void qtc_qpainter_translate(qtc_qpainter *c_p, double tx, double ty);
void qtc_qpainter_scale(qtc_qpainter *c_p, double sx, double sy);
qtc_qtransform* qtc_qpainter_get_transform(qtc_qpainter *c_p);
void qtc_qpainter_set_transform(qtc_qpainter *c_p, qtc_qtransform *q_ts, bool combine);
void qtc_qpainter_set_clip_rect(qtc_qpainter *c_p, double x, double y, double w, double h);
void qtc_qpainter_set_clip_path(qtc_qpainter *c_p, qtc_qpainterpath *c_pp);
void qtc_qpainter_reset_clip_path(qtc_qpainter *c_p);
void qtc_qpainter_set_composition_mode(qtc_qpainter *c_p, CompositionMode mode);
void qtc_qpainter_end(qtc_qpainter *c_p);
void qtc_qpainter_destroy(qtc_qpainter *c_p);
// QPainterPath
qtc_qpainterpath* qtc_qpainterpath_create();
void qtc_qpainterpath_move_to(qtc_qpainterpath *c_pp, double x, double y);
void qtc_qpainterpath_line_to(qtc_qpainterpath *c_pp, double x, double y);
void qtc_qpainterpath_curve_to(qtc_qpainterpath *c_pp, double x1, double y1, double x2, double y2,
double x, double y);
void qtc_qpainterpath_close_path(qtc_qpainterpath *c_pp);
void qtc_qpainterpath_set_fill_rule(qtc_qpainterpath *c_pp, FillRule rule);
void qtc_qpainterpath_destroy(qtc_qpainterpath *c_pp);
// QTransform
qtc_qtransform* qtc_qtransform_create();
qtc_qtransform* qtc_qtransform_create_from(double a, double b, double c,
double d, double e, double f);
qtc_transform qtc_qtransform_get_data(qtc_qtransform *c_ts);
void qtc_qtransform_destroy(qtc_qtransform *c_ts);
// QPen
qtc_qpen* qtc_qpen_create();
void qtc_qpen_set_color(qtc_qpen *c_pen, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
void qtc_qpen_set_brush(qtc_qpen *c_pen, qtc_qbrush *c_brush);
void qtc_qpen_set_line_cap(qtc_qpen *c_pen, PenCapStyle s);
void qtc_qpen_set_line_join(qtc_qpen *c_pen, PenJoinStyle s);
void qtc_qpen_set_width(qtc_qpen *c_pen, double width);
void qtc_qpen_set_miter_limit(qtc_qpen *c_pen, double limit);
void qtc_qpen_set_dash_offset(qtc_qpen *c_pen, double offset);
void qtc_qpen_set_dash_array(qtc_qpen *c_pen, const double *array, int len);
void qtc_qpen_destroy(qtc_qpen *c_pen);
// QBrush
qtc_qbrush* qtc_qbrush_create();
void qtc_qbrush_set_color(qtc_qbrush *c_brush, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
void qtc_qbrush_set_linear_gradient(qtc_qbrush *c_brush, qtc_qlineargradient *c_lg);
void qtc_qbrush_set_radial_gradient(qtc_qbrush *c_brush, qtc_qradialgradient *c_rg);
void qtc_qbrush_set_pattern(qtc_qbrush *c_brush, qtc_qimage *c_img);
void qtc_qbrush_set_transform(qtc_qbrush *c_brush, qtc_qtransform *c_ts);
void qtc_qbrush_destroy(qtc_qbrush *c_brush);
// QLinearGradient
qtc_qlineargradient* qtc_qlineargradient_create(double x1, double y1, double x2, double y2);
void qtc_qlineargradient_set_color_at(qtc_qlineargradient *c_lg, double offset,
uint8_t r, uint8_t g, uint8_t b, uint8_t a);
void qtc_qlineargradient_set_spread(qtc_qlineargradient *c_lg, Spread s);
void qtc_qlineargradient_destroy(qtc_qlineargradient *c_lg);
// QRadialGradient
qtc_qradialgradient* qtc_qradialgradient_create(double cx, double cy, double fx, double fy, double r);
void qtc_qradialgradient_set_color_at(qtc_qradialgradient *c_rg, double offset,
uint8_t r, uint8_t g, uint8_t b, uint8_t a);
void qtc_qradialgradient_set_spread(qtc_qradialgradient *c_rg, Spread s);
void qtc_qradialgradient_destroy(qtc_qradialgradient *c_rg);
}
#endif // QT_CAPI_H
resvg-0.8.0/bindings/resvg-qt/src/ 0000775 0000000 0000000 00000000000 13525763757 0017025 5 ustar 00root root 0000000 0000000 resvg-0.8.0/bindings/resvg-qt/src/ffi.rs 0000664 0000000 0000000 00000053643 13525763757 0020152 0 ustar 00root root 0000000 0000000 /* automatically generated by rust-bindgen */
pub const _STDINT_H: u32 = 1;
pub const _FEATURES_H: u32 = 1;
pub const _ISOC95_SOURCE: u32 = 1;
pub const _ISOC99_SOURCE: u32 = 1;
pub const _ISOC11_SOURCE: u32 = 1;
pub const _POSIX_SOURCE: u32 = 1;
pub const _POSIX_C_SOURCE: u32 = 200809;
pub const _XOPEN_SOURCE: u32 = 700;
pub const _XOPEN_SOURCE_EXTENDED: u32 = 1;
pub const _LARGEFILE64_SOURCE: u32 = 1;
pub const _DEFAULT_SOURCE: u32 = 1;
pub const _ATFILE_SOURCE: u32 = 1;
pub const __USE_ISOC11: u32 = 1;
pub const __USE_ISOC99: u32 = 1;
pub const __USE_ISOC95: u32 = 1;
pub const __USE_ISOCXX11: u32 = 1;
pub const __USE_POSIX: u32 = 1;
pub const __USE_POSIX2: u32 = 1;
pub const __USE_POSIX199309: u32 = 1;
pub const __USE_POSIX199506: u32 = 1;
pub const __USE_XOPEN2K: u32 = 1;
pub const __USE_XOPEN2K8: u32 = 1;
pub const __USE_XOPEN: u32 = 1;
pub const __USE_XOPEN_EXTENDED: u32 = 1;
pub const __USE_UNIX98: u32 = 1;
pub const _LARGEFILE_SOURCE: u32 = 1;
pub const __USE_XOPEN2K8XSI: u32 = 1;
pub const __USE_XOPEN2KXSI: u32 = 1;
pub const __USE_LARGEFILE: u32 = 1;
pub const __USE_LARGEFILE64: u32 = 1;
pub const __USE_MISC: u32 = 1;
pub const __USE_ATFILE: u32 = 1;
pub const __USE_GNU: u32 = 1;
pub const __USE_FORTIFY_LEVEL: u32 = 0;
pub const __GLIBC_USE_DEPRECATED_GETS: u32 = 0;
pub const __GLIBC_USE_DEPRECATED_SCANF: u32 = 0;
pub const _STDC_PREDEF_H: u32 = 1;
pub const __STDC_IEC_559__: u32 = 1;
pub const __STDC_IEC_559_COMPLEX__: u32 = 1;
pub const __STDC_ISO_10646__: u32 = 201706;
pub const __GNU_LIBRARY__: u32 = 6;
pub const __GLIBC__: u32 = 2;
pub const __GLIBC_MINOR__: u32 = 29;
pub const _SYS_CDEFS_H: u32 = 1;
pub const __glibc_c99_flexarr_available: u32 = 1;
pub const __WORDSIZE: u32 = 64;
pub const __WORDSIZE_TIME64_COMPAT32: u32 = 1;
pub const __SYSCALL_WORDSIZE: u32 = 64;
pub const __HAVE_GENERIC_SELECTION: u32 = 0;
pub const __GLIBC_USE_LIB_EXT2: u32 = 1;
pub const __GLIBC_USE_IEC_60559_BFP_EXT: u32 = 1;
pub const __GLIBC_USE_IEC_60559_FUNCS_EXT: u32 = 1;
pub const __GLIBC_USE_IEC_60559_TYPES_EXT: u32 = 1;
pub const _BITS_TYPES_H: u32 = 1;
pub const __TIMESIZE: u32 = 64;
pub const _BITS_TYPESIZES_H: u32 = 1;
pub const __OFF_T_MATCHES_OFF64_T: u32 = 1;
pub const __INO_T_MATCHES_INO64_T: u32 = 1;
pub const __RLIM_T_MATCHES_RLIM64_T: u32 = 1;
pub const __FD_SETSIZE: u32 = 1024;
pub const _BITS_TIME64_H: u32 = 1;
pub const _BITS_WCHAR_H: u32 = 1;
pub const _BITS_STDINT_INTN_H: u32 = 1;
pub const _BITS_STDINT_UINTN_H: u32 = 1;
pub const INT8_MIN: i32 = -128;
pub const INT16_MIN: i32 = -32768;
pub const INT32_MIN: i32 = -2147483648;
pub const INT8_MAX: u32 = 127;
pub const INT16_MAX: u32 = 32767;
pub const INT32_MAX: u32 = 2147483647;
pub const UINT8_MAX: u32 = 255;
pub const UINT16_MAX: u32 = 65535;
pub const UINT32_MAX: u32 = 4294967295;
pub const INT_LEAST8_MIN: i32 = -128;
pub const INT_LEAST16_MIN: i32 = -32768;
pub const INT_LEAST32_MIN: i32 = -2147483648;
pub const INT_LEAST8_MAX: u32 = 127;
pub const INT_LEAST16_MAX: u32 = 32767;
pub const INT_LEAST32_MAX: u32 = 2147483647;
pub const UINT_LEAST8_MAX: u32 = 255;
pub const UINT_LEAST16_MAX: u32 = 65535;
pub const UINT_LEAST32_MAX: u32 = 4294967295;
pub const INT_FAST8_MIN: i32 = -128;
pub const INT_FAST16_MIN: i64 = -9223372036854775808;
pub const INT_FAST32_MIN: i64 = -9223372036854775808;
pub const INT_FAST8_MAX: u32 = 127;
pub const INT_FAST16_MAX: u64 = 9223372036854775807;
pub const INT_FAST32_MAX: u64 = 9223372036854775807;
pub const UINT_FAST8_MAX: u32 = 255;
pub const UINT_FAST16_MAX: i32 = -1;
pub const UINT_FAST32_MAX: i32 = -1;
pub const INTPTR_MIN: i64 = -9223372036854775808;
pub const INTPTR_MAX: u64 = 9223372036854775807;
pub const UINTPTR_MAX: i32 = -1;
pub const PTRDIFF_MIN: i64 = -9223372036854775808;
pub const PTRDIFF_MAX: u64 = 9223372036854775807;
pub const SIG_ATOMIC_MIN: i32 = -2147483648;
pub const SIG_ATOMIC_MAX: u32 = 2147483647;
pub const SIZE_MAX: i32 = -1;
pub const WINT_MIN: u32 = 0;
pub const WINT_MAX: u32 = 4294967295;
pub const INT8_WIDTH: u32 = 8;
pub const UINT8_WIDTH: u32 = 8;
pub const INT16_WIDTH: u32 = 16;
pub const UINT16_WIDTH: u32 = 16;
pub const INT32_WIDTH: u32 = 32;
pub const UINT32_WIDTH: u32 = 32;
pub const INT64_WIDTH: u32 = 64;
pub const UINT64_WIDTH: u32 = 64;
pub const INT_LEAST8_WIDTH: u32 = 8;
pub const UINT_LEAST8_WIDTH: u32 = 8;
pub const INT_LEAST16_WIDTH: u32 = 16;
pub const UINT_LEAST16_WIDTH: u32 = 16;
pub const INT_LEAST32_WIDTH: u32 = 32;
pub const UINT_LEAST32_WIDTH: u32 = 32;
pub const INT_LEAST64_WIDTH: u32 = 64;
pub const UINT_LEAST64_WIDTH: u32 = 64;
pub const INT_FAST8_WIDTH: u32 = 8;
pub const UINT_FAST8_WIDTH: u32 = 8;
pub const INT_FAST16_WIDTH: u32 = 64;
pub const UINT_FAST16_WIDTH: u32 = 64;
pub const INT_FAST32_WIDTH: u32 = 64;
pub const UINT_FAST32_WIDTH: u32 = 64;
pub const INT_FAST64_WIDTH: u32 = 64;
pub const UINT_FAST64_WIDTH: u32 = 64;
pub const INTPTR_WIDTH: u32 = 64;
pub const UINTPTR_WIDTH: u32 = 64;
pub const INTMAX_WIDTH: u32 = 64;
pub const UINTMAX_WIDTH: u32 = 64;
pub const PTRDIFF_WIDTH: u32 = 64;
pub const SIG_ATOMIC_WIDTH: u32 = 32;
pub const SIZE_WIDTH: u32 = 64;
pub const WCHAR_WIDTH: u32 = 32;
pub const WINT_WIDTH: u32 = 32;
pub type __u_char = ::std::os::raw::c_uchar;
pub type __u_short = ::std::os::raw::c_ushort;
pub type __u_int = ::std::os::raw::c_uint;
pub type __u_long = ::std::os::raw::c_ulong;
pub type __int8_t = ::std::os::raw::c_schar;
pub type __uint8_t = ::std::os::raw::c_uchar;
pub type __int16_t = ::std::os::raw::c_short;
pub type __uint16_t = ::std::os::raw::c_ushort;
pub type __int32_t = ::std::os::raw::c_int;
pub type __uint32_t = ::std::os::raw::c_uint;
pub type __int64_t = ::std::os::raw::c_long;
pub type __uint64_t = ::std::os::raw::c_ulong;
pub type __int_least8_t = __int8_t;
pub type __uint_least8_t = __uint8_t;
pub type __int_least16_t = __int16_t;
pub type __uint_least16_t = __uint16_t;
pub type __int_least32_t = __int32_t;
pub type __uint_least32_t = __uint32_t;
pub type __int_least64_t = __int64_t;
pub type __uint_least64_t = __uint64_t;
pub type __quad_t = ::std::os::raw::c_long;
pub type __u_quad_t = ::std::os::raw::c_ulong;
pub type __intmax_t = ::std::os::raw::c_long;
pub type __uintmax_t = ::std::os::raw::c_ulong;
pub type __dev_t = ::std::os::raw::c_ulong;
pub type __uid_t = ::std::os::raw::c_uint;
pub type __gid_t = ::std::os::raw::c_uint;
pub type __ino_t = ::std::os::raw::c_ulong;
pub type __ino64_t = ::std::os::raw::c_ulong;
pub type __mode_t = ::std::os::raw::c_uint;
pub type __nlink_t = ::std::os::raw::c_ulong;
pub type __off_t = ::std::os::raw::c_long;
pub type __off64_t = ::std::os::raw::c_long;
pub type __pid_t = ::std::os::raw::c_int;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct __fsid_t {
pub __val: [::std::os::raw::c_int; 2usize],
}
#[test]
fn bindgen_test_layout___fsid_t() {
assert_eq!(
::std::mem::size_of::<__fsid_t>(),
8usize,
concat!("Size of: ", stringify!(__fsid_t))
);
assert_eq!(
::std::mem::align_of::<__fsid_t>(),
4usize,
concat!("Alignment of ", stringify!(__fsid_t))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<__fsid_t>())).__val as *const _ as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(__fsid_t),
"::",
stringify!(__val)
)
);
}
pub type __clock_t = ::std::os::raw::c_long;
pub type __rlim_t = ::std::os::raw::c_ulong;
pub type __rlim64_t = ::std::os::raw::c_ulong;
pub type __id_t = ::std::os::raw::c_uint;
pub type __time_t = ::std::os::raw::c_long;
pub type __useconds_t = ::std::os::raw::c_uint;
pub type __suseconds_t = ::std::os::raw::c_long;
pub type __daddr_t = ::std::os::raw::c_int;
pub type __key_t = ::std::os::raw::c_int;
pub type __clockid_t = ::std::os::raw::c_int;
pub type __timer_t = *mut ::std::os::raw::c_void;
pub type __blksize_t = ::std::os::raw::c_long;
pub type __blkcnt_t = ::std::os::raw::c_long;
pub type __blkcnt64_t = ::std::os::raw::c_long;
pub type __fsblkcnt_t = ::std::os::raw::c_ulong;
pub type __fsblkcnt64_t = ::std::os::raw::c_ulong;
pub type __fsfilcnt_t = ::std::os::raw::c_ulong;
pub type __fsfilcnt64_t = ::std::os::raw::c_ulong;
pub type __fsword_t = ::std::os::raw::c_long;
pub type __ssize_t = ::std::os::raw::c_long;
pub type __syscall_slong_t = ::std::os::raw::c_long;
pub type __syscall_ulong_t = ::std::os::raw::c_ulong;
pub type __loff_t = __off64_t;
pub type __caddr_t = *mut ::std::os::raw::c_char;
pub type __intptr_t = ::std::os::raw::c_long;
pub type __socklen_t = ::std::os::raw::c_uint;
pub type __sig_atomic_t = ::std::os::raw::c_int;
pub type int_least8_t = __int_least8_t;
pub type int_least16_t = __int_least16_t;
pub type int_least32_t = __int_least32_t;
pub type int_least64_t = __int_least64_t;
pub type uint_least8_t = __uint_least8_t;
pub type uint_least16_t = __uint_least16_t;
pub type uint_least32_t = __uint_least32_t;
pub type uint_least64_t = __uint_least64_t;
pub type int_fast8_t = ::std::os::raw::c_schar;
pub type int_fast16_t = ::std::os::raw::c_long;
pub type int_fast32_t = ::std::os::raw::c_long;
pub type int_fast64_t = ::std::os::raw::c_long;
pub type uint_fast8_t = ::std::os::raw::c_uchar;
pub type uint_fast16_t = ::std::os::raw::c_ulong;
pub type uint_fast32_t = ::std::os::raw::c_ulong;
pub type uint_fast64_t = ::std::os::raw::c_ulong;
pub type intmax_t = __intmax_t;
pub type uintmax_t = __uintmax_t;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct qtc_qimage {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct qtc_qpainter {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct qtc_qpainterpath {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct qtc_qtransform {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct qtc_qpen {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct qtc_qbrush {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct qtc_qlineargradient {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct qtc_qradialgradient {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct qtc_transform {
pub a: f64,
pub b: f64,
pub c: f64,
pub d: f64,
pub e: f64,
pub f: f64,
}
#[test]
fn bindgen_test_layout_qtc_transform() {
assert_eq!(
::std::mem::size_of::(),
48usize,
concat!("Size of: ", stringify!(qtc_transform))
);
assert_eq!(
::std::mem::align_of::(),
8usize,
concat!("Alignment of ", stringify!(qtc_transform))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::())).a as *const _ as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(qtc_transform),
"::",
stringify!(a)
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::())).b as *const _ as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(qtc_transform),
"::",
stringify!(b)
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::())).c as *const _ as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(qtc_transform),
"::",
stringify!(c)
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::())).d as *const _ as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(qtc_transform),
"::",
stringify!(d)
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::())).e as *const _ as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(qtc_transform),
"::",
stringify!(e)
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::())).f as *const _ as usize },
40usize,
concat!(
"Offset of field: ",
stringify!(qtc_transform),
"::",
stringify!(f)
)
);
}
pub const PenCapStyle_FlatCap: PenCapStyle = 0;
pub const PenCapStyle_SquareCap: PenCapStyle = 16;
pub const PenCapStyle_RoundCap: PenCapStyle = 32;
pub type PenCapStyle = u32;
pub const PenJoinStyle_BevelJoin: PenJoinStyle = 64;
pub const PenJoinStyle_RoundJoin: PenJoinStyle = 128;
pub const PenJoinStyle_MiterJoin: PenJoinStyle = 256;
pub type PenJoinStyle = u32;
pub const FillRule_OddEvenFill: FillRule = 0;
pub const FillRule_WindingFill: FillRule = 1;
pub type FillRule = u32;
pub const Spread_PadSpread: Spread = 0;
pub const Spread_ReflectSpread: Spread = 1;
pub const Spread_RepeatSpread: Spread = 2;
pub type Spread = u32;
pub const CompositionMode_CompositionMode_SourceOver: CompositionMode = 0;
pub const CompositionMode_CompositionMode_DestinationOver: CompositionMode = 1;
pub const CompositionMode_CompositionMode_Clear: CompositionMode = 2;
pub const CompositionMode_CompositionMode_Source: CompositionMode = 3;
pub const CompositionMode_CompositionMode_Destination: CompositionMode = 4;
pub const CompositionMode_CompositionMode_SourceIn: CompositionMode = 5;
pub const CompositionMode_CompositionMode_DestinationIn: CompositionMode = 6;
pub const CompositionMode_CompositionMode_SourceOut: CompositionMode = 7;
pub const CompositionMode_CompositionMode_DestinationOut: CompositionMode = 8;
pub const CompositionMode_CompositionMode_SourceAtop: CompositionMode = 9;
pub const CompositionMode_CompositionMode_DestinationAtop: CompositionMode = 10;
pub const CompositionMode_CompositionMode_Xor: CompositionMode = 11;
pub const CompositionMode_CompositionMode_Plus: CompositionMode = 12;
pub const CompositionMode_CompositionMode_Multiply: CompositionMode = 13;
pub const CompositionMode_CompositionMode_Screen: CompositionMode = 14;
pub const CompositionMode_CompositionMode_Overlay: CompositionMode = 15;
pub const CompositionMode_CompositionMode_Darken: CompositionMode = 16;
pub const CompositionMode_CompositionMode_Lighten: CompositionMode = 17;
pub const CompositionMode_CompositionMode_ColorDodge: CompositionMode = 18;
pub const CompositionMode_CompositionMode_ColorBurn: CompositionMode = 19;
pub const CompositionMode_CompositionMode_HardLight: CompositionMode = 20;
pub const CompositionMode_CompositionMode_SoftLight: CompositionMode = 21;
pub const CompositionMode_CompositionMode_Difference: CompositionMode = 22;
pub const CompositionMode_CompositionMode_Exclusion: CompositionMode = 23;
pub type CompositionMode = u32;
pub const AspectRatioMode_IgnoreAspectRatio: AspectRatioMode = 0;
pub const AspectRatioMode_KeepAspectRatio: AspectRatioMode = 1;
pub const AspectRatioMode_KeepAspectRatioByExpanding: AspectRatioMode = 2;
pub type AspectRatioMode = u32;
extern "C" {
pub fn qtc_qimage_create_rgba_premultiplied(width: u32, height: u32) -> *mut qtc_qimage;
}
extern "C" {
pub fn qtc_qimage_create_rgba(width: u32, height: u32) -> *mut qtc_qimage;
}
extern "C" {
pub fn qtc_qimage_get_data(c_img: *mut qtc_qimage) -> *mut u8;
}
extern "C" {
pub fn qtc_qimage_get_byte_count(c_img: *mut qtc_qimage) -> u32;
}
extern "C" {
pub fn qtc_qimage_resize(
c_img: *mut qtc_qimage,
width: u32,
height: u32,
ratio: AspectRatioMode,
smoothTransformation: bool,
) -> *mut qtc_qimage;
}
extern "C" {
pub fn qtc_qimage_copy(
c_img: *mut qtc_qimage,
x: u32,
y: u32,
width: u32,
height: u32,
) -> *mut qtc_qimage;
}
extern "C" {
pub fn qtc_qimage_fill(c_img: *mut qtc_qimage, r: u8, g: u8, b: u8, a: u8);
}
extern "C" {
pub fn qtc_qimage_to_rgba(c_img: *mut qtc_qimage) -> *mut qtc_qimage;
}
extern "C" {
pub fn qtc_qimage_get_width(c_img: *mut qtc_qimage) -> u32;
}
extern "C" {
pub fn qtc_qimage_get_height(c_img: *mut qtc_qimage) -> u32;
}
extern "C" {
pub fn qtc_qimage_save(c_img: *mut qtc_qimage, path: *const ::std::os::raw::c_char) -> bool;
}
extern "C" {
pub fn qtc_qimage_destroy(c_img: *mut qtc_qimage);
}
extern "C" {
pub fn qtc_qpainter_create(c_img: *mut qtc_qimage) -> *mut qtc_qpainter;
}
extern "C" {
pub fn qtc_qpainter_set_antialiasing(c_p: *mut qtc_qpainter, flag: bool);
}
extern "C" {
pub fn qtc_qpainter_set_smooth_pixmap_transform(c_p: *mut qtc_qpainter, flag: bool);
}
extern "C" {
pub fn qtc_qpainter_set_pen(c_p: *mut qtc_qpainter, c_pen: *mut qtc_qpen);
}
extern "C" {
pub fn qtc_qpainter_reset_pen(c_p: *mut qtc_qpainter);
}
extern "C" {
pub fn qtc_qpainter_set_brush(c_p: *mut qtc_qpainter, c_brush: *mut qtc_qbrush);
}
extern "C" {
pub fn qtc_qpainter_reset_brush(c_p: *mut qtc_qpainter);
}
extern "C" {
pub fn qtc_qpainter_set_opacity(c_p: *mut qtc_qpainter, opacity: f64);
}
extern "C" {
pub fn qtc_qpainter_draw_path(c_p: *mut qtc_qpainter, c_pp: *mut qtc_qpainterpath);
}
extern "C" {
pub fn qtc_qpainter_draw_image(c_p: *mut qtc_qpainter, x: f64, y: f64, c_img: *mut qtc_qimage);
}
extern "C" {
pub fn qtc_qpainter_draw_image_rect(
c_p: *mut qtc_qpainter,
x: f64,
y: f64,
w: f64,
h: f64,
c_img: *mut qtc_qimage,
);
}
extern "C" {
pub fn qtc_qpainter_draw_text(
c_p: *mut qtc_qpainter,
x: f64,
y: f64,
c_text: *const ::std::os::raw::c_char,
);
}
extern "C" {
pub fn qtc_qpainter_draw_rect(c_p: *mut qtc_qpainter, x: f64, y: f64, w: f64, h: f64);
}
extern "C" {
pub fn qtc_qpainter_translate(c_p: *mut qtc_qpainter, tx: f64, ty: f64);
}
extern "C" {
pub fn qtc_qpainter_scale(c_p: *mut qtc_qpainter, sx: f64, sy: f64);
}
extern "C" {
pub fn qtc_qpainter_get_transform(c_p: *mut qtc_qpainter) -> *mut qtc_qtransform;
}
extern "C" {
pub fn qtc_qpainter_set_transform(
c_p: *mut qtc_qpainter,
q_ts: *mut qtc_qtransform,
combine: bool,
);
}
extern "C" {
pub fn qtc_qpainter_set_clip_rect(c_p: *mut qtc_qpainter, x: f64, y: f64, w: f64, h: f64);
}
extern "C" {
pub fn qtc_qpainter_set_clip_path(c_p: *mut qtc_qpainter, c_pp: *mut qtc_qpainterpath);
}
extern "C" {
pub fn qtc_qpainter_reset_clip_path(c_p: *mut qtc_qpainter);
}
extern "C" {
pub fn qtc_qpainter_set_composition_mode(c_p: *mut qtc_qpainter, mode: CompositionMode);
}
extern "C" {
pub fn qtc_qpainter_end(c_p: *mut qtc_qpainter);
}
extern "C" {
pub fn qtc_qpainter_destroy(c_p: *mut qtc_qpainter);
}
extern "C" {
pub fn qtc_qpainterpath_create() -> *mut qtc_qpainterpath;
}
extern "C" {
pub fn qtc_qpainterpath_move_to(c_pp: *mut qtc_qpainterpath, x: f64, y: f64);
}
extern "C" {
pub fn qtc_qpainterpath_line_to(c_pp: *mut qtc_qpainterpath, x: f64, y: f64);
}
extern "C" {
pub fn qtc_qpainterpath_curve_to(
c_pp: *mut qtc_qpainterpath,
x1: f64,
y1: f64,
x2: f64,
y2: f64,
x: f64,
y: f64,
);
}
extern "C" {
pub fn qtc_qpainterpath_close_path(c_pp: *mut qtc_qpainterpath);
}
extern "C" {
pub fn qtc_qpainterpath_set_fill_rule(c_pp: *mut qtc_qpainterpath, rule: FillRule);
}
extern "C" {
pub fn qtc_qpainterpath_destroy(c_pp: *mut qtc_qpainterpath);
}
extern "C" {
pub fn qtc_qtransform_create() -> *mut qtc_qtransform;
}
extern "C" {
pub fn qtc_qtransform_create_from(
a: f64,
b: f64,
c: f64,
d: f64,
e: f64,
f: f64,
) -> *mut qtc_qtransform;
}
extern "C" {
pub fn qtc_qtransform_get_data(c_ts: *mut qtc_qtransform) -> qtc_transform;
}
extern "C" {
pub fn qtc_qtransform_destroy(c_ts: *mut qtc_qtransform);
}
extern "C" {
pub fn qtc_qpen_create() -> *mut qtc_qpen;
}
extern "C" {
pub fn qtc_qpen_set_color(c_pen: *mut qtc_qpen, r: u8, g: u8, b: u8, a: u8);
}
extern "C" {
pub fn qtc_qpen_set_brush(c_pen: *mut qtc_qpen, c_brush: *mut qtc_qbrush);
}
extern "C" {
pub fn qtc_qpen_set_line_cap(c_pen: *mut qtc_qpen, s: PenCapStyle);
}
extern "C" {
pub fn qtc_qpen_set_line_join(c_pen: *mut qtc_qpen, s: PenJoinStyle);
}
extern "C" {
pub fn qtc_qpen_set_width(c_pen: *mut qtc_qpen, width: f64);
}
extern "C" {
pub fn qtc_qpen_set_miter_limit(c_pen: *mut qtc_qpen, limit: f64);
}
extern "C" {
pub fn qtc_qpen_set_dash_offset(c_pen: *mut qtc_qpen, offset: f64);
}
extern "C" {
pub fn qtc_qpen_set_dash_array(
c_pen: *mut qtc_qpen,
array: *const f64,
len: ::std::os::raw::c_int,
);
}
extern "C" {
pub fn qtc_qpen_destroy(c_pen: *mut qtc_qpen);
}
extern "C" {
pub fn qtc_qbrush_create() -> *mut qtc_qbrush;
}
extern "C" {
pub fn qtc_qbrush_set_color(c_brush: *mut qtc_qbrush, r: u8, g: u8, b: u8, a: u8);
}
extern "C" {
pub fn qtc_qbrush_set_linear_gradient(c_brush: *mut qtc_qbrush, c_lg: *mut qtc_qlineargradient);
}
extern "C" {
pub fn qtc_qbrush_set_radial_gradient(c_brush: *mut qtc_qbrush, c_rg: *mut qtc_qradialgradient);
}
extern "C" {
pub fn qtc_qbrush_set_pattern(c_brush: *mut qtc_qbrush, c_img: *mut qtc_qimage);
}
extern "C" {
pub fn qtc_qbrush_set_transform(c_brush: *mut qtc_qbrush, c_ts: *mut qtc_qtransform);
}
extern "C" {
pub fn qtc_qbrush_destroy(c_brush: *mut qtc_qbrush);
}
extern "C" {
pub fn qtc_qlineargradient_create(
x1: f64,
y1: f64,
x2: f64,
y2: f64,
) -> *mut qtc_qlineargradient;
}
extern "C" {
pub fn qtc_qlineargradient_set_color_at(
c_lg: *mut qtc_qlineargradient,
offset: f64,
r: u8,
g: u8,
b: u8,
a: u8,
);
}
extern "C" {
pub fn qtc_qlineargradient_set_spread(c_lg: *mut qtc_qlineargradient, s: Spread);
}
extern "C" {
pub fn qtc_qlineargradient_destroy(c_lg: *mut qtc_qlineargradient);
}
extern "C" {
pub fn qtc_qradialgradient_create(
cx: f64,
cy: f64,
fx: f64,
fy: f64,
r: f64,
) -> *mut qtc_qradialgradient;
}
extern "C" {
pub fn qtc_qradialgradient_set_color_at(
c_rg: *mut qtc_qradialgradient,
offset: f64,
r: u8,
g: u8,
b: u8,
a: u8,
);
}
extern "C" {
pub fn qtc_qradialgradient_set_spread(c_rg: *mut qtc_qradialgradient, s: Spread);
}
extern "C" {
pub fn qtc_qradialgradient_destroy(c_rg: *mut qtc_qradialgradient);
}
resvg-0.8.0/bindings/resvg-qt/src/lib.rs 0000664 0000000 0000000 00000034204 13525763757 0020144 0 ustar 00root root 0000000 0000000 use std::ffi::CString;
use std::i32;
use std::ops::{Deref, DerefMut};
use std::slice;
#[allow(dead_code)]
#[allow(non_camel_case_types)]
#[allow(non_upper_case_globals)]
mod ffi;
pub use ffi::qtc_qpainter;
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum FillRule {
OddEven = ffi::FillRule_OddEvenFill as isize,
Winding = ffi::FillRule_WindingFill as isize,
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum LineCap {
Flat = ffi::PenCapStyle_FlatCap as isize,
Square = ffi::PenCapStyle_SquareCap as isize,
Round = ffi::PenCapStyle_RoundCap as isize,
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum LineJoin {
Bevel = ffi::PenJoinStyle_BevelJoin as isize,
Round = ffi::PenJoinStyle_RoundJoin as isize,
Miter = ffi::PenJoinStyle_MiterJoin as isize,
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum CompositionMode {
SourceOver = ffi::CompositionMode_CompositionMode_SourceOver as isize,
DestinationOver = ffi::CompositionMode_CompositionMode_DestinationOver as isize,
Clear = ffi::CompositionMode_CompositionMode_Clear as isize,
Source = ffi::CompositionMode_CompositionMode_Source as isize,
Destination = ffi::CompositionMode_CompositionMode_Destination as isize,
SourceIn = ffi::CompositionMode_CompositionMode_SourceIn as isize,
DestinationIn = ffi::CompositionMode_CompositionMode_DestinationIn as isize,
SourceOut = ffi::CompositionMode_CompositionMode_SourceOut as isize,
DestinationOut = ffi::CompositionMode_CompositionMode_DestinationOut as isize,
SourceAtop = ffi::CompositionMode_CompositionMode_SourceAtop as isize,
DestinationAtop = ffi::CompositionMode_CompositionMode_DestinationAtop as isize,
Xor = ffi::CompositionMode_CompositionMode_Xor as isize,
Plus = ffi::CompositionMode_CompositionMode_Plus as isize,
Multiply = ffi::CompositionMode_CompositionMode_Multiply as isize,
Screen = ffi::CompositionMode_CompositionMode_Screen as isize,
Overlay = ffi::CompositionMode_CompositionMode_Overlay as isize,
Darken = ffi::CompositionMode_CompositionMode_Darken as isize,
Lighten = ffi::CompositionMode_CompositionMode_Lighten as isize,
ColorDodge = ffi::CompositionMode_CompositionMode_ColorDodge as isize,
ColorBurn = ffi::CompositionMode_CompositionMode_ColorBurn as isize,
HardLight = ffi::CompositionMode_CompositionMode_HardLight as isize,
SoftLight = ffi::CompositionMode_CompositionMode_SoftLight as isize,
Difference = ffi::CompositionMode_CompositionMode_Difference as isize,
Exclusion = ffi::CompositionMode_CompositionMode_Exclusion as isize,
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum AspectRatioMode {
Ignore = ffi::AspectRatioMode_IgnoreAspectRatio as isize,
Keep = ffi::AspectRatioMode_KeepAspectRatio as isize,
KeepByExpanding = ffi::AspectRatioMode_KeepAspectRatioByExpanding as isize,
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum Spread {
Pad = ffi::Spread_PadSpread as isize,
Reflect = ffi::Spread_ReflectSpread as isize,
Repeat = ffi::Spread_RepeatSpread as isize,
}
pub struct Image(*mut ffi::qtc_qimage);
impl Image {
pub fn new_rgba(width: u32, height: u32) -> Option {
unsafe { Self::from_ptr(ffi::qtc_qimage_create_rgba(width, height)) }
}
pub fn new_rgba_premultiplied(width: u32, height: u32) -> Option {
unsafe { Self::from_ptr(ffi::qtc_qimage_create_rgba_premultiplied(width, height)) }
}
unsafe fn from_ptr(img: *mut ffi::qtc_qimage) -> Option {
if img.is_null() {
None
} else {
Some(Image(img))
}
}
pub fn fill(&mut self, r: u8, g: u8, b: u8, a: u8) {
unsafe { ffi::qtc_qimage_fill(self.0, r, g, b, a) }
}
pub fn to_rgba(&self) -> Option {
unsafe { Self::from_ptr(ffi::qtc_qimage_to_rgba(self.0)) }
}
pub fn save(&self, path: &str) -> bool {
let c_path = CString::new(path).unwrap();
unsafe { ffi::qtc_qimage_save(self.0, c_path.as_ptr()) }
}
pub fn resize(
&self,
width: u32,
height: u32,
ratio: AspectRatioMode,
smooth: bool,
) -> Option {
unsafe {
Self::from_ptr(ffi::qtc_qimage_resize(
self.0, width, height, ratio as ffi::AspectRatioMode, smooth
))
}
}
pub fn copy(&self, x: u32, y: u32, width: u32, height: u32) -> Option {
unsafe { Self::from_ptr(ffi::qtc_qimage_copy(self.0, x, y, width, height)) }
}
pub fn try_clone(&self) -> Option {
unsafe { Self::from_ptr(ffi::qtc_qimage_copy(self.0, 0, 0, self.width(), self.height())) }
}
pub fn data(&self) -> ImageData {
unsafe {
let ptr = ffi::qtc_qimage_get_data(self.0);
let len = ffi::qtc_qimage_get_byte_count(self.0) as usize;
ImageData {
slice: slice::from_raw_parts_mut(ptr, len),
}
}
}
pub fn data_mut(&mut self) -> ImageData {
unsafe {
let ptr = ffi::qtc_qimage_get_data(self.0);
let len = ffi::qtc_qimage_get_byte_count(self.0) as usize;
ImageData {
slice: slice::from_raw_parts_mut(ptr, len),
}
}
}
pub fn width(&self) -> u32 {
unsafe { ffi::qtc_qimage_get_width(self.0) }
}
pub fn height(&self) -> u32 {
unsafe { ffi::qtc_qimage_get_height(self.0) }
}
}
impl Drop for Image {
fn drop(&mut self) {
unsafe { ffi::qtc_qimage_destroy(self.0) }
}
}
pub struct ImageData<'a> {
slice: &'a mut [u8],
}
impl<'a> Deref for ImageData<'a> {
type Target = [u8];
fn deref(&self) -> &[u8] {
self.slice
}
}
impl<'a> DerefMut for ImageData<'a> {
fn deref_mut(&mut self) -> &mut [u8] {
self.slice
}
}
pub struct Painter(*mut ffi::qtc_qpainter, bool);
impl Painter {
pub fn new(img: &mut Image) -> Painter {
unsafe { Painter(ffi::qtc_qpainter_create(img.0), true) }
}
pub unsafe fn from_raw(ptr: *mut ffi::qtc_qpainter) -> Painter {
Painter(ptr, false)
}
pub fn set_antialiasing(&self, flag: bool) {
unsafe { ffi::qtc_qpainter_set_antialiasing(self.0, flag); }
}
pub fn set_smooth_pixmap_transform(&self, flag: bool) {
unsafe { ffi::qtc_qpainter_set_smooth_pixmap_transform(self.0, flag); }
}
pub fn set_pen(&mut self, pen: Pen) {
unsafe { ffi::qtc_qpainter_set_pen(self.0, pen.0) }
}
pub fn reset_pen(&mut self) {
unsafe { ffi::qtc_qpainter_reset_pen(self.0) }
}
pub fn set_brush(&mut self, brush: Brush) {
unsafe { ffi::qtc_qpainter_set_brush(self.0, brush.0) }
}
pub fn reset_brush(&mut self) {
unsafe { ffi::qtc_qpainter_reset_brush(self.0) }
}
pub fn set_opacity(&mut self, opacity: f64) {
unsafe { ffi::qtc_qpainter_set_opacity(self.0, opacity) }
}
pub fn draw_path(&mut self, path: &PainterPath) {
unsafe { ffi::qtc_qpainter_draw_path(self.0, path.0) }
}
pub fn draw_image(&mut self, x: f64, y: f64, img: &Image) {
unsafe { ffi::qtc_qpainter_draw_image(self.0, x, y, img.0) }
}
pub fn draw_image_rect(&mut self, x: f64, y: f64, w: f64, h: f64, img: &Image) {
unsafe { ffi::qtc_qpainter_draw_image_rect(self.0, x, y, w, h, img.0) }
}
pub fn draw_rect(&mut self, x: f64, y: f64, w: f64, h: f64) {
unsafe { ffi::qtc_qpainter_draw_rect(self.0, x, y, w, h) }
}
pub fn translate(&mut self, tx: f64, ty: f64) {
unsafe { ffi::qtc_qpainter_translate(self.0, tx, ty) }
}
pub fn scale(&mut self, sx: f64, sy: f64) {
unsafe { ffi::qtc_qpainter_scale(self.0, sx, sy) }
}
pub fn get_transform(&self) -> Transform {
unsafe { Transform(ffi::qtc_qpainter_get_transform(self.0)) }
}
pub fn set_transform(&mut self, ts: &Transform) {
unsafe { ffi::qtc_qpainter_set_transform(self.0, ts.0, false) }
}
pub fn apply_transform(&mut self, ts: &Transform) {
unsafe { ffi::qtc_qpainter_set_transform(self.0, ts.0, true) }
}
pub fn set_clip_rect(&mut self, x: f64, y: f64, w: f64, h: f64) {
unsafe { ffi::qtc_qpainter_set_clip_rect(self.0, x, y, w, h) }
}
pub fn set_clip_path(&mut self, path: &PainterPath) {
unsafe { ffi::qtc_qpainter_set_clip_path(self.0, path.0) }
}
pub fn reset_clip_path(&mut self) {
unsafe { ffi::qtc_qpainter_reset_clip_path(self.0) }
}
pub fn set_composition_mode(&mut self, mode: CompositionMode) {
unsafe { ffi::qtc_qpainter_set_composition_mode(self.0, mode as ffi::CompositionMode) }
}
pub fn end(&mut self) {
unsafe { ffi::qtc_qpainter_end(self.0) }
}
}
impl Drop for Painter {
fn drop(&mut self) {
if self.1 {
unsafe { ffi::qtc_qpainter_destroy(self.0) }
}
}
}
pub struct PainterPath(*mut ffi::qtc_qpainterpath);
impl PainterPath {
pub fn new() -> PainterPath {
unsafe { PainterPath(ffi::qtc_qpainterpath_create()) }
}
pub fn move_to(&mut self, x: f64, y: f64) {
unsafe { ffi::qtc_qpainterpath_move_to(self.0, x, y) }
}
pub fn line_to(&mut self, x: f64, y: f64) {
unsafe { ffi::qtc_qpainterpath_line_to(self.0, x, y) }
}
pub fn curve_to(&mut self, x1: f64, y1: f64, x2: f64, y2: f64, x: f64, y: f64) {
unsafe { ffi::qtc_qpainterpath_curve_to(self.0, x1, y1, x2, y2, x, y) }
}
pub fn close_path(&mut self) {
unsafe { ffi::qtc_qpainterpath_close_path(self.0) }
}
pub fn set_fill_rule(&mut self, rule: FillRule) {
unsafe { ffi::qtc_qpainterpath_set_fill_rule(self.0, rule as ffi::FillRule) }
}
}
impl Drop for PainterPath {
fn drop(&mut self) {
unsafe { ffi::qtc_qpainterpath_destroy(self.0) }
}
}
pub struct Transform(*mut ffi::qtc_qtransform);
impl Transform {
pub fn new(a: f64, b: f64, c: f64, d: f64, e: f64, f: f64) -> Transform {
unsafe { Transform(ffi::qtc_qtransform_create_from(a, b, c, d, e, f)) }
}
pub fn data(&self) -> (f64, f64, f64, f64, f64, f64) {
let ts = unsafe { ffi::qtc_qtransform_get_data(self.0) };
(ts.a, ts.b, ts.c, ts.d, ts.e, ts.f)
}
}
impl Default for Transform {
fn default() -> Transform {
unsafe { Transform(ffi::qtc_qtransform_create()) }
}
}
impl Drop for Transform {
fn drop(&mut self) {
unsafe { ffi::qtc_qtransform_destroy(self.0) }
}
}
pub struct Pen(*mut ffi::qtc_qpen);
impl Pen {
pub fn new() -> Pen {
unsafe { Pen(ffi::qtc_qpen_create()) }
}
pub fn set_color(&mut self, r: u8, g: u8, b: u8, a: u8) {
unsafe { ffi::qtc_qpen_set_color(self.0, r, g, b, a) }
}
pub fn set_brush(&mut self, brush: Brush) {
unsafe { ffi::qtc_qpen_set_brush(self.0, brush.0) }
}
pub fn set_line_cap(&mut self, s: LineCap) {
unsafe { ffi::qtc_qpen_set_line_cap(self.0, s as ffi::PenCapStyle) }
}
pub fn set_line_join(&mut self, s: LineJoin) {
unsafe { ffi::qtc_qpen_set_line_join(self.0, s as ffi::PenJoinStyle) }
}
pub fn set_width(&mut self, width: f64) {
unsafe { ffi::qtc_qpen_set_width(self.0, width) }
}
pub fn set_miter_limit(&mut self, limit: f64) {
unsafe { ffi::qtc_qpen_set_miter_limit(self.0, limit) }
}
pub fn set_dash_offset(&mut self, offset: f64) {
unsafe { ffi::qtc_qpen_set_dash_offset(self.0, offset) }
}
pub fn set_dash_array(&mut self, offset: &[f64]) {
assert!(offset.len() < i32::MAX as usize);
unsafe { ffi::qtc_qpen_set_dash_array(self.0, offset.as_ptr(), offset.len() as i32) }
}
}
impl Drop for Pen {
fn drop(&mut self) {
unsafe { ffi::qtc_qpen_destroy(self.0) }
}
}
pub struct Brush(*mut ffi::qtc_qbrush);
impl Brush {
pub fn new() -> Brush {
unsafe { Brush(ffi::qtc_qbrush_create()) }
}
pub fn set_color(&mut self, r: u8, g: u8, b: u8, a: u8) {
unsafe { ffi::qtc_qbrush_set_color(self.0, r, g, b, a) }
}
pub fn set_linear_gradient(&mut self, lg: LinearGradient) {
unsafe { ffi::qtc_qbrush_set_linear_gradient(self.0, lg.0) }
}
pub fn set_radial_gradient(&mut self, rg: RadialGradient) {
unsafe { ffi::qtc_qbrush_set_radial_gradient(self.0, rg.0) }
}
pub fn set_pattern(&mut self, img: Image) {
unsafe { ffi::qtc_qbrush_set_pattern(self.0, img.0) }
}
pub fn set_transform(&mut self, ts: Transform) {
unsafe { ffi::qtc_qbrush_set_transform(self.0, ts.0) }
}
}
impl Drop for Brush {
fn drop(&mut self) {
unsafe { ffi::qtc_qbrush_destroy(self.0) }
}
}
pub trait Gradient {
fn set_color_at(&mut self, offset: f64, r: u8, g: u8, b: u8, a: u8);
fn set_spread(&mut self, spread: Spread);
}
pub struct LinearGradient(*mut ffi::qtc_qlineargradient);
impl LinearGradient {
pub fn new(x1: f64, y1: f64, x2: f64, y2: f64) -> LinearGradient {
unsafe { LinearGradient(ffi::qtc_qlineargradient_create(x1, y1, x2, y2)) }
}
}
impl Gradient for LinearGradient {
fn set_color_at(&mut self, offset: f64, r: u8, g: u8, b: u8, a: u8) {
unsafe { ffi::qtc_qlineargradient_set_color_at(self.0, offset, r, g, b, a) }
}
fn set_spread(&mut self, spread: Spread) {
unsafe { ffi::qtc_qlineargradient_set_spread(self.0, spread as ffi::Spread) }
}
}
impl Drop for LinearGradient {
fn drop(&mut self) {
unsafe { ffi::qtc_qlineargradient_destroy(self.0) }
}
}
pub struct RadialGradient(*mut ffi::qtc_qradialgradient);
impl RadialGradient {
pub fn new(cx: f64, cy: f64, fx: f64, fy: f64, r: f64) -> RadialGradient {
unsafe { RadialGradient(ffi::qtc_qradialgradient_create(cx, cy, fx, fy, r)) }
}
}
impl Gradient for RadialGradient {
fn set_color_at(&mut self, offset: f64, r: u8, g: u8, b: u8, a: u8) {
unsafe { ffi::qtc_qradialgradient_set_color_at(self.0, offset, r, g, b, a) }
}
fn set_spread(&mut self, spread: Spread) {
unsafe { ffi::qtc_qradialgradient_set_spread(self.0, spread as ffi::Spread) }
}
}
impl Drop for RadialGradient {
fn drop(&mut self) {
unsafe { ffi::qtc_qradialgradient_destroy(self.0) }
}
}
resvg-0.8.0/bindings/resvg-skia/ 0000775 0000000 0000000 00000000000 13525763757 0016541 5 ustar 00root root 0000000 0000000 resvg-0.8.0/bindings/resvg-skia/Cargo.toml 0000664 0000000 0000000 00000000576 13525763757 0020501 0 ustar 00root root 0000000 0000000 [package]
name = "resvg-skia"
version = "0.8.0"
authors = ["JaFenix ", "Reizner Evgeniy "]
keywords = ["skia", "ffi"]
license = "MIT"
edition = "2018"
description = "A minimal bindings to Skia used by resvg."
repository = "https://github.com/RazrFalcon/resvg"
workspace = "../.."
[build-dependencies]
cc = "1.0"
pkg-config = "0.3"
resvg-0.8.0/bindings/resvg-skia/LICENSE.txt 0000664 0000000 0000000 00000002050 13525763757 0020361 0 ustar 00root root 0000000 0000000 MIT License
Copyright (c) 2019 JaFenix
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
resvg-0.8.0/bindings/resvg-skia/build.rs 0000664 0000000 0000000 00000004052 13525763757 0020207 0 ustar 00root root 0000000 0000000 #[cfg(target_os = "windows")]
fn main() {
use std::env;
use std::path::Path;
let skia_dir = env::var("SKIA_DIR").expect("SKIA_DIR is not set");
let skia_path = Path::new(&skia_dir);
let mut build = cc::Build::new();
let tool = build.get_compiler();
build.cpp(true);
build.file("cpp/skia_capi.cpp").include("cpp");
if env::var("SKIA_VER_M58").is_ok() {
build.define("SKIA_VER_M58", None);
build.include(skia_path.join("include").join("core"));
build.include(skia_path.join("include").join("config"));
build.include(skia_path.join("include").join("effects"));
} else {
build.include(skia_path);
}
if tool.is_like_msvc() {
build.compile("libskiac.lib");
} else {
build.flag("-std=c++14");
build.compile("libskiac.a");
}
let skia_lib_dir = env::var("SKIA_LIB_DIR").expect("SKIA_LIB_DIR is not set");
let skia_lib_path = Path::new(&skia_lib_dir);
println!("cargo:rustc-link-search={}", skia_lib_path.display()); // for MSVC
println!("cargo:rustc-link-lib=skia.dll");
}
#[cfg(any(target_os = "linux", target_os = "macos"))]
fn main() {
use std::env;
use std::path::Path;
let skia_dir = env::var("SKIA_DIR").expect("SKIA_DIR is not set");
let skia_path = Path::new(&skia_dir);
let mut build = cc::Build::new();
build.cpp(true);
build.file("cpp/skia_capi.cpp").include("cpp");
if env::var("SKIA_VER_M58").is_ok() {
build.define("SKIA_VER_M58", None);
build.include(skia_path.join("include").join("core"));
build.include(skia_path.join("include").join("config"));
build.include(skia_path.join("include").join("effects"));
} else {
build.include(skia_path);
}
build.flag("-std=c++14");
build.compile("libskiac.a");
let skia_lib_dir = env::var("SKIA_LIB_DIR").expect("SKIA_LIB_DIR is not set");
let skia_lib_path = Path::new(&skia_lib_dir);
println!("cargo:rustc-link-search={}", skia_lib_path.display());
println!("cargo:rustc-link-lib=skia");
}
resvg-0.8.0/bindings/resvg-skia/cpp/ 0000775 0000000 0000000 00000000000 13525763757 0017323 5 ustar 00root root 0000000 0000000 resvg-0.8.0/bindings/resvg-skia/cpp/skia_capi.cpp 0000664 0000000 0000000 00000034240 13525763757 0021755 0 ustar 00root root 0000000 0000000 #include
#ifdef SKIA_VER_M58
#include
#include
#include
#include
#include
#include
#else
#include
#include
#include
#include
#include
#include
#include
#endif
#include
#include "skia_capi.hpp"
#define SURFACE_CAST reinterpret_cast(c_surface)
#define CANVAS_CAST reinterpret_cast(c_canvas)
#define PAINT_CAST reinterpret_cast(c_paint)
#define PATH_CAST reinterpret_cast(c_path)
#define MATRIX_CAST reinterpret_cast(c_matrix)
static SkBlendMode blendModes_[static_cast(BlendMode::__Size)] = {
SkBlendMode::kClear,
SkBlendMode::kSrcOver,
SkBlendMode::kDstOver,
SkBlendMode::kSrcIn,
SkBlendMode::kDstIn,
SkBlendMode::kSrcOut,
SkBlendMode::kDstOut,
SkBlendMode::kSrcATop,
SkBlendMode::kXor,
SkBlendMode::kMultiply,
SkBlendMode::kScreen,
SkBlendMode::kDarken,
SkBlendMode::kLighten,
};
extern "C" {
// Surface
static SkSurface* skiac_surface_create(int width, int height, SkAlphaType alphaType)
{
// Init() is indempotent, so can be called more than once with no adverse effect.
SkGraphics::Init();
SkImageInfo info = SkImageInfo::Make(width, height, kN32_SkColorType, alphaType);
sk_sp surface = SkSurface::MakeRaster(info);
// The surface ref count will equal one after the pointer is returned.
return surface.release();
}
skiac_surface* skiac_surface_create_rgba_premultiplied(int width, int height)
{
return reinterpret_cast(skiac_surface_create(width, height, kPremul_SkAlphaType));
}
skiac_surface* skiac_surface_create_rgba(int width, int height)
{
return reinterpret_cast(skiac_surface_create(width, height, kUnpremul_SkAlphaType));
}
SkSurface* skiac_surface_create_data(sk_sp data)
{
SkSurface* surface = nullptr;
sk_sp image = SkImage::MakeFromEncoded(data);
if (image) {
surface = skiac_surface_create(image->width(), image->height(), kPremul_SkAlphaType);
}
if (surface) {
surface->getCanvas()->drawImage(image, 0, 0);
}
return surface;
}
bool skiac_surface_save(skiac_surface* c_surface, const char *path)
{
sk_sp image = SURFACE_CAST->makeImageSnapshot();
#ifdef SKIA_VER_M58
SkData *data = image->encode(SkEncodedImageFormat::kPNG, 0);
if (data) {
SkFILEWStream stream(path);
if (stream.write(data->data(), data->size())) {
stream.flush();
return true;
}
}
#else
SkPngEncoder::Options opt;
opt.fZLibLevel = 2; // Use a lower ratio to speed up compression.
SkPixmap pixmap;
if (SURFACE_CAST->getCanvas()->peekPixels(&pixmap)) {
SkFILEWStream stream(path);
SkPngEncoder::Encode(&stream, pixmap, opt);
return true;
}
#endif
return false;
}
void skiac_surface_destroy(skiac_surface* c_surface)
{
// SkSurface is ref counted.
SkSurface* surface = reinterpret_cast(c_surface);
SkSafeUnref(surface);
}
skiac_surface* skiac_surface_copy_rgba(skiac_surface *c_surface, uint32_t x, uint32_t y, uint32_t width, uint32_t height)
{
// x, y, width, height are source rectangle coordinates.
SkSurface* copy = skiac_surface_create((int)width, (int)height, kUnpremul_SkAlphaType);
SkPaint paint;
paint.setFilterQuality(SkFilterQuality::kLow_SkFilterQuality);
paint.setAlpha(SK_AlphaOPAQUE);
// The original surface draws itself to the copy's canvas.
SURFACE_CAST->draw(copy->getCanvas(), -(SkScalar)x, -(SkScalar)y, &paint);
return reinterpret_cast(copy);
}
int skiac_surface_get_width(skiac_surface* c_surface)
{
return SURFACE_CAST->width();
}
int skiac_surface_get_height(skiac_surface* c_surface)
{
return SURFACE_CAST->height();
}
skiac_canvas* skiac_surface_get_canvas(skiac_surface* c_surface)
{
return reinterpret_cast(SURFACE_CAST->getCanvas());
}
void skiac_surface_read_pixels(skiac_surface* c_surface, skiac_surface_data* data)
{
data->ptr = nullptr;
data->size = 0;
SkPixmap pixmap;
if (SURFACE_CAST->getCanvas()->peekPixels(&pixmap)) {
data->ptr = static_cast(pixmap.writable_addr());
#ifdef SKIA_VER_M58
data->size = static_cast(pixmap.getSafeSize());
#else
data->size = static_cast(pixmap.computeByteSize());
#endif
}
}
bool skiac_is_surface_bgra()
{
return kN32_SkColorType == kBGRA_8888_SkColorType;
}
// Canvas
void skiac_canvas_clear(skiac_canvas* c_canvas, uint32_t color)
{
CANVAS_CAST->clear(static_cast(color));
}
void skiac_canvas_flush(skiac_canvas* c_canvas)
{
CANVAS_CAST->flush();
}
void skiac_canvas_set_matrix(skiac_canvas* c_canvas, skiac_matrix* c_matrix)
{
CANVAS_CAST->setMatrix(*MATRIX_CAST);
}
void skiac_canvas_concat(skiac_canvas* c_canvas, skiac_matrix* c_matrix)
{
CANVAS_CAST->concat(*MATRIX_CAST);
}
void skiac_canvas_scale(skiac_canvas* c_canvas, double sx, double sy)
{
CANVAS_CAST->scale((SkScalar)sx, (SkScalar)sy);
}
void skiac_canvas_translate(skiac_canvas* c_canvas, double dx, double dy)
{
CANVAS_CAST->translate((SkScalar)dx, (SkScalar)dy);
}
skiac_matrix* skiac_canvas_get_total_matrix(skiac_canvas* c_canvas)
{
SkMatrix* matrix = new SkMatrix();
*matrix = CANVAS_CAST->getTotalMatrix();
return reinterpret_cast(matrix);
}
void skiac_canvas_draw_path(skiac_canvas* c_canvas, skiac_path* c_path, skiac_paint* c_paint)
{
CANVAS_CAST->drawPath(*PATH_CAST, *PAINT_CAST);
}
void skiac_canvas_draw_rect(skiac_canvas* c_canvas, double x, double y, double w, double h, skiac_paint* c_paint)
{
SkRect rect = SkRect::MakeXYWH((SkScalar)x, (SkScalar)y, (SkScalar)w, (SkScalar)h);
CANVAS_CAST->drawRect(rect, *PAINT_CAST);
}
void skiac_canvas_draw_surface(skiac_canvas* c_canvas, skiac_surface* c_surface, double left,
double top, uint8_t alpha, BlendMode blendMode,
FilterQuality filterQuality)
{
sk_sp image = SURFACE_CAST->makeImageSnapshot();
SkPaint paint;
paint.setFilterQuality((SkFilterQuality)filterQuality);
paint.setAlpha(alpha);
paint.setBlendMode(blendModes_[static_cast(blendMode)]);
CANVAS_CAST->drawImage(image, (SkScalar)left, (SkScalar)top, &paint);
}
void skiac_canvas_draw_surface_rect(skiac_canvas* c_canvas, skiac_surface* c_surface,
double x, double y, double w, double h,
FilterQuality filterQuality)
{
sk_sp image = SURFACE_CAST->makeImageSnapshot();
SkPaint paint;
paint.setFilterQuality((SkFilterQuality)filterQuality);
SkRect src = SkRect::MakeXYWH(0, 0, (SkScalar)image->width(), (SkScalar)image->height());
SkRect dst = SkRect::MakeXYWH((SkScalar)x, (SkScalar)y, (SkScalar)w, (SkScalar)h);
CANVAS_CAST->drawImageRect(image, src, dst, &paint);
}
void skiac_canvas_reset_matrix(skiac_canvas* c_canvas)
{
CANVAS_CAST->resetMatrix();
}
void skiac_canvas_clip_rect(skiac_canvas* c_canvas, double x, double y, double w, double h)
{
SkRect rect = SkRect::MakeXYWH((SkScalar)x, (SkScalar)y, (SkScalar)w, (SkScalar)h);
CANVAS_CAST->clipRect(rect, true);
}
void skiac_canvas_save(skiac_canvas* c_canvas)
{
CANVAS_CAST->save();
}
void skiac_canvas_restore(skiac_canvas* c_canvas)
{
CANVAS_CAST->restore();
}
// SkMatrix
skiac_matrix *skiac_matrix_create()
{
SkMatrix* matrix = new SkMatrix();
matrix->reset();
return reinterpret_cast(matrix);
}
skiac_matrix *skiac_matrix_create_from(double a, double b, double c, double d, double e, double f)
{
SkMatrix* matrix = new SkMatrix();
matrix->setAll((SkScalar)a, (SkScalar)c, (SkScalar)e, (SkScalar)b, (SkScalar)d, (SkScalar)f, 0.0f, 0.0f, 1.0f);
return reinterpret_cast(matrix);
}
skiac_matrix *skiac_matrix_create_inverse(skiac_matrix *c_matrix)
{
SkMatrix* inverse = new SkMatrix();
if (MATRIX_CAST->invert(inverse)) {
return reinterpret_cast(inverse);
} else {
return nullptr;
}
}
skia_matrix skiac_matrix_get_data(skiac_matrix *c_matrix)
{
const auto mat = MATRIX_CAST;
skia_matrix raw_mat;
raw_mat.a = (double)mat->getScaleX();
raw_mat.b = (double)mat->getSkewY();
raw_mat.c = (double)mat->getSkewX();
raw_mat.d = (double)mat->getScaleY();
raw_mat.e = (double)mat->getTranslateX();
raw_mat.f = (double)mat->getTranslateY();
return raw_mat;
}
void skiac_matrix_destroy(skiac_matrix *c_matrix)
{
// SkMatrix is NOT ref counted
delete MATRIX_CAST;
}
// Paint
skiac_paint* skiac_paint_create()
{
SkPaint* paint = new SkPaint();
return reinterpret_cast(paint);
}
void skiac_paint_destroy(skiac_paint* c_paint)
{
SkPaint* paint = PAINT_CAST;
// Setting these references to nullptr should decrement their ref count.
paint->setShader(nullptr);
paint->setPathEffect(nullptr);
// SkPaint is not ref counted, so explicitly delete.
delete paint;
}
void skiac_paint_set_color(skiac_paint* c_paint, uint8_t r, uint8_t g, uint8_t b, uint8_t a)
{
PAINT_CAST->setARGB(a, r, g, b);
}
void skiac_paint_set_alpha(skiac_paint* c_paint, uint8_t a)
{
PAINT_CAST->setAlpha(a);
}
void skiac_paint_set_anti_alias(skiac_paint* c_paint, bool aa)
{
PAINT_CAST->setAntiAlias(aa);
}
void skiac_paint_set_blend_mode(skiac_paint* c_paint, BlendMode blendMode)
{
PAINT_CAST->setBlendMode(blendModes_[static_cast(blendMode)]);
}
void skiac_paint_set_shader(skiac_paint* c_paint, skiac_shader* c_shader)
{
sk_sp shader(reinterpret_cast(c_shader));
PAINT_CAST->setShader(shader);
}
void skiac_paint_set_style(skiac_paint* c_paint, PaintStyle style)
{
PAINT_CAST->setStyle((SkPaint::Style)style);
}
void skiac_paint_set_stroke_width(skiac_paint* c_paint, double width)
{
PAINT_CAST->setStrokeWidth((SkScalar)width);
}
void skiac_paint_set_stroke_cap(skiac_paint* c_paint, StrokeCap cap)
{
PAINT_CAST->setStrokeCap((SkPaint::Cap)cap);
}
void skiac_paint_set_stroke_join(skiac_paint* c_paint, StrokeJoin join)
{
PAINT_CAST->setStrokeJoin((SkPaint::Join)join);
}
void skiac_paint_set_stroke_miter(skiac_paint* c_paint, float miter)
{
PAINT_CAST->setStrokeMiter(miter);
}
void skiac_paint_set_path_effect(skiac_paint* c_paint, skiac_path_effect* c_path_effect)
{
sk_sp pathEffect(reinterpret_cast(c_path_effect));
PAINT_CAST->setPathEffect(pathEffect);
}
// Path
skiac_path* skiac_path_create()
{
return reinterpret_cast(new SkPath());
}
void skiac_path_destroy(skiac_path* c_path)
{
// SkPath is NOT ref counted
delete PATH_CAST;
}
void skiac_path_set_fill_type(skiac_path* c_path, FillType type)
{
PATH_CAST->setFillType((SkPath::FillType)type);
}
void skiac_path_move_to(skiac_path* c_path, double x, double y)
{
PATH_CAST->moveTo((SkScalar)x, (SkScalar)y);
}
void skiac_path_line_to(skiac_path* c_path, double x, double y)
{
PATH_CAST->lineTo((SkScalar)x, (SkScalar)y);
}
void skiac_path_cubic_to(skiac_path* c_path, double x1, double y1, double x2, double y2, double x3, double y3)
{
PATH_CAST->cubicTo((SkScalar)x1, (SkScalar)y1, (SkScalar)x2, (SkScalar)y2, (SkScalar)x3, (SkScalar)y3);
}
void skiac_path_close(skiac_path* c_path)
{
PATH_CAST->close();
}
// PathEffect
skiac_path_effect* skiac_path_effect_make_dash_path(const float* intervals, int count, float phase)
{
SkPathEffect* effect = SkDashPathEffect::Make(intervals, count, phase).release();
effect->ref();
return reinterpret_cast(effect);
}
void skiac_path_effect_destroy(skiac_path_effect* c_path_effect)
{
// SkPathEffect is ref counted.
SkPathEffect* effect = reinterpret_cast(c_path_effect);
SkSafeUnref(effect);
}
// Shader
skiac_shader* skiac_shader_make_linear_gradient(
const skia_point* c_points, const uint32_t* colors,
const float* positions, int count, TileMode tile_mode,
uint32_t flags, skiac_matrix *c_matrix)
{
const SkPoint* points = reinterpret_cast(c_points);
#ifdef SKIA_VER_M58
auto skia_tile_mode = (SkShader::TileMode)tile_mode;
#else
auto skia_tile_mode = (SkTileMode)tile_mode;
#endif
SkShader* shader = SkGradientShader::MakeLinear(
points, colors, positions, count, skia_tile_mode,
flags, MATRIX_CAST
).release();
shader->ref();
return reinterpret_cast(shader);
}
skiac_shader* skiac_shader_make_two_point_conical_gradient(
const skia_point c_start_point, SkScalar start_radius,
const skia_point c_end_point, SkScalar end_radius,
const uint32_t* colors, const SkScalar* positions,
int count, TileMode tile_mode,
uint32_t flags, skiac_matrix *c_matrix)
{
const SkPoint startPoint = { c_start_point.x, c_start_point.y };
const SkPoint endPoint = { c_end_point.x, c_end_point.y };
#ifdef SKIA_VER_M58
auto skia_tile_mode = (SkShader::TileMode)tile_mode;
#else
auto skia_tile_mode = (SkTileMode)tile_mode;
#endif
SkShader* shader = SkGradientShader::MakeTwoPointConical(
startPoint, start_radius,
endPoint, end_radius,
colors, positions, count, skia_tile_mode,
flags, MATRIX_CAST
).release();
shader->ref();
return reinterpret_cast(shader);
}
skiac_shader* skiac_shader_make_from_surface_image(skiac_surface* c_surface, skiac_matrix* c_matrix)
{
#ifdef SKIA_VER_M58
auto skia_tile_mode = SkShader::TileMode::kRepeat_TileMode;
#else
auto skia_tile_mode = SkTileMode::kRepeat;
#endif
sk_sp image = SURFACE_CAST->makeImageSnapshot();
SkShader* shader = image->makeShader(skia_tile_mode, skia_tile_mode, MATRIX_CAST).release();
shader->ref();
return reinterpret_cast(shader);
}
void skiac_shader_destroy(skiac_shader* c_shader)
{
// SkShader is ref counted.
SkShader* shader = reinterpret_cast(c_shader);
SkSafeUnref(shader);
}
}
resvg-0.8.0/bindings/resvg-skia/cpp/skia_capi.hpp 0000664 0000000 0000000 00000014022 13525763757 0021756 0 ustar 00root root 0000000 0000000 #ifndef SKIA_CAPI_H
#define SKIA_CAPI_H
#include
#define INIT_STRUCT(x) \
struct x; \
typedef struct x x;
INIT_STRUCT(skiac_surface)
INIT_STRUCT(skiac_canvas)
INIT_STRUCT(skiac_matrix)
INIT_STRUCT(skiac_paint)
INIT_STRUCT(skiac_path)
INIT_STRUCT(skiac_shader)
INIT_STRUCT(skiac_path_effect)
#undef INIT_STRUCT
struct skia_matrix {
double a;
double b;
double c;
double d;
double e;
double f;
};
struct skia_point {
float x;
float y;
};
struct skiac_surface_data {
uint8_t *ptr;
uint32_t size;
};
// The same order as in core/SkPaint.h
enum class PaintStyle {
Fill,
Stroke,
};
// The same order as in core/SkPaint.h
enum class StrokeCap {
Butt,
Round,
Square,
};
// The same order as in core/SkPaint.h
enum class StrokeJoin {
Miter,
Round,
Bevel,
};
// The same order as in core/SkPath.h
enum class FillType {
Winding,
EvenOdd,
};
// The same order as in core/SkTileMode.h
enum class TileMode {
Clamp,
Repeat,
Mirror,
};
enum class BlendMode {
Clear = 0,
SourceOver = 1,
DestinationOver = 2,
SourceIn = 3,
DestinationIn = 4,
SourceOut = 5,
DestinationOut = 6,
SourceAtop = 7,
Xor = 8,
Multiply = 9,
Screen = 10,
Darken = 11,
Lighten = 12,
__Size
};
// The same order as in core/SkFilterQuality.h
enum class FilterQuality {
None,
Low,
Medium,
High,
};
extern "C" {
// Surface
skiac_surface* skiac_surface_create_rgba_premultiplied(int width, int height);
skiac_surface* skiac_surface_create_rgba(int width, int height);
void skiac_surface_destroy(skiac_surface* c_surface);
skiac_surface* skiac_surface_copy_rgba(skiac_surface *c_surface, uint32_t x, uint32_t y, uint32_t width, uint32_t height);
bool skiac_surface_save(skiac_surface* c_surface, const char *path);
skiac_canvas* skiac_surface_get_canvas(skiac_surface* c_surface);
int skiac_surface_get_width(skiac_surface *c_surface);
int skiac_surface_get_height(skiac_surface *c_surface);
void skiac_surface_read_pixels(skiac_surface* c_surface, skiac_surface_data* data);
bool skiac_is_surface_bgra();
// Canvas
void skiac_canvas_clear(skiac_canvas* c_canvas, uint32_t color);
void skiac_canvas_flush(skiac_canvas* c_canvas);
void skiac_canvas_set_matrix(skiac_canvas* c_canvas, skiac_matrix *c_matrix);
void skiac_canvas_concat(skiac_canvas* c_canvas, skiac_matrix* c_matrix);
void skiac_canvas_scale(skiac_canvas* c_canvas, double sx, double sy);
void skiac_canvas_translate(skiac_canvas* c_canvas, double dx, double dy);
skiac_matrix* skiac_canvas_get_total_matrix(skiac_canvas* c_canvas);
void skiac_canvas_draw_path(skiac_canvas* c_canvas, skiac_path* c_path, skiac_paint* c_paint);
void skiac_canvas_draw_rect(skiac_canvas* c_canvas, double x, double y, double w, double h, skiac_paint* c_paint);
void skiac_canvas_draw_surface(skiac_canvas* c_canvas, skiac_surface* c_surface, double left, double top,
uint8_t alpha, BlendMode blendMode, FilterQuality filterQuality);
void skiac_canvas_draw_surface_rect(skiac_canvas* c_canvas, skiac_surface* c_surface,
double x, double y, double w, double h,
FilterQuality filterQuality);
void skiac_canvas_reset_matrix(skiac_canvas* c_canvas);
void skiac_canvas_clip_rect(skiac_canvas* c_canvas, double x, double y, double w, double h);
void skiac_canvas_save(skiac_canvas* c_canvas);
void skiac_canvas_restore(skiac_canvas* c_canvas);
// Matrix
skiac_matrix *skiac_matrix_create();
skiac_matrix *skiac_matrix_create_from(double a, double b, double c, double d, double e, double f);
skiac_matrix *skiac_matrix_create_inverse(skiac_matrix *c_matrix);
skia_matrix skiac_matrix_get_data(skiac_matrix *c_matrix);
void skiac_matrix_destroy(skiac_matrix *c_matrix);
// Paint
skiac_paint* skiac_paint_create();
void skiac_paint_destroy(skiac_paint* c_paint);
void skiac_paint_set_style(skiac_paint* c_paint, PaintStyle style);
void skiac_paint_set_color(skiac_paint* c_paint, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
void skiac_paint_set_alpha(skiac_paint* c_paint, uint8_t a);
void skiac_paint_set_anti_alias(skiac_paint* c_paint, bool aa);
void skiac_paint_set_blend_mode(skiac_paint* c_paint, BlendMode blendMode);
void skiac_paint_set_shader(skiac_paint* c_paint, skiac_shader* c_shader);
void skiac_paint_set_stroke_width(skiac_paint* c_paint, double width);
void skiac_paint_set_stroke_cap(skiac_paint* c_paint, StrokeCap cap);
void skiac_paint_set_stroke_join(skiac_paint* c_paint, StrokeJoin join);
void skiac_paint_set_stroke_miter(skiac_paint* c_paint, float miter);
void skiac_paint_set_path_effect(skiac_paint* c_paint, skiac_path_effect* c_path_effect);
// Path
skiac_path* skiac_path_create();
void skiac_path_destroy(skiac_path* c_path);
void skiac_path_set_fill_type(skiac_path* c_path, FillType type);
void skiac_path_move_to(skiac_path* c_path, double x, double y);
void skiac_path_line_to(skiac_path* c_path, double x, double y);
void skiac_path_cubic_to(skiac_path* c_path, double x1, double y1, double x2, double y2, double x3, double y3);
void skiac_path_close(skiac_path* c_path);
// PathEffect
skiac_path_effect* skiac_path_effect_make_dash_path(const float* intervals, int count, float phase);
void skiac_path_effect_destroy(skiac_path_effect* c_path_effect);
// Shader
skiac_shader* skiac_shader_make_linear_gradient(const skia_point* points, const uint32_t* colors,
const float* positions, int count, TileMode tile_mode,
uint32_t flags, skiac_matrix *c_matrix);
skiac_shader* skiac_shader_make_two_point_conical_gradient(
const skia_point start_point, float start_radius,
const skia_point end_point, float end_radius,
const uint32_t* colors, const float* positions,
int count, TileMode tile_mode,
uint32_t flags, skiac_matrix *c_matrix);
skiac_shader* skiac_shader_make_from_surface_image(skiac_surface* c_surface, skiac_matrix *c_matrix);
void skiac_shader_destroy(skiac_shader* c_shader);
}
#endif // SKIA_CAPI_H
resvg-0.8.0/bindings/resvg-skia/src/ 0000775 0000000 0000000 00000000000 13525763757 0017330 5 ustar 00root root 0000000 0000000 resvg-0.8.0/bindings/resvg-skia/src/ffi.rs 0000664 0000000 0000000 00000054055 13525763757 0020453 0 ustar 00root root 0000000 0000000 /* automatically generated by rust-bindgen */
pub const _STDINT_H: u32 = 1;
pub const _FEATURES_H: u32 = 1;
pub const _ISOC95_SOURCE: u32 = 1;
pub const _ISOC99_SOURCE: u32 = 1;
pub const _ISOC11_SOURCE: u32 = 1;
pub const _POSIX_SOURCE: u32 = 1;
pub const _POSIX_C_SOURCE: u32 = 200809;
pub const _XOPEN_SOURCE: u32 = 700;
pub const _XOPEN_SOURCE_EXTENDED: u32 = 1;
pub const _LARGEFILE64_SOURCE: u32 = 1;
pub const _DEFAULT_SOURCE: u32 = 1;
pub const _ATFILE_SOURCE: u32 = 1;
pub const __USE_ISOC11: u32 = 1;
pub const __USE_ISOC99: u32 = 1;
pub const __USE_ISOC95: u32 = 1;
pub const __USE_ISOCXX11: u32 = 1;
pub const __USE_POSIX: u32 = 1;
pub const __USE_POSIX2: u32 = 1;
pub const __USE_POSIX199309: u32 = 1;
pub const __USE_POSIX199506: u32 = 1;
pub const __USE_XOPEN2K: u32 = 1;
pub const __USE_XOPEN2K8: u32 = 1;
pub const __USE_XOPEN: u32 = 1;
pub const __USE_XOPEN_EXTENDED: u32 = 1;
pub const __USE_UNIX98: u32 = 1;
pub const _LARGEFILE_SOURCE: u32 = 1;
pub const __USE_XOPEN2K8XSI: u32 = 1;
pub const __USE_XOPEN2KXSI: u32 = 1;
pub const __USE_LARGEFILE: u32 = 1;
pub const __USE_LARGEFILE64: u32 = 1;
pub const __USE_MISC: u32 = 1;
pub const __USE_ATFILE: u32 = 1;
pub const __USE_GNU: u32 = 1;
pub const __USE_FORTIFY_LEVEL: u32 = 0;
pub const __GLIBC_USE_DEPRECATED_GETS: u32 = 0;
pub const __GLIBC_USE_DEPRECATED_SCANF: u32 = 0;
pub const _STDC_PREDEF_H: u32 = 1;
pub const __STDC_IEC_559__: u32 = 1;
pub const __STDC_IEC_559_COMPLEX__: u32 = 1;
pub const __STDC_ISO_10646__: u32 = 201706;
pub const __GNU_LIBRARY__: u32 = 6;
pub const __GLIBC__: u32 = 2;
pub const __GLIBC_MINOR__: u32 = 29;
pub const _SYS_CDEFS_H: u32 = 1;
pub const __glibc_c99_flexarr_available: u32 = 1;
pub const __WORDSIZE: u32 = 64;
pub const __WORDSIZE_TIME64_COMPAT32: u32 = 1;
pub const __SYSCALL_WORDSIZE: u32 = 64;
pub const __HAVE_GENERIC_SELECTION: u32 = 0;
pub const __GLIBC_USE_LIB_EXT2: u32 = 1;
pub const __GLIBC_USE_IEC_60559_BFP_EXT: u32 = 1;
pub const __GLIBC_USE_IEC_60559_FUNCS_EXT: u32 = 1;
pub const __GLIBC_USE_IEC_60559_TYPES_EXT: u32 = 1;
pub const _BITS_TYPES_H: u32 = 1;
pub const __TIMESIZE: u32 = 64;
pub const _BITS_TYPESIZES_H: u32 = 1;
pub const __OFF_T_MATCHES_OFF64_T: u32 = 1;
pub const __INO_T_MATCHES_INO64_T: u32 = 1;
pub const __RLIM_T_MATCHES_RLIM64_T: u32 = 1;
pub const __FD_SETSIZE: u32 = 1024;
pub const _BITS_TIME64_H: u32 = 1;
pub const _BITS_WCHAR_H: u32 = 1;
pub const _BITS_STDINT_INTN_H: u32 = 1;
pub const _BITS_STDINT_UINTN_H: u32 = 1;
pub const INT8_MIN: i32 = -128;
pub const INT16_MIN: i32 = -32768;
pub const INT32_MIN: i32 = -2147483648;
pub const INT8_MAX: u32 = 127;
pub const INT16_MAX: u32 = 32767;
pub const INT32_MAX: u32 = 2147483647;
pub const UINT8_MAX: u32 = 255;
pub const UINT16_MAX: u32 = 65535;
pub const UINT32_MAX: u32 = 4294967295;
pub const INT_LEAST8_MIN: i32 = -128;
pub const INT_LEAST16_MIN: i32 = -32768;
pub const INT_LEAST32_MIN: i32 = -2147483648;
pub const INT_LEAST8_MAX: u32 = 127;
pub const INT_LEAST16_MAX: u32 = 32767;
pub const INT_LEAST32_MAX: u32 = 2147483647;
pub const UINT_LEAST8_MAX: u32 = 255;
pub const UINT_LEAST16_MAX: u32 = 65535;
pub const UINT_LEAST32_MAX: u32 = 4294967295;
pub const INT_FAST8_MIN: i32 = -128;
pub const INT_FAST16_MIN: i64 = -9223372036854775808;
pub const INT_FAST32_MIN: i64 = -9223372036854775808;
pub const INT_FAST8_MAX: u32 = 127;
pub const INT_FAST16_MAX: u64 = 9223372036854775807;
pub const INT_FAST32_MAX: u64 = 9223372036854775807;
pub const UINT_FAST8_MAX: u32 = 255;
pub const UINT_FAST16_MAX: i32 = -1;
pub const UINT_FAST32_MAX: i32 = -1;
pub const INTPTR_MIN: i64 = -9223372036854775808;
pub const INTPTR_MAX: u64 = 9223372036854775807;
pub const UINTPTR_MAX: i32 = -1;
pub const PTRDIFF_MIN: i64 = -9223372036854775808;
pub const PTRDIFF_MAX: u64 = 9223372036854775807;
pub const SIG_ATOMIC_MIN: i32 = -2147483648;
pub const SIG_ATOMIC_MAX: u32 = 2147483647;
pub const SIZE_MAX: i32 = -1;
pub const WINT_MIN: u32 = 0;
pub const WINT_MAX: u32 = 4294967295;
pub const INT8_WIDTH: u32 = 8;
pub const UINT8_WIDTH: u32 = 8;
pub const INT16_WIDTH: u32 = 16;
pub const UINT16_WIDTH: u32 = 16;
pub const INT32_WIDTH: u32 = 32;
pub const UINT32_WIDTH: u32 = 32;
pub const INT64_WIDTH: u32 = 64;
pub const UINT64_WIDTH: u32 = 64;
pub const INT_LEAST8_WIDTH: u32 = 8;
pub const UINT_LEAST8_WIDTH: u32 = 8;
pub const INT_LEAST16_WIDTH: u32 = 16;
pub const UINT_LEAST16_WIDTH: u32 = 16;
pub const INT_LEAST32_WIDTH: u32 = 32;
pub const UINT_LEAST32_WIDTH: u32 = 32;
pub const INT_LEAST64_WIDTH: u32 = 64;
pub const UINT_LEAST64_WIDTH: u32 = 64;
pub const INT_FAST8_WIDTH: u32 = 8;
pub const UINT_FAST8_WIDTH: u32 = 8;
pub const INT_FAST16_WIDTH: u32 = 64;
pub const UINT_FAST16_WIDTH: u32 = 64;
pub const INT_FAST32_WIDTH: u32 = 64;
pub const UINT_FAST32_WIDTH: u32 = 64;
pub const INT_FAST64_WIDTH: u32 = 64;
pub const UINT_FAST64_WIDTH: u32 = 64;
pub const INTPTR_WIDTH: u32 = 64;
pub const UINTPTR_WIDTH: u32 = 64;
pub const INTMAX_WIDTH: u32 = 64;
pub const UINTMAX_WIDTH: u32 = 64;
pub const PTRDIFF_WIDTH: u32 = 64;
pub const SIG_ATOMIC_WIDTH: u32 = 32;
pub const SIZE_WIDTH: u32 = 64;
pub const WCHAR_WIDTH: u32 = 32;
pub const WINT_WIDTH: u32 = 32;
pub type __u_char = ::std::os::raw::c_uchar;
pub type __u_short = ::std::os::raw::c_ushort;
pub type __u_int = ::std::os::raw::c_uint;
pub type __u_long = ::std::os::raw::c_ulong;
pub type __int8_t = ::std::os::raw::c_schar;
pub type __uint8_t = ::std::os::raw::c_uchar;
pub type __int16_t = ::std::os::raw::c_short;
pub type __uint16_t = ::std::os::raw::c_ushort;
pub type __int32_t = ::std::os::raw::c_int;
pub type __uint32_t = ::std::os::raw::c_uint;
pub type __int64_t = ::std::os::raw::c_long;
pub type __uint64_t = ::std::os::raw::c_ulong;
pub type __int_least8_t = __int8_t;
pub type __uint_least8_t = __uint8_t;
pub type __int_least16_t = __int16_t;
pub type __uint_least16_t = __uint16_t;
pub type __int_least32_t = __int32_t;
pub type __uint_least32_t = __uint32_t;
pub type __int_least64_t = __int64_t;
pub type __uint_least64_t = __uint64_t;
pub type __quad_t = ::std::os::raw::c_long;
pub type __u_quad_t = ::std::os::raw::c_ulong;
pub type __intmax_t = ::std::os::raw::c_long;
pub type __uintmax_t = ::std::os::raw::c_ulong;
pub type __dev_t = ::std::os::raw::c_ulong;
pub type __uid_t = ::std::os::raw::c_uint;
pub type __gid_t = ::std::os::raw::c_uint;
pub type __ino_t = ::std::os::raw::c_ulong;
pub type __ino64_t = ::std::os::raw::c_ulong;
pub type __mode_t = ::std::os::raw::c_uint;
pub type __nlink_t = ::std::os::raw::c_ulong;
pub type __off_t = ::std::os::raw::c_long;
pub type __off64_t = ::std::os::raw::c_long;
pub type __pid_t = ::std::os::raw::c_int;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct __fsid_t {
pub __val: [::std::os::raw::c_int; 2usize],
}
#[test]
fn bindgen_test_layout___fsid_t() {
assert_eq!(
::std::mem::size_of::<__fsid_t>(),
8usize,
concat!("Size of: ", stringify!(__fsid_t))
);
assert_eq!(
::std::mem::align_of::<__fsid_t>(),
4usize,
concat!("Alignment of ", stringify!(__fsid_t))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<__fsid_t>())).__val as *const _ as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(__fsid_t),
"::",
stringify!(__val)
)
);
}
pub type __clock_t = ::std::os::raw::c_long;
pub type __rlim_t = ::std::os::raw::c_ulong;
pub type __rlim64_t = ::std::os::raw::c_ulong;
pub type __id_t = ::std::os::raw::c_uint;
pub type __time_t = ::std::os::raw::c_long;
pub type __useconds_t = ::std::os::raw::c_uint;
pub type __suseconds_t = ::std::os::raw::c_long;
pub type __daddr_t = ::std::os::raw::c_int;
pub type __key_t = ::std::os::raw::c_int;
pub type __clockid_t = ::std::os::raw::c_int;
pub type __timer_t = *mut ::std::os::raw::c_void;
pub type __blksize_t = ::std::os::raw::c_long;
pub type __blkcnt_t = ::std::os::raw::c_long;
pub type __blkcnt64_t = ::std::os::raw::c_long;
pub type __fsblkcnt_t = ::std::os::raw::c_ulong;
pub type __fsblkcnt64_t = ::std::os::raw::c_ulong;
pub type __fsfilcnt_t = ::std::os::raw::c_ulong;
pub type __fsfilcnt64_t = ::std::os::raw::c_ulong;
pub type __fsword_t = ::std::os::raw::c_long;
pub type __ssize_t = ::std::os::raw::c_long;
pub type __syscall_slong_t = ::std::os::raw::c_long;
pub type __syscall_ulong_t = ::std::os::raw::c_ulong;
pub type __loff_t = __off64_t;
pub type __caddr_t = *mut ::std::os::raw::c_char;
pub type __intptr_t = ::std::os::raw::c_long;
pub type __socklen_t = ::std::os::raw::c_uint;
pub type __sig_atomic_t = ::std::os::raw::c_int;
pub type int_least8_t = __int_least8_t;
pub type int_least16_t = __int_least16_t;
pub type int_least32_t = __int_least32_t;
pub type int_least64_t = __int_least64_t;
pub type uint_least8_t = __uint_least8_t;
pub type uint_least16_t = __uint_least16_t;
pub type uint_least32_t = __uint_least32_t;
pub type uint_least64_t = __uint_least64_t;
pub type int_fast8_t = ::std::os::raw::c_schar;
pub type int_fast16_t = ::std::os::raw::c_long;
pub type int_fast32_t = ::std::os::raw::c_long;
pub type int_fast64_t = ::std::os::raw::c_long;
pub type uint_fast8_t = ::std::os::raw::c_uchar;
pub type uint_fast16_t = ::std::os::raw::c_ulong;
pub type uint_fast32_t = ::std::os::raw::c_ulong;
pub type uint_fast64_t = ::std::os::raw::c_ulong;
pub type intmax_t = __intmax_t;
pub type uintmax_t = __uintmax_t;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct skiac_context {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct skiac_surface {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct skiac_canvas {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct skiac_matrix {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct skiac_paint {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct skiac_path {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct skiac_shader {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct skiac_path_effect {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct skia_matrix {
pub a: f64,
pub b: f64,
pub c: f64,
pub d: f64,
pub e: f64,
pub f: f64,
}
#[test]
fn bindgen_test_layout_skia_matrix() {
assert_eq!(
::std::mem::size_of::(),
48usize,
concat!("Size of: ", stringify!(skia_matrix))
);
assert_eq!(
::std::mem::align_of::(),
8usize,
concat!("Alignment of ", stringify!(skia_matrix))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::())).a as *const _ as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(skia_matrix),
"::",
stringify!(a)
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::())).b as *const _ as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(skia_matrix),
"::",
stringify!(b)
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::())).c as *const _ as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(skia_matrix),
"::",
stringify!(c)
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::())).d as *const _ as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(skia_matrix),
"::",
stringify!(d)
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::())).e as *const _ as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(skia_matrix),
"::",
stringify!(e)
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::())).f as *const _ as usize },
40usize,
concat!(
"Offset of field: ",
stringify!(skia_matrix),
"::",
stringify!(f)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct skia_point {
pub x: f32,
pub y: f32,
}
#[test]
fn bindgen_test_layout_skia_point() {
assert_eq!(
::std::mem::size_of::(),
8usize,
concat!("Size of: ", stringify!(skia_point))
);
assert_eq!(
::std::mem::align_of::(),
4usize,
concat!("Alignment of ", stringify!(skia_point))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::())).x as *const _ as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(skia_point),
"::",
stringify!(x)
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::())).y as *const _ as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(skia_point),
"::",
stringify!(y)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct skiac_surface_data {
pub ptr: *mut u8,
pub size: u32,
}
#[test]
fn bindgen_test_layout_skiac_surface_data() {
assert_eq!(
::std::mem::size_of::(),
16usize,
concat!("Size of: ", stringify!(skiac_surface_data))
);
assert_eq!(
::std::mem::align_of::(),
8usize,
concat!("Alignment of ", stringify!(skiac_surface_data))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::())).ptr as *const _ as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(skiac_surface_data),
"::",
stringify!(ptr)
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::())).size as *const _ as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(skiac_surface_data),
"::",
stringify!(size)
)
);
}
pub const PaintStyle_Fill: PaintStyle = 0;
pub const PaintStyle_Stroke: PaintStyle = 1;
pub type PaintStyle = i32;
pub const StrokeCap_Butt: StrokeCap = 0;
pub const StrokeCap_Round: StrokeCap = 1;
pub const StrokeCap_Square: StrokeCap = 2;
pub type StrokeCap = i32;
pub const StrokeJoin_Miter: StrokeJoin = 0;
pub const StrokeJoin_Round: StrokeJoin = 1;
pub const StrokeJoin_Bevel: StrokeJoin = 2;
pub type StrokeJoin = i32;
pub const FillType_Winding: FillType = 0;
pub const FillType_EvenOdd: FillType = 1;
pub type FillType = i32;
pub const TileMode_Clamp: TileMode = 0;
pub const TileMode_Repeat: TileMode = 1;
pub const TileMode_Mirror: TileMode = 2;
pub type TileMode = i32;
pub const BlendMode_Clear: BlendMode = 0;
pub const BlendMode_SourceOver: BlendMode = 1;
pub const BlendMode_DestinationOver: BlendMode = 2;
pub const BlendMode_SourceIn: BlendMode = 3;
pub const BlendMode_DestinationIn: BlendMode = 4;
pub const BlendMode_SourceOut: BlendMode = 5;
pub const BlendMode_DestinationOut: BlendMode = 6;
pub const BlendMode_SourceAtop: BlendMode = 7;
pub const BlendMode_Xor: BlendMode = 8;
pub const BlendMode_Multiply: BlendMode = 9;
pub const BlendMode_Screen: BlendMode = 10;
pub const BlendMode_Darken: BlendMode = 11;
pub const BlendMode_Lighten: BlendMode = 12;
pub const BlendMode___Size: BlendMode = 13;
pub type BlendMode = i32;
pub const FilterQuality_None: FilterQuality = 0;
pub const FilterQuality_Low: FilterQuality = 1;
pub const FilterQuality_Medium: FilterQuality = 2;
pub const FilterQuality_High: FilterQuality = 3;
pub type FilterQuality = i32;
extern "C" {
pub fn skiac_surface_create_rgba_premultiplied(
width: ::std::os::raw::c_int,
height: ::std::os::raw::c_int,
) -> *mut skiac_surface;
}
extern "C" {
pub fn skiac_surface_create_rgba(
width: ::std::os::raw::c_int,
height: ::std::os::raw::c_int,
) -> *mut skiac_surface;
}
extern "C" {
pub fn skiac_surface_destroy(c_surface: *mut skiac_surface);
}
extern "C" {
pub fn skiac_surface_copy_rgba(
c_surface: *mut skiac_surface,
x: u32,
y: u32,
width: u32,
height: u32,
) -> *mut skiac_surface;
}
extern "C" {
pub fn skiac_surface_save(
c_surface: *mut skiac_surface,
path: *const ::std::os::raw::c_char,
) -> bool;
}
extern "C" {
pub fn skiac_surface_get_canvas(c_surface: *mut skiac_surface) -> *mut skiac_canvas;
}
extern "C" {
pub fn skiac_surface_get_width(c_surface: *mut skiac_surface) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn skiac_surface_get_height(c_surface: *mut skiac_surface) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn skiac_surface_read_pixels(c_surface: *mut skiac_surface, data: *mut skiac_surface_data);
}
extern "C" {
pub fn skiac_is_surface_bgra() -> bool;
}
extern "C" {
pub fn skiac_canvas_clear(c_canvas: *mut skiac_canvas, color: u32);
}
extern "C" {
pub fn skiac_canvas_flush(c_canvas: *mut skiac_canvas);
}
extern "C" {
pub fn skiac_canvas_set_matrix(c_canvas: *mut skiac_canvas, c_matrix: *mut skiac_matrix);
}
extern "C" {
pub fn skiac_canvas_concat(c_canvas: *mut skiac_canvas, c_matrix: *mut skiac_matrix);
}
extern "C" {
pub fn skiac_canvas_scale(c_canvas: *mut skiac_canvas, sx: f64, sy: f64);
}
extern "C" {
pub fn skiac_canvas_translate(c_canvas: *mut skiac_canvas, dx: f64, dy: f64);
}
extern "C" {
pub fn skiac_canvas_get_total_matrix(c_canvas: *mut skiac_canvas) -> *mut skiac_matrix;
}
extern "C" {
pub fn skiac_canvas_draw_path(
c_canvas: *mut skiac_canvas,
c_path: *mut skiac_path,
c_paint: *mut skiac_paint,
);
}
extern "C" {
pub fn skiac_canvas_draw_rect(
c_canvas: *mut skiac_canvas,
x: f64,
y: f64,
w: f64,
h: f64,
c_paint: *mut skiac_paint,
);
}
extern "C" {
pub fn skiac_canvas_draw_surface(
c_canvas: *mut skiac_canvas,
c_surface: *mut skiac_surface,
left: f64,
top: f64,
alpha: u8,
blendMode: BlendMode,
filterQuality: FilterQuality,
);
}
extern "C" {
pub fn skiac_canvas_draw_surface_rect(
c_canvas: *mut skiac_canvas,
c_surface: *mut skiac_surface,
x: f64,
y: f64,
w: f64,
h: f64,
filterQuality: FilterQuality,
);
}
extern "C" {
pub fn skiac_canvas_reset_matrix(c_canvas: *mut skiac_canvas);
}
extern "C" {
pub fn skiac_canvas_clip_rect(c_canvas: *mut skiac_canvas, x: f64, y: f64, w: f64, h: f64);
}
extern "C" {
pub fn skiac_canvas_save(c_canvas: *mut skiac_canvas);
}
extern "C" {
pub fn skiac_canvas_restore(c_canvas: *mut skiac_canvas);
}
extern "C" {
pub fn skiac_matrix_create() -> *mut skiac_matrix;
}
extern "C" {
pub fn skiac_matrix_create_from(
a: f64,
b: f64,
c: f64,
d: f64,
e: f64,
f: f64,
) -> *mut skiac_matrix;
}
extern "C" {
pub fn skiac_matrix_create_inverse(c_matrix: *mut skiac_matrix) -> *mut skiac_matrix;
}
extern "C" {
pub fn skiac_matrix_get_data(c_matrix: *mut skiac_matrix) -> skia_matrix;
}
extern "C" {
pub fn skiac_matrix_destroy(c_matrix: *mut skiac_matrix);
}
extern "C" {
pub fn skiac_paint_create() -> *mut skiac_paint;
}
extern "C" {
pub fn skiac_paint_destroy(c_paint: *mut skiac_paint);
}
extern "C" {
pub fn skiac_paint_set_style(c_paint: *mut skiac_paint, style: PaintStyle);
}
extern "C" {
pub fn skiac_paint_set_color(c_paint: *mut skiac_paint, r: u8, g: u8, b: u8, a: u8);
}
extern "C" {
pub fn skiac_paint_set_alpha(c_paint: *mut skiac_paint, a: u8);
}
extern "C" {
pub fn skiac_paint_set_anti_alias(c_paint: *mut skiac_paint, aa: bool);
}
extern "C" {
pub fn skiac_paint_set_blend_mode(c_paint: *mut skiac_paint, blendMode: BlendMode);
}
extern "C" {
pub fn skiac_paint_set_shader(c_paint: *mut skiac_paint, c_shader: *mut skiac_shader);
}
extern "C" {
pub fn skiac_paint_set_stroke_width(c_paint: *mut skiac_paint, width: f64);
}
extern "C" {
pub fn skiac_paint_set_stroke_cap(c_paint: *mut skiac_paint, cap: StrokeCap);
}
extern "C" {
pub fn skiac_paint_set_stroke_join(c_paint: *mut skiac_paint, join: StrokeJoin);
}
extern "C" {
pub fn skiac_paint_set_stroke_miter(c_paint: *mut skiac_paint, miter: f32);
}
extern "C" {
pub fn skiac_paint_set_path_effect(
c_paint: *mut skiac_paint,
c_path_effect: *mut skiac_path_effect,
);
}
extern "C" {
pub fn skiac_path_create() -> *mut skiac_path;
}
extern "C" {
pub fn skiac_path_destroy(c_path: *mut skiac_path);
}
extern "C" {
pub fn skiac_path_set_fill_type(c_path: *mut skiac_path, type_: FillType);
}
extern "C" {
pub fn skiac_path_move_to(c_path: *mut skiac_path, x: f64, y: f64);
}
extern "C" {
pub fn skiac_path_line_to(c_path: *mut skiac_path, x: f64, y: f64);
}
extern "C" {
pub fn skiac_path_cubic_to(
c_path: *mut skiac_path,
x1: f64,
y1: f64,
x2: f64,
y2: f64,
x3: f64,
y3: f64,
);
}
extern "C" {
pub fn skiac_path_close(c_path: *mut skiac_path);
}
extern "C" {
pub fn skiac_path_effect_make_dash_path(
intervals: *const f32,
count: ::std::os::raw::c_int,
phase: f32,
) -> *mut skiac_path_effect;
}
extern "C" {
pub fn skiac_path_effect_destroy(c_path_effect: *mut skiac_path_effect);
}
extern "C" {
pub fn skiac_shader_make_linear_gradient(
points: *const skia_point,
colors: *const u32,
positions: *const f32,
count: ::std::os::raw::c_int,
tile_mode: TileMode,
flags: u32,
c_matrix: *mut skiac_matrix,
) -> *mut skiac_shader;
}
extern "C" {
pub fn skiac_shader_make_two_point_conical_gradient(
start_point: skia_point,
start_radius: f32,
end_point: skia_point,
end_radius: f32,
colors: *const u32,
positions: *const f32,
count: ::std::os::raw::c_int,
tile_mode: TileMode,
flags: u32,
c_matrix: *mut skiac_matrix,
) -> *mut skiac_shader;
}
extern "C" {
pub fn skiac_shader_make_from_surface_image(
c_surface: *mut skiac_surface,
c_matrix: *mut skiac_matrix,
) -> *mut skiac_shader;
}
extern "C" {
pub fn skiac_shader_destroy(c_shader: *mut skiac_shader);
}
resvg-0.8.0/bindings/resvg-skia/src/lib.rs 0000664 0000000 0000000 00000032144 13525763757 0020450 0 ustar 00root root 0000000 0000000 use std::ffi::CString;
use std::ops::{Deref, DerefMut};
use std::slice;
#[allow(dead_code)]
#[allow(non_camel_case_types)]
#[allow(non_upper_case_globals)]
mod ffi;
pub use ffi::skiac_surface;
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum PaintStyle {
Fill = 0,
Stroke = 1,
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum FillType {
Winding = 0,
EvenOdd = 1,
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum StrokeCap {
Butt = 0,
Round = 1,
Square = 2,
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum StrokeJoin {
Miter = 0,
Round = 1,
Bevel = 2,
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum TileMode {
Clamp = 0,
Repeat = 1,
Mirror = 2,
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum BlendMode {
Clear = 0,
SourceOver = 1,
DestinationOver = 2,
SourceIn = 3,
DestinationIn = 4,
SourceOut = 5,
DestinationOut = 6,
SourceAtop = 7,
Xor = 8,
Multiply = 9,
Screen = 10,
Darken = 11,
Lighten = 12,
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum FilterQuality {
None = 0,
Low = 1,
Medium = 2,
High = 3,
}
pub struct Surface {
ptr: *mut ffi::skiac_surface,
canvas: Canvas,
}
impl Surface {
pub fn new_rgba(width: u32, height: u32) -> Option {
unsafe {
Self::from_ptr(ffi::skiac_surface_create_rgba(width as i32, height as i32))
}
}
pub fn new_rgba_premultiplied(width: u32, height: u32) -> Option {
unsafe {
Self::from_ptr(ffi::skiac_surface_create_rgba_premultiplied(width as i32, height as i32))
}
}
pub unsafe fn from_ptr(ptr: *mut ffi::skiac_surface) -> Option {
if ptr.is_null() {
None
} else {
Some(Surface {
ptr,
canvas: Canvas(ffi::skiac_surface_get_canvas(ptr))
})
}
}
pub fn destroy(&mut self) {
unsafe { ffi::skiac_surface_destroy(self.ptr); }
}
pub fn copy_rgba(&self, x: u32, y: u32, width: u32, height: u32) -> Option {
unsafe { Self::from_ptr(ffi::skiac_surface_copy_rgba(self.ptr, x, y, width, height)) }
}
pub fn try_clone(&self) -> Option {
unsafe { Self::from_ptr(ffi::skiac_surface_copy_rgba(self.ptr, 0, 0, self.width(), self.height())) }
}
pub fn save_png(&self, path: &str) -> bool {
let c_path = CString::new(path).unwrap();
unsafe { ffi::skiac_surface_save(self.ptr, c_path.as_ptr()) }
}
pub fn width(&self) -> u32 {
unsafe { ffi::skiac_surface_get_width(self.ptr) as u32 }
}
pub fn height(&self) -> u32 {
unsafe { ffi::skiac_surface_get_height(self.ptr) as u32 }
}
pub fn data(&self) -> SurfaceData {
unsafe {
let mut data = ffi::skiac_surface_data {
ptr: std::ptr::null_mut(),
size: 0,
};
ffi::skiac_surface_read_pixels(self.ptr, &mut data);
SurfaceData {
slice: slice::from_raw_parts_mut(data.ptr, data.size as usize),
}
}
}
pub fn data_mut(&mut self) -> SurfaceData {
unsafe {
let mut data = ffi::skiac_surface_data {
ptr: std::ptr::null_mut(),
size: 0,
};
ffi::skiac_surface_read_pixels(self.ptr, &mut data);
SurfaceData {
slice: slice::from_raw_parts_mut(data.ptr, data.size as usize),
}
}
}
pub fn is_bgra() -> bool {
unsafe { ffi::skiac_is_surface_bgra() }
}
}
impl std::ops::Deref for Surface {
type Target = Canvas;
fn deref(&self) -> &Self::Target {
&self.canvas
}
}
impl std::ops::DerefMut for Surface {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.canvas
}
}
impl Drop for Surface {
fn drop(&mut self) {
unsafe {
ffi::skiac_surface_destroy(self.ptr);
}
}
}
pub struct SurfaceData<'a> {
slice: &'a mut [u8],
}
impl<'a> Deref for SurfaceData<'a> {
type Target = [u8];
fn deref(&self) -> &[u8] {
self.slice
}
}
impl<'a> DerefMut for SurfaceData<'a> {
fn deref_mut(&mut self) -> &mut [u8] {
self.slice
}
}
pub struct Color(u8, u8, u8, u8);
impl Color {
pub fn new(a: u8, r: u8, g: u8, b: u8) -> Color {
Color(a, r, g, b)
}
pub fn to_u32(&self) -> u32 {
(self.0 as u32) << 24 | (self.1 as u32) << 16 | (self.2 as u32) << 8 | (self.3 as u32)
}
}
pub struct Matrix(*mut ffi::skiac_matrix);
impl Matrix {
pub fn new() -> Matrix {
unsafe { Matrix(ffi::skiac_matrix_create()) }
}
pub fn new_from(a: f64, b: f64, c: f64, d: f64, e: f64, f: f64) -> Matrix {
unsafe { Matrix(ffi::skiac_matrix_create_from(a, b, c, d, e, f)) }
}
pub fn invert(&self) -> Option {
unsafe {
let ptr = ffi::skiac_matrix_create_inverse(self.0);
if ptr.is_null() {
None
} else {
Some(Matrix(ptr))
}
}
}
pub fn data(&self) -> (f64, f64, f64, f64, f64, f64) {
let mat = unsafe { ffi::skiac_matrix_get_data(self.0) };
(mat.a, mat.b, mat.c, mat.d, mat.e, mat.f)
}
}
impl Default for Matrix {
fn default() -> Matrix {
unsafe { Matrix(ffi::skiac_matrix_create()) }
}
}
impl Drop for Matrix {
fn drop(&mut self) {
unsafe { ffi::skiac_matrix_destroy(self.0) }
}
}
pub struct Canvas(*mut ffi::skiac_canvas);
impl Canvas {
pub fn clear(&mut self) {
unsafe { ffi::skiac_canvas_clear(self.0, 0); }
}
pub fn fill(&mut self, r: u8, g: u8, b: u8, a: u8) {
unsafe { ffi::skiac_canvas_clear(self.0, (a as u32) << 24 | (r as u32) << 16 | (g as u32) << 8 | b as u32); }
}
pub fn flush(&mut self) {
unsafe { ffi::skiac_canvas_flush(self.0); }
}
pub fn set_matrix(&mut self, matrix: &Matrix) {
unsafe { ffi::skiac_canvas_set_matrix(self.0, matrix.0); }
}
pub fn concat(&mut self, matrix: &Matrix) {
unsafe { ffi::skiac_canvas_concat(self.0, matrix.0); }
}
pub fn scale(&mut self, sx: f64, sy: f64) {
unsafe { ffi::skiac_canvas_scale(self.0, sx, sy); }
}
pub fn translate(&mut self, dx: f64, dy: f64) {
unsafe { ffi::skiac_canvas_translate(self.0, dx, dy); }
}
pub fn get_matrix(&self) -> Matrix {
unsafe { Matrix(ffi::skiac_canvas_get_total_matrix(self.0)) }
}
pub fn draw_path(&mut self, path: &Path, paint: &Paint) {
unsafe { ffi::skiac_canvas_draw_path(self.0, path.0, paint.0); }
}
pub fn draw_rect(&mut self, x: f64, y: f64, w: f64, h: f64, paint: &Paint) {
unsafe { ffi::skiac_canvas_draw_rect(self.0, x, y, w, h, paint.0); }
}
pub fn draw_surface(&mut self, surface: &Surface, left: f64, top: f64, alpha: u8,
blend_mode: BlendMode, filter_quality: FilterQuality) {
unsafe {
ffi::skiac_canvas_draw_surface(
self.0, surface.ptr, left, top, alpha, blend_mode as i32, filter_quality as i32,
);
}
}
pub fn draw_surface_rect(&mut self, surface: &Surface, x: f64, y: f64, w: f64, h: f64,
filter_quality: FilterQuality) {
unsafe {
ffi::skiac_canvas_draw_surface_rect(
self.0, surface.ptr, x, y, w, h, filter_quality as i32,
);
}
}
pub fn reset_matrix(&mut self) {
unsafe { ffi::skiac_canvas_reset_matrix(self.0); }
}
pub fn set_clip_rect(&mut self, x: f64, y: f64, w: f64, h: f64) {
unsafe { ffi::skiac_canvas_clip_rect(self.0, x, y, w, h); }
}
pub fn save(&mut self) {
unsafe { ffi::skiac_canvas_save(self.0); }
}
pub fn restore(&mut self) {
unsafe { ffi::skiac_canvas_restore(self.0); }
}
}
pub struct Paint(*mut ffi::skiac_paint);
impl Paint {
pub fn new() -> Paint {
unsafe { Paint(ffi::skiac_paint_create()) }
}
pub fn set_style(&mut self, style: PaintStyle) {
unsafe { ffi::skiac_paint_set_style(self.0, style as i32); }
}
pub fn set_color(&mut self, r: u8, g: u8, b: u8, a: u8) {
unsafe { ffi::skiac_paint_set_color(self.0, r, g, b, a); }
}
pub fn set_alpha(&mut self, a: u8) {
unsafe { ffi::skiac_paint_set_alpha(self.0, a); }
}
pub fn set_anti_alias(&mut self, aa: bool) {
unsafe { ffi::skiac_paint_set_anti_alias(self.0, aa); }
}
pub fn set_blend_mode(&mut self, blend_mode: BlendMode) {
unsafe { ffi::skiac_paint_set_blend_mode(self.0, blend_mode as i32); }
}
pub fn set_shader(&mut self, shader: &Shader) {
unsafe { ffi::skiac_paint_set_shader(self.0, shader.0); }
}
pub fn set_stroke_width(&mut self, width: f64) {
unsafe { ffi::skiac_paint_set_stroke_width(self.0, width); }
}
pub fn set_stroke_cap(&mut self, cap: StrokeCap) {
unsafe { ffi::skiac_paint_set_stroke_cap(self.0, cap as i32); }
}
pub fn set_stroke_join(&mut self, join: StrokeJoin) {
unsafe { ffi::skiac_paint_set_stroke_join(self.0, join as i32); }
}
pub fn set_stroke_miter(&mut self, miter: f64) {
unsafe { ffi::skiac_paint_set_stroke_miter(self.0, miter as f32); }
}
pub fn set_path_effect(&mut self, path_effect: PathEffect) {
unsafe { ffi::skiac_paint_set_path_effect(self.0, path_effect.0); }
}
}
impl Drop for Paint {
fn drop(&mut self) {
unsafe { ffi::skiac_paint_destroy(self.0) }
}
}
pub struct Path(*mut ffi::skiac_path);
impl Path {
pub fn new() -> Path {
unsafe { Path(ffi::skiac_path_create()) }
}
pub fn set_fill_type(&mut self, kind: FillType) {
unsafe { ffi::skiac_path_set_fill_type(self.0, kind as i32); }
}
pub fn move_to(&mut self, x: f64, y: f64) {
unsafe { ffi::skiac_path_move_to(self.0, x, y); }
}
pub fn line_to(&mut self, x: f64, y: f64) {
unsafe { ffi::skiac_path_line_to(self.0, x, y); }
}
pub fn cubic_to(&mut self, x1: f64, y1: f64, x2: f64, y2: f64, x3: f64, y3: f64) {
unsafe { ffi::skiac_path_cubic_to(self.0, x1, y1, x2, y2, x3, y3); }
}
pub fn close(&mut self) {
unsafe { ffi::skiac_path_close(self.0); }
}
}
impl Drop for Path {
fn drop(&mut self) {
unsafe { ffi::skiac_path_destroy(self.0); }
}
}
pub struct Gradient {
pub colors: Vec,
pub positions: Vec,
pub tile_mode: TileMode,
pub matrix: Matrix
}
pub struct LinearGradient {
pub start_point: (f64, f64),
pub end_point: (f64, f64),
pub base: Gradient
}
pub struct RadialGradient {
pub start_circle: (f64, f64, f64),
pub end_circle: (f64, f64, f64),
pub base: Gradient
}
pub struct Shader(*mut ffi::skiac_shader);
impl Shader {
pub fn new_linear_gradient(grad: LinearGradient) -> Shader {
let points = [
ffi::skia_point {x: grad.start_point.0 as f32, y: grad.start_point.1 as f32},
ffi::skia_point {x: grad.end_point.0 as f32, y: grad.end_point.1 as f32}
];
unsafe {
Shader(ffi::skiac_shader_make_linear_gradient(
points.as_ptr(),
grad.base.colors.as_ptr(),
grad.base.positions.as_ptr(),
grad.base.colors.len() as i32,
grad.base.tile_mode as i32,
0 as u32,
grad.base.matrix.0)
)
}
}
pub fn new_radial_gradient(grad: RadialGradient) -> Shader {
let start_point = ffi::skia_point {
x: grad.start_circle.0 as f32,
y: grad.start_circle.1 as f32
};
let end_point = ffi::skia_point {
x: grad.end_circle.0 as f32,
y: grad.end_circle.1 as f32
};
let start_radius = grad.start_circle.2 as f32;
let end_radius = grad.end_circle.2 as f32;
unsafe {
Shader(ffi::skiac_shader_make_two_point_conical_gradient(
start_point, start_radius,
end_point, end_radius,
grad.base.colors.as_ptr(),
grad.base.positions.as_ptr(),
grad.base.colors.len() as i32,
grad.base.tile_mode as i32,
0 as u32,
grad.base.matrix.0)
)
}
}
pub fn new_from_surface_image(surface: &Surface, matrix: Matrix) -> Shader {
unsafe {
Shader(ffi::skiac_shader_make_from_surface_image(surface.ptr, matrix.0))
}
}
}
impl Drop for Shader {
fn drop(&mut self) {
unsafe { ffi::skiac_shader_destroy(self.0); }
}
}
pub struct PathEffect(*mut ffi::skiac_path_effect);
impl PathEffect {
pub fn new_dash_path(intervals: &[f32], phase: f32) -> PathEffect {
unsafe {
PathEffect(ffi::skiac_path_effect_make_dash_path(
intervals.as_ptr(), intervals.len() as i32, phase
))
}
}
}
impl Drop for PathEffect {
fn drop(&mut self) {
unsafe { ffi::skiac_path_effect_destroy(self.0); }
}
}
resvg-0.8.0/capi/ 0000775 0000000 0000000 00000000000 13525763757 0013605 5 ustar 00root root 0000000 0000000 resvg-0.8.0/capi/.gitignore 0000664 0000000 0000000 00000000040 13525763757 0015567 0 ustar 00root root 0000000 0000000 /include/html
/include/Doxyfile
resvg-0.8.0/capi/Cargo.toml 0000664 0000000 0000000 00000001103 13525763757 0015530 0 ustar 00root root 0000000 0000000 [package]
name = "resvg-capi"
version = "0.8.0"
authors = ["Evgeniy Reizner "]
keywords = ["svg", "render", "raster", "capi"]
license = "MPL-2.0"
edition = "2018"
workspace = ".."
[lib]
name = "resvg"
crate-type = ["cdylib", "staticlib"]
[dependencies]
fern = "0.5"
log = "0.4"
resvg = { path = "../" }
# cairo backend
cairo-sys-rs = { version = "0.9.0", optional = true }
[features]
cairo-backend = ["resvg/cairo-backend", "cairo-sys-rs"]
qt-backend = ["resvg/qt-backend"]
skia-backend = ["resvg/skia-backend"]
raqote-backend = ["resvg/raqote-backend"]
resvg-0.8.0/capi/README.md 0000664 0000000 0000000 00000001021 13525763757 0015056 0 ustar 00root root 0000000 0000000 C interface for *resvg*.
## Build
```bash
# Build with a Qt backend
cargo build --release --features="qt-backend"
# or with a cairo backend
cargo build --release --features="cairo-backend"
# or with both.
cargo build --release --features="qt-backend cairo-backend"
```
See [BUILD.adoc](../BUILD.adoc) for details.
## Examples
A usage example with a *cairo* backend can be found at [examples/cairo-capi](../examples/cairo-capi).
A usage example with a *qt* backend can be found in the [tools/viewsvg](../tools/viewsvg) app.
resvg-0.8.0/capi/include/ 0000775 0000000 0000000 00000000000 13525763757 0015230 5 ustar 00root root 0000000 0000000 resvg-0.8.0/capi/include/ResvgQt.h 0000664 0000000 0000000 00000024163 13525763757 0017002 0 ustar 00root root 0000000 0000000 /*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/**
* @file ResvgQt.h
*
* Qt wrapper for resvg C-API
*/
#ifndef RESVGQT_H
#define RESVGQT_H
#define RESVG_QT_BACKEND
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
namespace ResvgPrivate {
static const char* toCStr(const QString &text)
{
const auto utf8 = text.toUtf8();
const auto data = utf8.constData();
return qstrdup(data);
}
class Data
{
public:
Data()
{
init();
}
~Data()
{
clear();
}
void reset()
{
clear();
init();
}
resvg_render_tree *tree = nullptr;
resvg_options opt;
qreal scaleFactor = 1.0;
QRectF viewBox;
QString errMsg;
private:
void init()
{
resvg_init_options(&opt);
// Do not set the default font via QFont::family()
// because it will return a dummy one on Windows.
// See https://github.com/RazrFalcon/resvg/issues/159
opt.font_family = "Times New Roman";
opt.languages = toCStr(QLocale().bcp47Name());
opt.dpi = 96 * scaleFactor;
}
void clear()
{
// No need to deallocate opt.font_family, because it is a constant.
if (tree) {
resvg_tree_destroy(tree);
tree = nullptr;
}
if (opt.path) {
delete[] opt.path; // do not use free() because was allocated via qstrdup()
opt.path = NULL;
}
if (opt.languages) {
delete[] opt.languages; // do not use free() because was allocated via qstrdup()
opt.languages = NULL;
}
viewBox = QRectF();
errMsg = QString();
}
};
static QString errorToString(const int err)
{
switch (err) {
case RESVG_OK :
return QString();
case RESVG_ERROR_NOT_AN_UTF8_STR :
return QLatin1Literal("The SVG content has not an UTF-8 encoding.");
case RESVG_ERROR_FILE_OPEN_FAILED :
return QLatin1Literal("Failed to open the file.");
case RESVG_ERROR_FILE_WRITE_FAILED :
return QLatin1Literal("Failed to write to the file.");
case RESVG_ERROR_INVALID_FILE_SUFFIX :
return QLatin1Literal("Invalid file suffix.");
case RESVG_ERROR_MALFORMED_GZIP :
return QLatin1Literal("Not a GZip compressed data.");
case RESVG_ERROR_INVALID_SIZE :
return QLatin1Literal("SVG doesn't have a valid size.");
case RESVG_ERROR_PARSING_FAILED :
return QLatin1Literal("Failed to parse an SVG data.");
case RESVG_ERROR_NO_CANVAS :
return QLatin1Literal("Failed to allocate the canvas.");
}
Q_UNREACHABLE();
}
} //ResvgPrivate
/**
* @brief QSvgRenderer-like wrapper for resvg C-API
*/
class ResvgRenderer {
public:
/**
* @brief Constructs a new renderer.
*/
ResvgRenderer();
/**
* @brief Constructs a new renderer and loads the contents of the SVG(Z) file.
*/
ResvgRenderer(const QString &filePath);
/**
* @brief Constructs a new renderer and loads the SVG data.
*/
ResvgRenderer(const QByteArray &data);
/**
* @brief Destructs the renderer.
*/
~ResvgRenderer();
/**
* @brief Loads the contents of the SVG(Z) file.
*/
bool load(const QString &filePath);
/**
* @brief Loads the SVG data.
*/
bool load(const QByteArray &data);
/**
* @brief Returns \b true if the file or data were loaded successful.
*/
bool isValid() const;
/**
* @brief Returns an underling error when #isValid is \b false.
*/
QString errorString() const;
/**
* @brief Checks that underling tree has any nodes.
*
* #ResvgRenderer and #ResvgRenderer constructors
* will set an error only if a file does not exist or it has a non-UTF-8 encoding.
* All other errors will result in an empty tree with a 100x100px size.
*
* @return Returns \b true if tree has any nodes.
*/
bool isEmpty() const;
/**
* @brief Returns an SVG size.
*/
QSize defaultSize() const;
/**
* @brief Returns an SVG size.
*/
QSizeF defaultSizeF() const;
/**
* @brief Returns an SVG viewbox.
*/
QRect viewBox() const;
/**
* @brief Returns an SVG viewbox.
*/
QRectF viewBoxF() const;
/**
* @brief Returns bounding rectangle of the item with the given \b id.
* The transformation matrix of parent elements is not affecting
* the bounds of the element.
*/
QRectF boundsOnElement(const QString &id) const;
/**
* @brief Returns bounding rectangle of a whole image.
*/
QRectF boundingBox() const;
/**
* @brief Returns \b true if element with such an ID exists.
*/
bool elementExists(const QString &id) const;
/**
* @brief Returns element's transform.
*/
QTransform transformForElement(const QString &id) const;
/**
* @brief Sets the device pixel ratio for the image.
*/
void setDevicePixelRatio(qreal scaleFactor);
/**
* @brief Renders the SVG data to canvas.
*/
void render(QPainter *p) const;
/**
* @brief Renders the SVG data to \b QImage with a specified \b size.
*
* If \b size is not set, the \b defaultSize() will be used.
*/
QImage renderToImage(const QSize &size = QSize()) const;
/**
* @brief Initializes the library log.
*
* Use it if you want to see any warnings.
*
* Must be called only once.
*
* All warnings will be printed to the \b stderr.
*/
static void initLog();
private:
QScopedPointer d;
};
// Implementation.
inline ResvgRenderer::ResvgRenderer()
: d(new ResvgPrivate::Data())
{
}
inline ResvgRenderer::ResvgRenderer(const QString &filePath)
: d(new ResvgPrivate::Data())
{
load(filePath);
}
inline ResvgRenderer::ResvgRenderer(const QByteArray &data)
: d(new ResvgPrivate::Data())
{
load(data);
}
inline ResvgRenderer::~ResvgRenderer() {}
inline bool ResvgRenderer::load(const QString &filePath)
{
// Check for Qt resource path.
if (filePath.startsWith(QLatin1String(":/"))) {
QFile file(filePath);
if (file.open(QFile::ReadOnly)) {
return load(file.readAll());
} else {
return false;
}
}
d->reset();
d->opt.path = ResvgPrivate::toCStr(filePath);
const auto err = resvg_parse_tree_from_file(d->opt.path, &d->opt, &d->tree);
if (err != RESVG_OK) {
d->errMsg = ResvgPrivate::errorToString(err);
return false;
}
const auto r = resvg_get_image_viewbox(d->tree);
d->viewBox = QRectF(r.x, r.y, r.width, r.height);
return true;
}
inline bool ResvgRenderer::load(const QByteArray &data)
{
d->reset();
const auto err = resvg_parse_tree_from_data(data.constData(), data.size(), &d->opt, &d->tree);
if (err != RESVG_OK) {
d->errMsg = ResvgPrivate::errorToString(err);
return false;
}
const auto r = resvg_get_image_viewbox(d->tree);
d->viewBox = QRectF(r.x, r.y, r.width, r.height);
return true;
}
inline bool ResvgRenderer::isValid() const
{
return d->tree;
}
inline QString ResvgRenderer::errorString() const
{
return d->errMsg;
}
inline bool ResvgRenderer::isEmpty() const
{
if (d->tree)
return !resvg_is_image_empty(d->tree);
else
return true;
}
inline QSize ResvgRenderer::defaultSize() const
{
return defaultSizeF().toSize();
}
inline QSizeF ResvgRenderer::defaultSizeF() const
{
if (d->tree)
return d->viewBox.size();
else
return QSizeF();
}
inline QRect ResvgRenderer::viewBox() const
{
return viewBoxF().toRect();
}
inline QRectF ResvgRenderer::viewBoxF() const
{
if (d->tree)
return d->viewBox;
else
return QRectF();
}
inline QRectF ResvgRenderer::boundsOnElement(const QString &id) const
{
if (!d->tree)
return QRectF();
const auto utf8Str = id.toUtf8();
const auto rawId = utf8Str.constData();
resvg_rect bbox;
if (resvg_get_node_bbox(d->tree, rawId, &bbox))
return QRectF(bbox.x, bbox.y, bbox.height, bbox.width);
return QRectF();
}
inline QRectF ResvgRenderer::boundingBox() const
{
if (!d->tree)
return QRectF();
resvg_rect bbox;
if (resvg_get_image_bbox(d->tree, &bbox))
return QRectF(bbox.x, bbox.y, bbox.height, bbox.width);
return QRectF();
}
inline bool ResvgRenderer::elementExists(const QString &id) const
{
if (!d->tree)
return false;
const auto utf8Str = id.toUtf8();
const auto rawId = utf8Str.constData();
return resvg_node_exists(d->tree, rawId);
}
inline QTransform ResvgRenderer::transformForElement(const QString &id) const
{
if (!d->tree)
return QTransform();
const auto utf8Str = id.toUtf8();
const auto rawId = utf8Str.constData();
resvg_transform ts;
if (resvg_get_node_transform(d->tree, rawId, &ts))
return QTransform(ts.a, ts.b, ts.c, ts.d, ts.e, ts.f);
return QTransform();
}
inline void ResvgRenderer::setDevicePixelRatio(qreal scaleFactor)
{
d->scaleFactor = scaleFactor;
}
inline void ResvgRenderer::render(QPainter *p) const
{
if (!d->tree)
return;
p->save();
p->setRenderHint(QPainter::Antialiasing);
const auto r = p->viewport();
resvg_size imgSize { (uint)r.width(), (uint)r.height() };
resvg_qt_render_to_canvas(d->tree, &d->opt, imgSize, p);
p->restore();
}
inline QImage ResvgRenderer::renderToImage(const QSize &size) const
{
const auto s = size.isValid() ? size : defaultSize();
QImage img(s, QImage::Format_ARGB32_Premultiplied);
img.fill(Qt::transparent);
QPainter p(&img);
render(&p);
p.end();
return img;
}
inline void ResvgRenderer::initLog()
{
resvg_init_log();
}
#undef RESVG_QT_BACKEND
#endif // RESVGQT_H
resvg-0.8.0/capi/include/resvg.h 0000664 0000000 0000000 00000033641 13525763757 0016536 0 ustar 00root root 0000000 0000000 /*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/**
* @file resvg.h
*
* resvg C-API
*/
#ifndef RESVG_H
#define RESVG_H
#include
#include
#include
#ifdef RESVG_CAIRO_BACKEND
#include
#endif
#define RESVG_MAJOR_VERSION 0
#define RESVG_MINOR_VERSION 8
#define RESVG_PATCH_VERSION 0
#define RESVG_VERSION "0.8.0"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief An opaque pointer to the rendering tree.
*/
typedef struct resvg_render_tree resvg_render_tree;
/**
* @brief List of possible errors.
*/
typedef enum resvg_error {
/** Everything is ok. */
RESVG_OK = 0,
/** Only UTF-8 content are supported. */
RESVG_ERROR_NOT_AN_UTF8_STR,
/** Failed to open the provided file. */
RESVG_ERROR_FILE_OPEN_FAILED,
/** Failed to write to the provided file. */
RESVG_ERROR_FILE_WRITE_FAILED,
/** Only \b svg and \b svgz suffixes are supported. */
RESVG_ERROR_INVALID_FILE_SUFFIX,
/** Compressed SVG must use the GZip algorithm. */
RESVG_ERROR_MALFORMED_GZIP,
/**
* SVG doesn't have a valid size.
*
* Occurs when width and/or height are <= 0.
*
* Also occurs if width, height and viewBox are not set.
* This is against the SVG spec, but an automatic size detection is not supported yet.
*/
RESVG_ERROR_INVALID_SIZE,
/** Failed to parse an SVG data. */
RESVG_ERROR_PARSING_FAILED,
/** Failed to allocate an image. */
RESVG_ERROR_NO_CANVAS,
} resvg_error;
/**
* @brief An RGB color representation.
*/
typedef struct resvg_color {
uint8_t r; /**< Red component. */
uint8_t g; /**< Green component. */
uint8_t b; /**< Blue component. */
} resvg_color;
/**
* @brief A "fit to" type.
*
* All types produce proportional scaling.
*/
typedef enum resvg_fit_to_type {
RESVG_FIT_TO_ORIGINAL, /**< Use an original image size. */
RESVG_FIT_TO_WIDTH, /**< Fit an image to a specified width. */
RESVG_FIT_TO_HEIGHT, /**< Fit an image to a specified height. */
RESVG_FIT_TO_ZOOM, /**< Zoom an image using scaling factor */
} resvg_fit_to_type;
/**
* @brief A "fit to" property.
*/
typedef struct resvg_fit_to {
resvg_fit_to_type type; /**< Fit type. */
float value; /**< Fit to value. Must be > 0. */
} resvg_fit_to;
/**
* @brief A shape rendering method.
*/
typedef enum resvg_shape_rendering {
RESVG_SHAPE_RENDERING_OPTIMIZE_SPEED,
RESVG_SHAPE_RENDERING_CRISP_EDGES,
RESVG_SHAPE_RENDERING_GEOMETRIC_PRECISION,
} resvg_shape_rendering;
/**
* @brief A text rendering method.
*/
typedef enum resvg_text_rendering {
RESVG_TEXT_RENDERING_OPTIMIZE_SPEED,
RESVG_TEXT_RENDERING_OPTIMIZE_LEGIBILITY,
RESVG_TEXT_RENDERING_GEOMETRIC_PRECISION,
} resvg_text_rendering;
/**
* @brief An image rendering method.
*/
typedef enum resvg_image_rendering {
RESVG_IMAGE_RENDERING_OPTIMIZE_QUALITY,
RESVG_IMAGE_RENDERING_OPTIMIZE_SPEED,
} resvg_image_rendering;
/**
* @brief Rendering options.
*/
typedef struct resvg_options {
/** SVG image path. Used to resolve relative image paths.
*
* Default: NULL
*/
const char *path;
/** Output DPI.
*
* Default: 96.
*/
double dpi;
/** Default font family.
*
* Must be set before passing to rendering functions.
*
* Default: NULL.
*/
const char *font_family;
/** Default font size.
*
* Default: 12.
*/
double font_size;
/**
* Sets a comma-separated list of languages that will be used
* during the 'systemLanguage' attribute resolving.
* Examples: 'en-US', 'en-US, ru-RU', 'en, ru'
*
* Must be set before passing to rendering functions.
*
* Default: NULL.
*/
const char *languages;
/**
* Specifies the default shape rendering method.
*
* Will be used when an SVG element's \b shape-rendering property is set to \b auto.
*
* Default: \b RESVG_SHAPE_RENDERING_GEOMETRIC_PRECISION.
*/
resvg_shape_rendering shape_rendering;
/**
* Specifies the default text rendering method.
*
* Will be used when an SVG element's \b text-rendering property is set to \b auto.
*
* Default: \b RESVG_TEXT_RENDERING_OPTIMIZE_LEGIBILITY.
*/
resvg_text_rendering text_rendering;
/**
* Specifies the default image rendering method.
*
* Will be used when an SVG element's \b image-rendering property is set to \b auto.
*
* Default: \b RESVG_IMAGE_RENDERING_OPTIMIZE_QUALITY.
*/
resvg_image_rendering image_rendering;
/**
* Fits the image using specified options.
*
* Default: \b RESVG_FIT_TO_ORIGINAL.
*/
resvg_fit_to fit_to;
/** Draw background.
*
* Default: false.
*/
bool draw_background;
/** Background color. */
resvg_color background;
/**
* Keep named groups. If set to \b true, all non-empty
* groups with \b id attribute will not be removed.
*
* Default: false
*/
bool keep_named_groups;
} resvg_options;
/**
* @brief A rectangle representation.
*/
typedef struct resvg_rect {
double x; /**< X position. */
double y; /**< Y position. */
double width; /**< Width. */
double height; /**< Height. */
} resvg_rect;
/**
* @brief A size representation.
*/
typedef struct resvg_size {
uint32_t width; /**< Width. */
uint32_t height; /**< Height. */
} resvg_size;
/**
* @brief A 2D transform representation.
*/
typedef struct resvg_transform {
double a; /**< \b a value */
double b; /**< \b b value */
double c; /**< \b c value */
double d; /**< \b d value */
double e; /**< \b e value */
double f; /**< \b f value */
} resvg_transform;
/**
* @brief Initializes the library log.
*
* Use it if you want to see any warnings.
*
* Must be called only once.
*
* All warnings will be printed to the \b stderr.
*/
void resvg_init_log();
/**
* @brief Initializes the #resvg_options structure.
*/
void resvg_init_options(resvg_options *opt);
/**
* @brief Creates #resvg_render_tree from file.
*
* .svg and .svgz files are supported.
*
* See #resvg_is_image_empty for details.
*
* @param file_path UTF-8 file path.
* @param opt Rendering options.
* @param tree Parsed render tree. Should be destroyed via #resvg_tree_destroy.
* @return #resvg_error
*/
int resvg_parse_tree_from_file(const char *file_path,
const resvg_options *opt,
resvg_render_tree **tree);
/**
* @brief Creates #resvg_render_tree from data.
*
* See #resvg_is_image_empty for details.
*
* @param data SVG data. Can contain SVG string or gzip compressed data.
* @param len Data length.
* @param opt Rendering options.
* @param tree Parsed render tree. Should be destroyed via #resvg_tree_destroy.
* @return #resvg_error
*/
int resvg_parse_tree_from_data(const char *data,
const size_t len,
const resvg_options *opt,
resvg_render_tree **tree);
/**
* @brief Checks that tree has any nodes.
*
* @param tree Render tree.
* @return Returns \b true if tree has any nodes.
*/
bool resvg_is_image_empty(const resvg_render_tree *tree);
/**
* @brief Returns an image size.
*
* The size of a canvas that required to render this SVG.
*
* @param tree Render tree.
* @return Image size.
*/
resvg_size resvg_get_image_size(const resvg_render_tree *tree);
/**
* @brief Returns an image viewbox.
*
* @param tree Render tree.
* @return Image viewbox.
*/
resvg_rect resvg_get_image_viewbox(const resvg_render_tree *tree);
/**
* @brief Returns an image bounding box.
*
* Can be smaller or bigger than a \b viewbox.
*
* @param tree Render tree.
* @param bbox Image's bounding box.
* @return \b false if an image has no elements.
*/
bool resvg_get_image_bbox(const resvg_render_tree *tree,
resvg_rect *bbox);
/**
* @brief Returns \b true if a renderable node with such an ID exists.
*
* @param tree Render tree.
* @param id Node's ID. UTF-8 string.
* @return \b true if a node exists.
* @return \b false if a node doesn't exist or ID isn't a UTF-8 string.
* @return \b false if a node exists, but not renderable.
*/
bool resvg_node_exists(const resvg_render_tree *tree,
const char *id);
/**
* @brief Returns node's transform by ID.
*
* @param tree Render tree.
* @param id Node's ID. UTF-8 string.
* @param ts Node's transform.
* @return \b true if a node exists.
* @return \b false if a node doesn't exist or ID isn't a UTF-8 string.
* @return \b false if a node exists, but not renderable.
*/
bool resvg_get_node_transform(const resvg_render_tree *tree,
const char *id,
resvg_transform *ts);
/**
* @brief Returns node's bounding box by ID.
*
* @param tree Render tree.
* @param id Node's ID.
* @param bbox Node's bounding box.
* @return \b false if a node with such an ID does not exist
* @return \b false if ID isn't a UTF-8 string.
* @return \b false if ID is an empty string
*/
bool resvg_get_node_bbox(const resvg_render_tree *tree,
const char *id,
resvg_rect *bbox);
/**
* @brief Destroys the #resvg_render_tree.
*
* @param tree Render tree.
*/
void resvg_tree_destroy(resvg_render_tree *tree);
#ifdef RESVG_CAIRO_BACKEND
/**
* @brief Renders the #resvg_render_tree to file.
*
* @param tree Render tree.
* @param opt Rendering options.
* @param file_path File path.
* @return #resvg_error
*/
int resvg_cairo_render_to_image(const resvg_render_tree *tree,
const resvg_options *opt,
const char *file_path);
/**
* @brief Renders the #resvg_render_tree to canvas.
*
* @param tree Render tree.
* @param opt Rendering options.
* @param size Canvas size.
* @param cr Canvas.
*/
void resvg_cairo_render_to_canvas(const resvg_render_tree *tree,
const resvg_options *opt,
resvg_size size,
cairo_t *cr);
/**
* @brief Renders a Node by ID to canvas.
*
* Does nothing on error.
*
* @param tree Render tree.
* @param opt Rendering options.
* @param size Canvas size.
* @param id Node's ID.
* @param cr Canvas.
*/
void resvg_cairo_render_to_canvas_by_id(const resvg_render_tree *tree,
const resvg_options *opt,
resvg_size size,
const char *id,
cairo_t *cr);
#endif /* RESVG_CAIRO_BACKEND */
#ifdef RESVG_QT_BACKEND
/**
* @brief Renders the #resvg_render_tree to file.
*
* @param tree Render tree.
* @param opt Rendering options.
* @param file_path File path.
* @return #resvg_error
*/
int resvg_qt_render_to_image(const resvg_render_tree *tree,
const resvg_options *opt,
const char *file_path);
/**
* @brief Renders the #resvg_render_tree to canvas.
*
* @param tree Render tree.
* @param opt Rendering options.
* @param size Canvas size.
* @param painter Canvas.
*/
void resvg_qt_render_to_canvas(const resvg_render_tree *tree,
const resvg_options *opt,
resvg_size size,
void *painter);
/**
* @brief Renders a Node by ID to canvas.
*
* Does nothing on error.
*
* @param tree Render tree.
* @param opt Rendering options.
* @param size Canvas size.
* @param id Node's ID.
* @param painter Canvas.
*/
void resvg_qt_render_to_canvas_by_id(const resvg_render_tree *tree,
const resvg_options *opt,
resvg_size size,
const char *id,
void *painter);
#endif /* RESVG_QT_BACKEND */
#ifdef RESVG_RAQOTE_BACKEND
/**
* @brief Renders the #resvg_render_tree to file.
*
* @param tree Render tree.
* @param opt Rendering options.
* @param file_path File path.
* @return #resvg_error
*/
int resvg_raqote_render_to_image(const resvg_render_tree *tree,
const resvg_options *opt,
const char *file_path);
/**
* Raqote backend doesn't have render_to_canvas and render_to_canvas_by_id
* methods since it's a Rust library.
*/
#endif /* RESVG_RAQOTE_BACKEND */
#ifdef RESVG_SKIA_BACKEND
/**
* @brief Renders the #resvg_render_tree to file.
*
* @param tree Render tree.
* @param opt Rendering options.
* @param file_path File path.
* @return #resvg_error
*/
int resvg_skia_render_to_image(const resvg_render_tree *tree,
const resvg_options *opt,
const char *file_path);
/**
* @brief Renders the #resvg_render_tree to canvas.
*
* @param tree Render tree.
* @param opt Rendering options.
* @param size Canvas size.
* @param surface Skia Surface.
*/
void resvg_skia_render_to_canvas(const resvg_render_tree *tree,
const resvg_options *opt,
resvg_size size,
void *surface);
/**
* @brief Renders a Node by ID to canvas.
*
* Does nothing on error.
*
* @param tree Render tree.
* @param opt Rendering options.
* @param size Canvas size.
* @param id Node's ID.
* @param surface Skia Surface.
*/
void resvg_skia_render_to_canvas_by_id(const resvg_render_tree *tree,
const resvg_options *opt,
resvg_size size,
const char *id,
void *surface);
#endif /* RESVG_SKIA_BACKEND */
#ifdef __cplusplus
}
#endif
#endif /* RESVG_H */
resvg-0.8.0/capi/qtests/ 0000775 0000000 0000000 00000000000 13525763757 0015130 5 ustar 00root root 0000000 0000000 resvg-0.8.0/capi/qtests/.gitignore 0000664 0000000 0000000 00000000041 13525763757 0017113 0 ustar 00root root 0000000 0000000 tst_resvgqt*
test_renderFile.png
resvg-0.8.0/capi/qtests/images/ 0000775 0000000 0000000 00000000000 13525763757 0016375 5 ustar 00root root 0000000 0000000 resvg-0.8.0/capi/qtests/images/empty.svg 0000664 0000000 0000000 00000000112 13525763757 0020246 0 ustar 00root root 0000000 0000000
resvg-0.8.0/capi/qtests/images/invalid.svg 0000664 0000000 0000000 00000000010 13525763757 0020533 0 ustar 00root root 0000000 0000000
resvg-0.8.0/capi/qtests/images/test.svg 0000664 0000000 0000000 00000000652 13525763757 0020100 0 ustar 00root root 0000000 0000000
resvg-0.8.0/capi/qtests/images/text.svg 0000664 0000000 0000000 00000000175 13525763757 0020105 0 ustar 00root root 0000000 0000000
resvg-0.8.0/capi/qtests/images/vb.svg 0000664 0000000 0000000 00000000250 13525763757 0017522 0 ustar 00root root 0000000 0000000
resvg-0.8.0/capi/qtests/results/ 0000775 0000000 0000000 00000000000 13525763757 0016631 5 ustar 00root root 0000000 0000000 resvg-0.8.0/capi/qtests/results/test_renderFile.png 0000664 0000000 0000000 00000004063 13525763757 0022460 0 ustar 00root root 0000000 0000000 ‰PNG
IHDR È È X®ž pHYs a a¨?§i åIDATxœíÝMŒ^UÇñ¯ÒØnšvÓh‚.´ndi…DêF^Ê
SX”Œ‰+4V*`~±5´øÝù‚†j"Än´RÙXLyÙ`b TM0SäeÑ Stñ̘±Ôigæž{ν÷ûIžÌfæþó<Ïoî=ÏÜsH’$I’$I’$I’$I’$I’$I’$I’tnï©Ý€ÎÞÎ sÓÀ«À+SÀIà……¯/þ]§Ùñ3 Yù›ýufAYͳÀã„Ó]·6EdµÂ`;ᱎëvq4˜žNîí Þd«ÝÀ „mÀMÀN`°ž6ÿȬcÖß0 ka@Î'lnö WTîF=3 çÖ70Åõø