Code Monkey home page Code Monkey logo

resvg's Introduction

resvg

Build Status Crates.io Documentation

resvg is an SVG rendering library.

Purpose

resvg can be used as:

to render SVG files based on a static SVG Full 1.1 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 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 tool.

SVG support

resvg is aiming to support only the 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.

SVG Tiny 1.2 and SVG 2.0 are not supported and not planned.

Results of the static subset of the SVG test suite:

Chart1

Results of the resvg test suite:

Chart2

You can find a complete table of supported features here. 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.

Chart3

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

Chart4

  • 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 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.

For more details checkout benches/README.md

Project structure

All other dependencies aren't written by me for this project.

Directory structure

  • benches - basic benchmarks for rendering operations
  • 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.

resvg's People

Contributors

enkore avatar harmic avatar jafenix avatar jc86035 avatar jrmuizel avatar legoktm avatar mike-marcacci avatar niklasf avatar ocohen avatar razrfalcon avatar selaux avatar tibbel avatar velyan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.