]> gitweb.michael.orlitzky.com - libsvgtiny.git/blob - svgtiny_internal.h
84ecf5c31d43f62b2e8484f1b129d1ee228abf0d
[libsvgtiny.git] / svgtiny_internal.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_INTERNAL_H
9 #define SVGTINY_INTERNAL_H
10
11 struct svgtiny_gradient_stop {
12 float offset;
13 svgtiny_colour color;
14 };
15
16 #define svgtiny_MAX_STOPS 10
17 #define svgtiny_LINEAR_GRADIENT 0x2000000
18
19 struct svgtiny_parse_state {
20 struct svgtiny_diagram *diagram;
21 xmlDoc *document;
22
23 float viewport_width;
24 float viewport_height;
25
26 /* current transformation matrix */
27 struct {
28 float a, b, c, d, e, f;
29 } ctm;
30
31 /*struct css_style style;*/
32
33 /* paint attributes */
34 svgtiny_colour fill;
35 svgtiny_colour stroke;
36 int stroke_width;
37
38 /* gradients */
39 unsigned int linear_gradient_stop_count;
40 const char *gradient_x1, *gradient_y1, *gradient_x2, *gradient_y2;
41 struct svgtiny_gradient_stop gradient_stop[svgtiny_MAX_STOPS];
42 };
43
44
45 /* svgtiny.c */
46 float svgtiny_parse_length(const char *s, int viewport_size,
47 const struct svgtiny_parse_state state);
48 void svgtiny_parse_color(const char *s, svgtiny_colour *c,
49 struct svgtiny_parse_state *state);
50 struct svgtiny_shape *svgtiny_add_shape(struct svgtiny_parse_state *state);
51 void svgtiny_transform_path(float *p, unsigned int n,
52 struct svgtiny_parse_state *state);
53
54 /* svgtiny_gradient.c */
55 void svgtiny_find_gradient(const char *id, struct svgtiny_parse_state *state);
56 svgtiny_code svgtiny_add_path_linear_gradient(float *p, unsigned int n,
57 struct svgtiny_parse_state *state);
58 xmlNode *svgtiny_find_element_by_id(xmlNode *node, const char *id);
59
60 /* colors.gperf */
61 const struct svgtiny_named_color *
62 svgtiny_color_lookup(register const char *str,
63 register unsigned int len);
64
65 #endif