]> gitweb.michael.orlitzky.com - libsvgtiny.git/blob - svgtiny.h
Add install target.
[libsvgtiny.git] / svgtiny.h
1 /*
2 * This file is part of Libsvgtiny
3 * Licensed under the MIT License,
4 * http://opensource.org/licenses/mit-license.php
5 * Copyright 2008 James Bursa <james@semichrome.net>
6 */
7
8 #ifndef SVGTINY_H
9 #define SVGTINY_H
10
11 #include <libxml/parser.h>
12
13 typedef int svgtiny_colour;
14 #define svgtiny_TRANSPARENT 0x1000000
15 #ifdef riscos
16 #define svgtiny_RGB(r, g, b) ((b) << 16 | (g) << 8 | (r))
17 #else
18 #define svgtiny_RGB(r, g, b) ((r) << 16 | (g) << 8 | (b))
19 #endif
20
21 struct svgtiny_shape {
22 float *path;
23 unsigned int path_length;
24 char *text;
25 float text_x, text_y;
26 svgtiny_colour fill;
27 svgtiny_colour stroke;
28 int stroke_width;
29 };
30
31 struct svgtiny_diagram {
32 int width, height;
33
34 struct svgtiny_shape *shape;
35 unsigned int shape_count;
36 };
37
38 typedef enum {
39 svgtiny_OK,
40 svgtiny_OUT_OF_MEMORY,
41 svgtiny_LIBXML_ERROR,
42 svgtiny_NOT_SVG,
43 } svgtiny_code;
44
45 enum {
46 svgtiny_PATH_MOVE,
47 svgtiny_PATH_CLOSE,
48 svgtiny_PATH_LINE,
49 svgtiny_PATH_BEZIER,
50 };
51
52 struct svgtiny_named_color {
53 const char *name;
54 svgtiny_colour color;
55 };
56
57
58 struct svgtiny_diagram *svgtiny_create(void);
59 svgtiny_code svgtiny_parse(struct svgtiny_diagram *diagram,
60 const char *buffer, size_t size, const char *url,
61 int width, int height);
62 void svgtiny_free(struct svgtiny_diagram *svg);
63
64 const struct svgtiny_named_color *
65 svgtiny_color_lookup (register const char *str, register unsigned int len);
66
67 #endif