Code

Don't snap to points which are off-screen
[inkscape.git] / src / sp-gradient.h
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 {
64     /** Reference (href) */
65     SPGradientReference *ref;
67     /** State in Inkscape gradient system */
68     guint state : 2;
70     /** gradientUnits attribute */
71     SPGradientUnits units;
72     guint units_set : 1;
74     /** gradientTransform attribute */
75     Geom::Matrix gradientTransform;
76     guint gradientTransform_set : 1;
78     /** spreadMethod attribute */
79     SPGradientSpread spread;
80     guint spread_set : 1;
82     /** Gradient stops */
83     guint has_stops : 1;
85     /** Composed vector */
86     SPGradientVector vector;
88     /** Rendered color array (4 * 1024 bytes) */
89     guchar *color;
91     sigc::connection modified_connection;
94     SPStop* getFirstStop();
95     int getStopCount() const;
96 };
98 /**
99  * The SPGradient vtable.
100  */
101 struct SPGradientClass {
102     SPPaintServerClass parent_class;
103 };
106 #include "sp-gradient-fns.h"
108 #endif /* !__SP_GRADIENT_H__ */
110 /*
111   Local Variables:
112   mode:c++
113   c-file-style:"stroustrup"
114   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
115   indent-tabs-mode:nil
116   fill-column:99
117   End:
118 */
119 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :