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>
8 #ifndef SVGTINY_INTERNAL_H
9 #define SVGTINY_INTERNAL_H
13 struct svgtiny_gradient_stop
{
18 #define svgtiny_MAX_STOPS 10
19 #define svgtiny_LINEAR_GRADIENT 0x2000000
21 struct svgtiny_parse_state
{
22 struct svgtiny_diagram
*diagram
;
26 float viewport_height
;
28 /* current transformation matrix */
30 float a
, b
, c
, d
, e
, f
;
33 /*struct css_style style;*/
35 /* paint attributes */
37 svgtiny_colour stroke
;
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
;
46 float a
, b
, c
, d
, e
, f
;
52 float svgtiny_parse_length(const char *s
, int viewport_size
,
53 const struct svgtiny_parse_state state
);
54 void svgtiny_parse_color(const char *s
, svgtiny_colour
*c
,
55 struct svgtiny_parse_state
*state
);
56 void svgtiny_parse_transform(char *s
, float *ma
, float *mb
,
57 float *mc
, float *md
, float *me
, float *mf
);
58 struct svgtiny_shape
*svgtiny_add_shape(struct svgtiny_parse_state
*state
);
59 void svgtiny_transform_path(float *p
, unsigned int n
,
60 struct svgtiny_parse_state
*state
);
62 /* svgtiny_gradient.c */
63 void svgtiny_find_gradient(const char *id
, struct svgtiny_parse_state
*state
);
64 svgtiny_code
svgtiny_add_path_linear_gradient(float *p
, unsigned int n
,
65 struct svgtiny_parse_state
*state
);
66 xmlNode
*svgtiny_find_element_by_id(xmlNode
*node
, const char *id
);
69 const struct svgtiny_named_color
*
70 svgtiny_color_lookup(register const char *str
,
71 register unsigned int len
);