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