pathfinder/README.md

98 lines
4.4 KiB
Markdown
Raw Normal View History

2019-02-26 18:24:25 -05:00
# Pathfinder 3
2017-02-08 17:10:42 -05:00
2020-02-28 13:05:39 -05:00
![Logo](https://github.com/servo/pathfinder/raw/master/resources/textures/pathfinder-logo.png)
2020-02-28 12:46:42 -05:00
2019-02-26 18:24:25 -05:00
Pathfinder 3 is a fast, practical, GPU-based rasterizer for fonts and vector graphics using OpenGL
2019-06-25 02:09:22 -04:00
3.0+, OpenGL ES 3.0+, or Metal.
2017-02-08 17:10:42 -05:00
2017-10-06 22:55:28 -04:00
Please note that Pathfinder is under heavy development and is incomplete in various areas.
2017-02-08 17:10:42 -05:00
2019-05-03 17:24:10 -04:00
## Quick start
Pathfinder contains a library that implements a subset of the
[HTML canvas API](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API). You can quickly add
vector rendering to any Rust app with it. See the `examples/canvas_minimal` for a small example of
usage.
### Demos
Demo app sources are available in [demo/](https://github.com/servo/pathfinder/tree/master/demo). A prebuilt package for Magic Leap can be found in [releases](https://github.com/servo/pathfinder/releases).
2019-05-03 17:24:10 -04:00
## Features
2017-10-06 22:55:28 -04:00
The project features:
2017-02-08 17:10:42 -05:00
2017-10-06 22:55:28 -04:00
* High quality antialiasing. Pathfinder can compute exact fractional trapezoidal area coverage on a
2019-02-26 18:24:25 -05:00
per-pixel basis for the highest-quality antialiasing possible (effectively 256xAA).
* Fast CPU setup, making full use of parallelism. Pathfinder 3 uses the Rayon library to quickly
perform a CPU tiling prepass to prepare vector scenes for the GPU. This prepass can be pipelined
with the GPU to hide its latency.
2017-02-08 17:10:42 -05:00
2019-02-26 18:24:25 -05:00
* Fast GPU rendering, even at small pixel sizes. Even on lower-end GPUs, Pathfinder typically
matches or exceeds the performance of the best CPU rasterizers. The difference is particularly
2019-07-05 22:36:05 -04:00
pronounced at large sizes, where Pathfinder regularly achieves multi-factor speedups. All shaders
2019-02-26 18:24:25 -05:00
have no loops and minimal branching.
2017-02-08 17:10:42 -05:00
* Advanced font rendering. Pathfinder can render fonts with slight hinting and can perform subpixel
antialiasing on LCD screens. It can do stem darkening/font dilation like macOS and FreeType in
2017-11-07 20:42:42 -05:00
order to make text easier to read at small sizes. The library also has support for gamma
correction.
2019-02-26 18:24:25 -05:00
* Support for SVG. Pathfinder 3 is designed to efficiently handle workloads that consist of many
overlapping vector paths, such as those commonly found in SVG and PDF files. It can perform
occlusion culling, which often results in dramatic performance wins over typical software
renderers that use the painter's algorithm. A simple loader that leverages the `resvg` library
to render a subset of SVG is included, so it's easy to get started.
* 3D capability. Pathfinder can render fonts and vector paths in 3D environments without any loss
in quality. This is intended to be useful for vector-graphics-based user interfaces in VR, for
example.
2017-10-06 22:55:28 -04:00
2019-02-26 18:24:25 -05:00
* Lightweight. Unlike large vector graphics packages that mix and match many different algorithms,
Pathfinder 3 uses a single, simple technique. It consists of a set of modular crates, so
applications can pick and choose only the components that are necessary to minimize dependencies.
2017-02-09 20:40:37 -05:00
2017-10-06 22:55:28 -04:00
* Portability to most GPUs manufactured in the last decade, including integrated and mobile GPUs.
Geometry, tessellation, and compute shader functionality is not required.
2017-02-09 20:40:37 -05:00
2017-10-06 22:55:28 -04:00
## Building
2017-02-09 20:40:37 -05:00
2019-02-26 18:24:25 -05:00
Pathfinder 3 is a set of modular packages, allowing you to choose which parts of the library you
need. An SVG rendering demo, written in Rust, is included, so you can try Pathfinder out right
away. It also provides an example of how to use the library. (Note that, like the rest of
Pathfinder, the demo is under heavy development and has known bugs.)
2019-02-26 18:24:25 -05:00
Running the demo is as simple as:
2019-02-26 18:24:25 -05:00
$ cd demo/native
$ RUSTFLAGS="-C target-cpu=native" cargo run --release
2020-02-28 13:05:39 -05:00
## Community
There's a Matrix chat room available at
[`#pathfinder:mozilla.org`](https://matrix.to/#/!XiDASQfNTTMrJbXHTw:mozilla.org?via=mozilla.org).
If you're on the Mozilla Matrix server, you can search for Pathfinder to find it. For more
information on connecting to the Matrix network, see
[this `wiki.mozilla.org` page](https://wiki.mozilla.org/Matrix).
2020-02-28 13:07:27 -05:00
The entire Pathfinder community, including the chat room and GitHub project, is expected to abide
by the same Code of Conduct that the Rust project itself follows.
2020-02-28 12:46:42 -05:00
## Build status
[![Build Status](https://travis-ci.org/servo/pathfinder.svg?branch=master)](https://travis-ci.org/servo/pathfinder)
2017-02-08 17:10:42 -05:00
## Authors
The primary author is Patrick Walton (@pcwalton), with contributions from the Servo development
community.
The logo was designed by Jay Vining.
2017-02-08 17:10:42 -05:00
## License
Pathfinder is licensed under the same terms as Rust itself. See `LICENSE-APACHE` and `LICENSE-MIT`.
Material Design icons are copyright Google Inc. and licensed under the Apache 2.0 license.