1 #ifndef __SP_GRADIENT_H__
2 #define __SP_GRADIENT_H__
4 /** \file
5 * SVG <stop> <linearGradient> and <radialGradient> implementation
6 *
7 * Authors:
8 * Lauris Kaplinski <lauris@kaplinski.com>
9 * Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
10 *
11 * Copyright (C) 2007 Johan Engelen
12 * Copyright (C) 1999-2002 Lauris Kaplinski
13 * Copyright (C) 2000-2001 Ximian, Inc.
14 *
15 * Released under GNU GPL, read the file 'COPYING' for more information
16 */
18 #include <gdk/gdktypes.h>
19 #include "libnr/nr-matrix.h"
20 #include "sp-paint-server.h"
21 #include "sp-gradient-spread.h"
22 #include "sp-gradient-units.h"
23 #include "sp-gradient-vector.h"
25 #include <sigc++/connection.h>
27 struct SPGradientReference;
29 typedef enum {
30 SP_GRADIENT_TYPE_UNKNOWN,
31 SP_GRADIENT_TYPE_LINEAR,
32 SP_GRADIENT_TYPE_RADIAL
33 } SPGradientType;
35 typedef enum {
36 SP_GRADIENT_STATE_UNKNOWN,
37 SP_GRADIENT_STATE_VECTOR,
38 SP_GRADIENT_STATE_PRIVATE
39 } SPGradientState;
41 typedef enum {
42 POINT_LG_BEGIN =0, //start enum at 0 (for indexing into gr_knot_shapes array for example)
43 POINT_LG_END,
44 POINT_LG_MID,
45 POINT_RG_CENTER,
46 POINT_RG_R1,
47 POINT_RG_R2,
48 POINT_RG_FOCUS,
49 POINT_RG_MID1,
50 POINT_RG_MID2,
51 // insert new point types here.
53 POINT_G_INVALID
54 } GrPointType;
56 /**
57 * Gradient
58 *
59 * Implement spread, stops list
60 * \todo fixme: Implement more here (Lauris)
61 */
62 struct SPGradient : public SPPaintServer {
63 /** Reference (href) */
64 SPGradientReference *ref;
65 /** State in Inkscape gradient system */
66 guint state : 2;
67 /** gradientUnits attribute */
68 SPGradientUnits units;
69 guint units_set : 1;
70 /** gradientTransform attribute */
71 NR::Matrix gradientTransform;
72 guint gradientTransform_set : 1;
73 /** spreadMethod attribute */
74 SPGradientSpread spread;
75 guint spread_set : 1;
76 /** Gradient stops */
77 guint has_stops : 1;
78 /** Composed vector */
79 SPGradientVector vector;
80 /** Rendered color array (4 * 1024 bytes) */
81 guchar *color;
83 sigc::connection modified_connection;
84 };
86 /**
87 * The SPGradient vtable.
88 */
89 struct SPGradientClass {
90 SPPaintServerClass parent_class;
91 };
94 #include "sp-gradient-fns.h"
96 #endif /* !__SP_GRADIENT_H__ */
98 /*
99 Local Variables:
100 mode:c++
101 c-file-style:"stroustrup"
102 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
103 indent-tabs-mode:nil
104 fill-column:99
105 End:
106 */
107 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :