Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/memononen/nanosvg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikko Mononen <memon@inside.org>2014-01-29 21:50:41 +0400
committerMikko Mononen <memon@inside.org>2014-01-29 21:50:41 +0400
commit135a658741655f1e022ba6b7988d8c2ffdebb407 (patch)
treea324cea8787fff639c54a62c8a9534482e6c990d /README.md
parenta866ad3d7a0c7e4fd33461f928246a90d40f68df (diff)
Added viewBox and unit coversion support
- added exact bounds calculation for bezier curves, paths, shapes - added unit coversion for svg length values (use px internally) - added viewBox and preserveAspectRatio handling - removed some test SVGs
Diffstat (limited to 'README.md')
-rw-r--r--README.md20
1 files changed, 18 insertions, 2 deletions
diff --git a/README.md b/README.md
index e68c5a9..9aa9a3f 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,18 @@ NanoSVG is a simple stupid single-header-file SVG parse. The output of the parse
The library suits well for anything from rendering scalable icons in your editor application to prototyping a game.
-NanoSVG supports a wide range of SVG features, if somehing is missing, feel free to create a pull request!
+NanoSVG supports a wide range of SVG features, but something may be missing, feel free to create a pull request!
+
+The shapes in the SVG images are transformed by the viewBox and converted to specified units.
+That is, you should get the same looking data as your designed in your favorite app.
+
+NanoSVG can return the paths in few different units. For example if you want to render an image, you may choose
+to get the paths in pixels, or if you are feeding the data into a CNC-cutter, you may want to use millimeters.
+
+The units passed to NanoVG should be one of: 'px', 'pt', 'pc' 'mm', 'cm', or 'in'.
+DPI (dots-per-inch) controls how the unit conversion is done.
+
+If you don't know or care about the units stuff, "px" and 96 should get you going.
## Rasterizer
@@ -25,7 +36,7 @@ The intended usage for the rasterizer is to for example bake icons of different
``` C
// Load
struct NSVGimage* image;
-image = nsvgParseFromFile("test.svg.");
+image = nsvgParseFromFile("test.svg", "px", 96);
printf("size: %f x %f\n", image->width, image->height);
// Use...
for (shape = image->shapes; shape != NULL; shape = shape->next) {
@@ -44,8 +55,11 @@ nsvgDelete(image);
In order to use NanoSVG in your own project, just copy nanosvg.h to your project.
In one C/C++ define `NANOSVG_IMPLEMENTATION` before including the library to expand the NanoSVG implementation in that file.
+NanoSVG depends on `stdio.h` and `math.h`, they should be included where the implementation is expanded before including NanoSVG.
``` C
+#include <stdio.h>
+#include <math.h>
#define NANOSVG_IMPLEMENTATION // Expands implementation
#include "nanosvg.h"
```
@@ -53,6 +67,8 @@ In one C/C++ define `NANOSVG_IMPLEMENTATION` before including the library to exp
By default, NanoSVG parses only the most common colors. In order to get support for full list of [SVG color keywords](http://www.w3.org/TR/SVG11/types.html#ColorKeywords), define `NANOSVG_ALL_COLOR_KEYWORDS` before expanding the implementation.
``` C
+#include <stdio.h>
+#include <math.h>
#define NANOSVG_ALL_COLOR_KEYWORDS // Include full list of color keywords.
#define NANOSVG_IMPLEMENTATION // Expands implementation
#include "nanosvg.h"