summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJon A. Cruz <jon@joncruz.org>2010-03-04 08:52:16 +0000
committerJon A. Cruz <jon@joncruz.org>2010-03-04 08:52:16 +0000
commit8d55d1e1ccbe7bde72373e1b127e9d1d3099c999 (patch)
tree8ec2a3ef89e359673f19a173f84fb93087761375 /src
parentFixed const correctness for gradient stop count routines. (diff)
downloadinkscape-8d55d1e1ccbe7bde72373e1b127e9d1d3099c999.tar.gz
inkscape-8d55d1e1ccbe7bde72373e1b127e9d1d3099c999.zip
Added method to query "solid paint" status of SPGradient.
(bzr r9140)
Diffstat (limited to 'src')
-rw-r--r--src/sp-gradient.cpp14
-rw-r--r--src/sp-gradient.h59
2 files changed, 45 insertions, 28 deletions
diff --git a/src/sp-gradient.cpp b/src/sp-gradient.cpp
index 84a0a9870..3fd120fb3 100644
--- a/src/sp-gradient.cpp
+++ b/src/sp-gradient.cpp
@@ -638,6 +638,20 @@ sp_gradient_modified(SPObject *object, guint flags)
}
}
+
+bool SPGradient::isSolid() const
+{
+ bool solid = false;
+ if ( SP_GRADIENT_HAS_STOPS(this) && (sp_number_of_stops(this) == 0) ) {
+ gchar const * attr = repr->attribute("osb:paint");
+ if (attr && !strcmp(attr, "solid")) {
+ solid = true;
+ }
+ }
+ return solid;
+}
+
+
/**
* Write gradient attributes to repr.
*/
diff --git a/src/sp-gradient.h b/src/sp-gradient.h
index abd44538e..947cc49cc 100644
--- a/src/sp-gradient.h
+++ b/src/sp-gradient.h
@@ -27,15 +27,15 @@
struct SPGradientReference;
typedef enum {
- SP_GRADIENT_TYPE_UNKNOWN,
- SP_GRADIENT_TYPE_LINEAR,
- SP_GRADIENT_TYPE_RADIAL
+ 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
+ SP_GRADIENT_STATE_UNKNOWN,
+ SP_GRADIENT_STATE_VECTOR,
+ SP_GRADIENT_STATE_PRIVATE
} SPGradientState;
typedef enum {
@@ -49,7 +49,7 @@ typedef enum {
POINT_RG_MID1,
POINT_RG_MID2,
// insert new point types here.
-
+
POINT_G_INVALID
} GrPointType;
@@ -61,41 +61,44 @@ typedef enum {
*/
struct SPGradient : public SPPaintServer {
- /** Reference (href) */
- SPGradientReference *ref;
+ /** Reference (href) */
+ SPGradientReference *ref;
+
+ /** State in Inkscape gradient system */
+ guint state : 2;
+
+ /** gradientUnits attribute */
+ SPGradientUnits units;
+ guint units_set : 1;
- /** State in Inkscape gradient system */
- guint state : 2;
+ /** gradientTransform attribute */
+ Geom::Matrix gradientTransform;
+ guint gradientTransform_set : 1;
- /** gradientUnits attribute */
- SPGradientUnits units;
- guint units_set : 1;
+ /** spreadMethod attribute */
+ SPGradientSpread spread;
+ guint spread_set : 1;
- /** gradientTransform attribute */
- Geom::Matrix gradientTransform;
- guint gradientTransform_set : 1;
+ /** Gradient stops */
+ guint has_stops : 1;
- /** spreadMethod attribute */
- SPGradientSpread spread;
- guint spread_set : 1;
+ /** Composed vector */
+ SPGradientVector vector;
- /** Gradient stops */
- guint has_stops : 1;
+ /** Rendered color array (4 * 1024 bytes) */
+ guchar *color;
- /** Composed vector */
- SPGradientVector vector;
+ sigc::connection modified_connection;
- /** Rendered color array (4 * 1024 bytes) */
- guchar *color;
- sigc::connection modified_connection;
+ bool isSolid() const;
};
/**
* The SPGradient vtable.
*/
struct SPGradientClass {
- SPPaintServerClass parent_class;
+ SPPaintServerClass parent_class;
};