summaryrefslogtreecommitdiffstats
path: root/src/sp-gradient.h
diff options
context:
space:
mode:
authorJon A. Cruz <jon@joncruz.org>2010-06-28 03:16:09 +0000
committerJon A. Cruz <jon@joncruz.org>2010-06-28 03:16:09 +0000
commit7e8ffe9fb3b42470802ed080dc827fdda32165b3 (patch)
treeb299fd5c823e786eb2baf6c92c02c38592be0d97 /src/sp-gradient.h
parentImplementing the "Convert" popup menu item for gradients/swatches. Part of bu... (diff)
downloadinkscape-7e8ffe9fb3b42470802ed080dc827fdda32165b3.tar.gz
inkscape-7e8ffe9fb3b42470802ed080dc827fdda32165b3.zip
Partial C++-ification of SPGradient
(bzr r9542)
Diffstat (limited to 'src/sp-gradient.h')
-rw-r--r--src/sp-gradient.h42
1 files changed, 39 insertions, 3 deletions
diff --git a/src/sp-gradient.h b/src/sp-gradient.h
index e7488673d..7e6afe052 100644
--- a/src/sp-gradient.h
+++ b/src/sp-gradient.h
@@ -29,14 +29,12 @@
struct SPGradientReference;
-#define SP_TYPE_GRADIENT (sp_gradient_get_type())
+#define SP_TYPE_GRADIENT (SPGradient::getType())
#define SP_GRADIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SP_TYPE_GRADIENT, SPGradient))
#define SP_GRADIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SP_TYPE_GRADIENT, SPGradientClass))
#define SP_IS_GRADIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), SP_TYPE_GRADIENT))
#define SP_IS_GRADIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SP_TYPE_GRADIENT))
-GType sp_gradient_get_type();
-
typedef enum {
SP_GRADIENT_TYPE_UNKNOWN,
SP_GRADIENT_TYPE_LINEAR,
@@ -78,20 +76,24 @@ struct SPGradient : public SPPaintServer {
/** State in Inkscape gradient system */
guint state : 2;
+private:
/** gradientUnits attribute */
SPGradientUnits units;
guint units_set : 1;
+public:
/** gradientTransform attribute */
Geom::Matrix gradientTransform;
guint gradientTransform_set : 1;
+private:
/** spreadMethod attribute */
SPGradientSpread spread;
guint spread_set : 1;
/** Gradient stops */
guint has_stops : 1;
+public:
/** Composed vector */
SPGradientVector vector;
@@ -101,10 +103,20 @@ struct SPGradient : public SPPaintServer {
sigc::connection modified_connection;
+ bool hasStops() const;
SPStop* getFirstStop();
int getStopCount() const;
+
+ bool isUnitsSet() const;
+ SPGradientUnits getUnits() const;
+ void setUnits(SPGradientUnits units);
+
+
+ bool isSpreadSet() const;
+ SPGradientSpread getSpread() const;
+
/**
* Returns private vector of given gradient (the gradient at the end of the href chain which has
* stops), optionally normalizing it.
@@ -113,6 +125,30 @@ struct SPGradient : public SPPaintServer {
* \pre There exists a gradient in the chain that has stops.
*/
SPGradient *getVector(bool force_private = false);
+
+ static GType getType();
+
+ /** Forces vector to be built, if not present (i.e. changed) */
+ void ensureVector();
+
+ /** Ensures that color array is populated */
+ void ensureColors();
+
+ /**
+ * Set spread property of gradient and emit modified.
+ */
+ void setSpread(SPGradientSpread spread);
+
+ SPGradientSpread fetchSpread();
+ SPGradientUnits fetchUnits();
+
+private:
+ bool invalidateVector();
+ void rebuildVector();
+
+ friend class SPGradientImpl;
+ friend class SPLGPainter;
+ friend class SPRGPainter;
};
/**