contrib/inkscape_tools: update README.md file
[nit.git] / contrib / inkscape_tools / README.md
1 # SVG to PNG and Nit
2
3 This tool uses Inkscape to prepare assets for Nit applications from a single SVG file.
4 It selects objects to extract from the SVG file when their id begins with `0`.
5
6 It will produce two files:
7
8 * A Nit source file that declares a single class with an attribute for each selected object.
9   The attribute usually holds a single texture, except if the the id ends with a digit, then it will be an array.
10
11 * A single PNG image file that contains all the selected objects.
12   With the option `--pow2`, the image size is rounded to the next of 2.
13
14 ## Usage
15
16 1. Create a new Inkscape document.
17 2. Create objects and set their ids to begin with `0`.
18 3. Save the document to `drawing.svg` (for this example), the name of the file is used to name the Nit class.
19 4. Execute `bin/svg_to_png_and_nit drawing.svg`
20 5. From your code, import the generated source file at `src/drawing.nit`.
21 6. Use the class `DrawingImages` and its attributes.
22
23 ## Examples
24
25 The minimal test in `tests/app/` shows the basic usage of this tool.
26
27 The Dino example `../../../../examples/mnit_dino` also uses this tool and is a more complete and practical example.
28
29 # Authors
30
31 Alexis Laferrière <alexis.laf@xymus.net>