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 | |
---|
40 | typedef struct _RsvgPaintServer RsvgPaintServer; |
---|
41 | |
---|
42 | typedef struct _RsvgPSCtx RsvgPSCtx; |
---|
43 | |
---|
44 | struct _RsvgPSCtx { |
---|
45 | int dummy; |
---|
46 | /* todo: we need to take in some context information, including: |
---|
47 | |
---|
48 | 1. The global affine transformation. |
---|
49 | |
---|
50 | 2. User coordinates at time of reference (to implement |
---|
51 | gradientUnits = "userSpaceOnUse"). |
---|
52 | |
---|
53 | 3. Object bounding box (to implement gradientUnits = |
---|
54 | "objectBoundingBox"). |
---|
55 | |
---|
56 | Maybe signal for lazy evaluation of object bbox. |
---|
57 | */ |
---|
58 | }; |
---|
59 | |
---|
60 | struct _RsvgGradientStop { |
---|
61 | double offset; |
---|
62 | guint32 rgba; |
---|
63 | }; |
---|
64 | |
---|
65 | struct _RsvgGradientStops { |
---|
66 | int n_stop; |
---|
67 | RsvgGradientStop *stop; |
---|
68 | }; |
---|
69 | |
---|
70 | struct _RsvgLinearGradient { |
---|
71 | RsvgDefVal super; |
---|
72 | gboolean obj_bbox; |
---|
73 | double affine[6]; /* user space to actual at time of gradient def */ |
---|
74 | RsvgGradientStops *stops; |
---|
75 | ArtGradientSpread spread; |
---|
76 | double x1, y1; |
---|
77 | double x2, y2; |
---|
78 | }; |
---|
79 | |
---|
80 | struct _RsvgRadialGradient { |
---|
81 | RsvgDefVal super; |
---|
82 | gboolean obj_bbox; |
---|
83 | double affine[6]; /* user space to actual at time of gradient def */ |
---|
84 | RsvgGradientStops *stops; |
---|
85 | ArtGradientSpread spread; |
---|
86 | double cx, cy; |
---|
87 | double r; |
---|
88 | double fx, fy; |
---|
89 | }; |
---|
90 | |
---|
91 | /* Create a new paint server based on a specification string. */ |
---|
92 | RsvgPaintServer * |
---|
93 | rsvg_paint_server_parse (const RsvgDefs *defs, const char *str); |
---|
94 | |
---|
95 | void |
---|
96 | rsvg_render_paint_server (ArtRender *ar, RsvgPaintServer *ps, |
---|
97 | const RsvgPSCtx *ctx); |
---|
98 | |
---|
99 | void |
---|
100 | rsvg_paint_server_ref (RsvgPaintServer *ps); |
---|
101 | |
---|
102 | void |
---|
103 | rsvg_paint_server_unref (RsvgPaintServer *ps); |
---|
104 | |
---|
105 | RsvgRadialGradient * |
---|
106 | rsvg_clone_radial_gradient (const RsvgRadialGradient *grad, gboolean * shallow_cloned); |
---|
107 | |
---|
108 | RsvgLinearGradient * |
---|
109 | rsvg_clone_linear_gradient (const RsvgLinearGradient *grad, gboolean * shallow_cloned); |
---|
110 | |
---|
111 | G_END_DECLS |
---|
112 | |
---|
113 | #endif |
---|