]> gitweb.michael.orlitzky.com - libsvgtiny.git/blob - src/svgtiny_internal.h
Prefix build dirs with build- and svn ignore them. Simplify clean rule.
[libsvgtiny.git] / src / 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 #include <stdbool.h>
12
13 struct svgtiny_gradient_stop {
14 float offset;
15 svgtiny_colour color;
16 };
17
18 #define svgtiny_MAX_STOPS 10
19 #define svgtiny_LINEAR_GRADIENT 0x2000000
20
21 struct svgtiny_parse_state {
22 struct svgtiny_diagram *diagram;
23 xmlDoc *document;
24
25 float viewport_width;
26 float viewport_height;
27
28 /* current transformation matrix */
29 struct {
30 float a, b, c, d, e, f;
31 } ctm;
32
33 /*struct css_style style;*/
34
35 /* paint attributes */
36 svgtiny_colour fill;
37 svgtiny_colour stroke;
38 int stroke_width;
39
40 /* gradients */
41 unsigned int linear_gradient_stop_count;
42 const char *gradient_x1, *gradient_y1, *gradient_x2, *gradient_y2;
43 struct svgtiny_gradient_stop gradient_stop[svgtiny_MAX_STOPS];
44 bool gradient_user_space_on_use;
45 struct {
46 float a, b, c, d, e, f;
47 } gradient_transform;
48 };
49
50 struct svgtiny_list;
51
52 /* svgtiny.c */
53 float svgtiny_parse_length(const char *s, int viewport_size,
54 const struct svgtiny_parse_state state);
55 void svgtiny_parse_color(const char *s, svgtiny_colour *c,
56 struct svgtiny_parse_state *state);
57 void svgtiny_parse_transform(char *s, float *ma, float *mb,
58 float *mc, float *md, float *me, float *mf);
59 struct svgtiny_shape *svgtiny_add_shape(struct svgtiny_parse_state *state);
60 void svgtiny_transform_path(float *p, unsigned int n,
61 struct svgtiny_parse_state *state);
62
63 /* svgtiny_gradient.c */
64 void svgtiny_find_gradient(const char *id, struct svgtiny_parse_state *state);
65 svgtiny_code svgtiny_add_path_linear_gradient(float *p, unsigned int n,
66 struct svgtiny_parse_state *state);
67 xmlNode *svgtiny_find_element_by_id(xmlNode *node, const char *id);
68
69 /* svgtiny_list.c */
70 struct svgtiny_list *svgtiny_list_create(size_t item_size);
71 unsigned int svgtiny_list_size(struct svgtiny_list *list);
72 svgtiny_code svgtiny_list_resize(struct svgtiny_list *list,
73 unsigned int new_size);
74 void *svgtiny_list_get(struct svgtiny_list *list,
75 unsigned int i);
76 void *svgtiny_list_push(struct svgtiny_list *list);
77 void svgtiny_list_free(struct svgtiny_list *list);
78
79 /* colors.gperf */
80 const struct svgtiny_named_color *
81 svgtiny_color_lookup(register const char *str,
82 register unsigned int len);
83
84 #endif