Merge "Disable pixel alignment while scrolling the text" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / third-party / nanosvg / nanosvgrast.h
1 /*
2  * Copyright (c) 2013-14 Mikko Mononen memon@inside.org
3  *
4  * This software is provided 'as-is', without any express or implied
5  * warranty.  In no event will the authors be held liable for any damages
6  * arising from the use of this software.
7  *
8  * Permission is granted to anyone to use this software for any purpose,
9  * including commercial applications, and to alter it and redistribute it
10  * freely, subject to the following restrictions:
11  *
12  * 1. The origin of this software must not be misrepresented; you must not
13  * claim that you wrote the original software. If you use this softwarue
14  * in a product, an acknowledgment in the product documentation would be
15  * appreciated but is not required.
16  * 2. Altered source versions must be plainly marked as such, and must not be
17  * misrepresented as being the original software.
18  * 3. This notice may not be removed or altered from any source distribution.
19  *
20  * The polygon rasterization is heavily based on stb_truetype rasterizer
21  * by Sean Barrett - http://nothings.org/
22  *
23  */
24
25 #ifndef NANOSVGRAST_H
26 #define NANOSVGRAST_H
27
28 #include "nanosvg.h"
29
30 typedef struct NSVGrasterizer NSVGrasterizer;
31
32 /* Example Usage:
33   // Load SVG
34   struct SNVGImage* image = nsvgParseFromFile("test.svg.");
35
36   // Create rasterizer (can be used to render multiple images).
37   struct NSVGrasterizer* rast = nsvgCreateRasterizer();
38   // Allocate memory for image
39   unsigned char* img = malloc(w*h*4);
40   // Rasterize
41   nsvgRasterize(rast, image, 0,0,1, img, w, h, w*4);
42 */
43
44 // Allocated rasterizer context.
45 NSVGrasterizer* nsvgCreateRasterizer();
46
47 // Rasterizes SVG image, returns RGBA image (premultiplied alpha)
48 //   r - pointer to rasterizer context
49 //   image - pointer to image to rasterize
50 //   tx,ty - image offset (applied after scaling)
51 //   scale - image scale
52 //   dst - pointer to destination image data, 4 bytes per pixel (RGBA)
53 //   w - width of the image to render
54 //   h - height of the image to render
55 //   stride - number of bytes per scaleline in the destination buffer
56 void nsvgRasterize(NSVGrasterizer* r,
57                    NSVGimage* image, float tx, float ty, float scale,
58                    unsigned char* dst, int w, int h, int stride);
59
60 // Deletes rasterizer context.
61 void nsvgDeleteRasterizer(NSVGrasterizer*);
62
63
64 #endif // NANOSVGRAST_H
65
66 /**
67  * In the original software, The nanosvgrast implementation was followed here.
68  * We have moved the implementation to nanosvgrast.cc.
69  */