1 | /* vim: set sw=4: -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ |
---|
2 | /* |
---|
3 | rsvg-paint-server.h : RSVG colors |
---|
4 | |
---|
5 | Copyright (C) 2000 Eazel, Inc. |
---|
6 | Copyright (C) 2002 Dom Lachowicz <cinamod@hotmail.com> |
---|
7 | |
---|
8 | This program is free software; you can redistribute it and/or |
---|
9 | modify it under the terms of the GNU Library General Public License as |
---|
10 | published by the Free Software Foundation; either version 2 of the |
---|
11 | License, or (at your option) any later version. |
---|
12 | |
---|
13 | This program is distributed in the hope that it will be useful, |
---|
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
16 | Library General Public License for more details. |
---|
17 | |
---|
18 | You should have received a copy of the GNU Library General Public |
---|
19 | License along with this program; if not, write to the |
---|
20 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
---|
21 | Boston, MA 02111-1307, USA. |
---|
22 | |
---|
23 | Author: Raph Levien <raph@artofcode.com> |
---|
24 | */ |
---|
25 | |
---|
26 | #ifndef RSVG_PAINT_SERVER_H |
---|
27 | #define RSVG_PAINT_SERVER_H |
---|
28 | |
---|
29 | #include <glib/gtypes.h> |
---|
30 | #include <libart_lgpl/art_render_gradient.h> |
---|
31 | #include "rsvg-defs.h" |
---|
32 | |
---|
33 | G_BEGIN_DECLS |
---|
34 | |
---|
35 | typedef struct _RsvgGradientStop RsvgGradientStop; |
---|
36 | typedef struct _RsvgGradientStops RsvgGradientStops; |
---|
37 | typedef struct _RsvgLinearGradient RsvgLinearGradient; |
---|
38 | typedef struct _RsvgRadialGradient RsvgRadialGradient; |
---|
39 | typedef struct _RsvgPattern RsvgPattern; |
---|
40 | |
---|
41 | typedef struct _RsvgPaintServer RsvgPaintServer; |
---|
42 | |
---|
43 | typedef struct _RsvgPSCtx RsvgPSCtx; |
---|
44 | |
---|
45 | struct _RsvgPSCtx { |
---|
46 | int x0; |
---|
47 | int y0; |
---|
48 | int x1; |
---|
49 | int y1; |
---|
50 | |
---|
51 | guint32 color; |
---|
52 | double affine[6]; |
---|
53 | RsvgHandle *ctx; |
---|
54 | }; |
---|
55 | |
---|
56 | struct _RsvgGradientStop { |
---|
57 | double offset; |
---|
58 | gboolean is_current_color; |
---|
59 | guint32 rgba; |
---|
60 | }; |
---|
61 | |
---|
62 | struct _RsvgGradientStops { |
---|
63 | int n_stop; |
---|
64 | RsvgGradientStop *stop; |
---|
65 | }; |
---|
66 | |
---|
67 | struct _RsvgLinearGradient { |
---|
68 | RsvgDefVal super; |
---|
69 | gboolean obj_bbox; |
---|
70 | double affine[6]; /* user space to actual at time of gradient def */ |
---|
71 | RsvgGradientStops *stops; |
---|
72 | ArtGradientSpread spread; |
---|
73 | double x1, y1; |
---|
74 | double x2, y2; |
---|
75 | guint32 current_color; |
---|
76 | gboolean has_current_color; |
---|
77 | }; |
---|
78 | |
---|
79 | struct _RsvgRadialGradient { |
---|
80 | RsvgDefVal super; |
---|
81 | gboolean obj_bbox; |
---|
82 | double affine[6]; /* user space to actual at time of gradient def */ |
---|
83 | RsvgGradientStops *stops; |
---|
84 | ArtGradientSpread spread; |
---|
85 | double cx, cy; |
---|
86 | double r; |
---|
87 | double fx, fy; |
---|
88 | guint32 current_color; |
---|
89 | gboolean has_current_color; |
---|
90 | }; |
---|
91 | |
---|
92 | struct _RsvgPattern { |
---|
93 | RsvgDefVal super; |
---|
94 | gboolean obj_cbbox; |
---|
95 | gboolean obj_bbox; |
---|
96 | gboolean vbox; |
---|
97 | double affine[6]; /* user space to actual at time of gradient def */ |
---|
98 | double x, y, width, height; |
---|
99 | double vbx, vby, vbh, vbw; |
---|
100 | RsvgDefVal * g; |
---|
101 | RsvgDefVal * gfallback; |
---|
102 | }; |
---|
103 | |
---|
104 | /* Create a new paint server based on a specification string. */ |
---|
105 | RsvgPaintServer * |
---|
106 | rsvg_paint_server_parse (RsvgPaintServer * current, const RsvgDefs *defs, const char *str, |
---|
107 | guint32 current_color); |
---|
108 | |
---|
109 | void |
---|
110 | rsvg_render_paint_server (ArtRender *ar, RsvgPaintServer *ps, |
---|
111 | const RsvgPSCtx *ctx); |
---|
112 | |
---|
113 | void |
---|
114 | rsvg_paint_server_ref (RsvgPaintServer *ps); |
---|
115 | |
---|
116 | void |
---|
117 | rsvg_paint_server_unref (RsvgPaintServer *ps); |
---|
118 | |
---|
119 | RsvgRadialGradient * |
---|
120 | rsvg_clone_radial_gradient (const RsvgRadialGradient *grad, gboolean * shallow_cloned); |
---|
121 | |
---|
122 | RsvgLinearGradient * |
---|
123 | rsvg_clone_linear_gradient (const RsvgLinearGradient *grad, gboolean * shallow_cloned); |
---|
124 | |
---|
125 | RsvgPattern * |
---|
126 | rsvg_clone_pattern (const RsvgPattern *pattern); |
---|
127 | |
---|
128 | G_END_DECLS |
---|
129 | |
---|
130 | #endif |
---|