Code

Made some improvements to the osx-build.sh script to use BZR and to be able
[inkscape.git] / src / sp-gradient.h
1 #ifndef SEEN_SP_GRADIENT_H
2 #define SEEN_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  *   Jon A. Cruz <jon@joncruz.org>
11  *
12  * Copyrigt  (C) 2010 Jon A. Cruz
13  * Copyright (C) 2007 Johan Engelen
14  * Copyright (C) 1999-2002 Lauris Kaplinski
15  * Copyright (C) 2000-2001 Ximian, Inc.
16  *
17  * Released under GNU GPL, read the file 'COPYING' for more information
18  */
20 #include <gdk/gdktypes.h>
21 #include "libnr/nr-matrix.h"
22 #include "sp-paint-server.h"
23 #include "sp-gradient-spread.h"
24 #include "sp-gradient-units.h"
25 #include "sp-gradient-vector.h"
27 #include <sigc++/connection.h>
29 struct SPGradientReference;
32 #define SP_TYPE_GRADIENT (sp_gradient_get_type())
33 #define SP_GRADIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SP_TYPE_GRADIENT, SPGradient))
34 #define SP_GRADIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SP_TYPE_GRADIENT, SPGradientClass))
35 #define SP_IS_GRADIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), SP_TYPE_GRADIENT))
36 #define SP_IS_GRADIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SP_TYPE_GRADIENT))
38 GType sp_gradient_get_type();
40 typedef enum {
41     SP_GRADIENT_TYPE_UNKNOWN,
42     SP_GRADIENT_TYPE_LINEAR,
43     SP_GRADIENT_TYPE_RADIAL
44 } SPGradientType;
46 typedef enum {
47     SP_GRADIENT_STATE_UNKNOWN,
48     SP_GRADIENT_STATE_VECTOR,
49     SP_GRADIENT_STATE_PRIVATE
50 } SPGradientState;
52 typedef enum {
53     POINT_LG_BEGIN =0, //start enum at 0 (for indexing into gr_knot_shapes array for example)
54     POINT_LG_END,
55     POINT_LG_MID,
56     POINT_RG_CENTER,
57     POINT_RG_R1,
58     POINT_RG_R2,
59     POINT_RG_FOCUS,
60     POINT_RG_MID1,
61     POINT_RG_MID2,
62     // insert new point types here.
64     POINT_G_INVALID
65 } GrPointType;
67 /**
68  * Gradient
69  *
70  * Implement spread, stops list
71  * \todo fixme: Implement more here (Lauris)
72  */
73 struct SPGradient : public SPPaintServer {
75     /** Reference (href) */
76     SPGradientReference *ref;
78     /** State in Inkscape gradient system */
79     guint state : 2;
81     /** gradientUnits attribute */
82     SPGradientUnits units;
83     guint units_set : 1;
85     /** gradientTransform attribute */
86     Geom::Matrix gradientTransform;
87     guint gradientTransform_set : 1;
89     /** spreadMethod attribute */
90     SPGradientSpread spread;
91     guint spread_set : 1;
93     /** Gradient stops */
94     guint has_stops : 1;
96     /** Composed vector */
97     SPGradientVector vector;
99     /** Rendered color array (4 * 1024 bytes) */
100     guchar *color;
102     sigc::connection modified_connection;
105     SPStop* getFirstStop();
106     int getStopCount() const;
108 /**
109  * Returns private vector of given gradient (the gradient at the end of the href chain which has
110  * stops), optionally normalizing it.
111  *
112  * \pre SP_IS_GRADIENT(gradient).
113  * \pre There exists a gradient in the chain that has stops.
114  */
115     SPGradient *getVector(bool force_private = false);
116 };
118 /**
119  * The SPGradient vtable.
120  */
121 struct SPGradientClass {
122     SPPaintServerClass parent_class;
123 };
126 #include "sp-gradient-fns.h"
128 #endif // SEEN_SP_GRADIENT_H
130 /*
131   Local Variables:
132   mode:c++
133   c-file-style:"stroustrup"
134   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
135   indent-tabs-mode:nil
136   fill-column:99
137   End:
138 */
139 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :