From 52ca847795e56340f70c9865a02020e53aff4b97 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Tue, 21 Apr 2015 06:09:24 -0400 Subject: [PATCH] contrib/inkscape_tools: update README.md file MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- contrib/inkscape_tools/README.md | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/contrib/inkscape_tools/README.md b/contrib/inkscape_tools/README.md index 017ec86..c338656 100644 --- a/contrib/inkscape_tools/README.md +++ b/contrib/inkscape_tools/README.md @@ -1,25 +1,28 @@ # SVG to PNG and Nit -This tool is used in combination with Inkscape to simplify assets creation for _mnit_ apps. It uses Inkscape to extract a PNG file from a SVG file. It will also create a Nit source file to create _mnit_ images for each objects with an id beginning by 0. +This tool uses Inkscape to prepare assets for Nit applications from a single SVG file. +It selects objects to extract from the SVG file when their id begins with `0`. -# Features +It will produce two files: -* Creates a sinlge PNG file per SVG source file -* Creates subimages for objects with an id beginning by 0. -* If the id ends with 0 to 9, will instead create an array of subimages. +* A Nit source file that declares a single class with an attribute for each selected object. + The attribute usually holds a single texture, except if the the id ends with a digit, then it will be an array. -# Usage +* A single PNG image file that contains all the selected objects. + With the option `--pow2`, the image size is rounded to the next of 2. + +## Usage 1. Create a new Inkscape document. -2. Create objects and set their ids to begin with 0 -3. Save the document (ex: to `drawing.svg`) the name of the file is important +2. Create objects and set their ids to begin with `0`. +3. Save the document to `drawing.svg` (for this example), the name of the file is used to name the Nit class. 4. Execute `bin/svg_to_png_and_nit drawing.svg` -5. From your code, import the generated source file (at src/drawing.nit`) +5. From your code, import the generated source file at `src/drawing.nit`. 6. Use the class `DrawingImages` and its attributes. -# Examples +## Examples -The minimal test in tests/app/ shows the basic usage of this tool. +The minimal test in `tests/app/` shows the basic usage of this tool. The Dino example `../../../../examples/mnit_dino` also uses this tool and is a more complete and practical example. -- 1.7.9.5