summaryrefslogtreecommitdiffstats
path: root/src/sp-gradient.h
blob: abd44538e71204c6f3c7ce389c75a21777088f0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#ifndef __SP_GRADIENT_H__
#define __SP_GRADIENT_H__

/** \file
 * SVG <stop> <linearGradient> and <radialGradient> implementation
 *
 * Authors:
 *   Lauris Kaplinski <lauris@kaplinski.com>
 *   Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
 *
 * Copyright (C) 2007 Johan Engelen
 * Copyright (C) 1999-2002 Lauris Kaplinski
 * Copyright (C) 2000-2001 Ximian, Inc.
 *
 * Released under GNU GPL, read the file 'COPYING' for more information
 */

#include <gdk/gdktypes.h>
#include "libnr/nr-matrix.h"
#include "sp-paint-server.h"
#include "sp-gradient-spread.h"
#include "sp-gradient-units.h"
#include "sp-gradient-vector.h"

#include <sigc++/connection.h>

struct SPGradientReference;

typedef enum {
	SP_GRADIENT_TYPE_UNKNOWN,
	SP_GRADIENT_TYPE_LINEAR,
	SP_GRADIENT_TYPE_RADIAL
} SPGradientType;

typedef enum {
	SP_GRADIENT_STATE_UNKNOWN,
	SP_GRADIENT_STATE_VECTOR,
	SP_GRADIENT_STATE_PRIVATE
} SPGradientState;

typedef enum {
    POINT_LG_BEGIN =0, //start enum at 0 (for indexing into gr_knot_shapes array for example)
    POINT_LG_END,
    POINT_LG_MID,
    POINT_RG_CENTER,
    POINT_RG_R1,
    POINT_RG_R2,
    POINT_RG_FOCUS,
    POINT_RG_MID1,
    POINT_RG_MID2,
    // insert new point types here.
    
    POINT_G_INVALID
} GrPointType;

/**
 * Gradient
 *
 * Implement spread, stops list
 * \todo fixme: Implement more here (Lauris)
 */
struct SPGradient : public SPPaintServer {

	/** Reference (href) */
	SPGradientReference *ref;

	/** State in Inkscape gradient system */
	guint state : 2;

	/** gradientUnits attribute */
	SPGradientUnits units;
	guint units_set : 1;

	/** gradientTransform attribute */
	Geom::Matrix gradientTransform;
	guint gradientTransform_set : 1;

	/** spreadMethod attribute */
	SPGradientSpread spread;
	guint spread_set : 1;

	/** Gradient stops */
	guint has_stops : 1;

	/** Composed vector */
	SPGradientVector vector;

	/** Rendered color array (4 * 1024 bytes) */
	guchar *color;

        sigc::connection modified_connection;
};

/**
 * The SPGradient vtable.
 */
struct SPGradientClass {
	SPPaintServerClass parent_class;
};


#include "sp-gradient-fns.h"

#endif /* !__SP_GRADIENT_H__ */

/*
  Local Variables:
  mode:c++
  c-file-style:"stroustrup"
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
  indent-tabs-mode:nil
  fill-column:99
  End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :