Code

Fixed rendering glitch in bicubic scaler
[inkscape.git] / src / style.h
index df2ba127f6b374ccdb401fb4155afcfe10a0ffd4..2e928224b932518b740c02017ab6d11f570d4bbd 100644 (file)
 #include "forward.h"
 #include "sp-marker-loc.h"
 #include "sp-filter.h"
+#include "sp-filter-reference.h"
+#include "uri-references.h"
+#include "uri.h"
+#include "sp-paint-server.h"
 
 #include <sigc++/connection.h>
 
@@ -28,10 +32,6 @@ class Node;
 
 class SPCSSAttr;
 
-namespace Inkscape {
-gchar *parse_css_url(gchar const *string);
-}
-
 class SPIFloat;
 class SPIScale24;
 class SPIInt;
@@ -139,10 +139,10 @@ struct SPILength {
     float computed;
 };
 
-#define SP_STYLE_FILL_SERVER(s) (((SPStyle *) (s))->fill.value.paint.server)
-#define SP_STYLE_STROKE_SERVER(s) (((SPStyle *) (s))->stroke.value.paint.server)
-#define SP_OBJECT_STYLE_FILL_SERVER(o) (SP_OBJECT (o)->style->fill.value.paint.server)
-#define SP_OBJECT_STYLE_STROKE_SERVER(o) (SP_OBJECT (o)->style->stroke.value.paint.server)
+#define SP_STYLE_FILL_SERVER(s) (((SPStyle *) (s))->getFillPaintServer())
+#define SP_STYLE_STROKE_SERVER(s) (((SPStyle *) (s))->getStrokePaintServer())
+#define SP_OBJECT_STYLE_FILL_SERVER(o) (SP_OBJECT (o)->style->getFillPaintServer())
+#define SP_OBJECT_STYLE_STROKE_SERVER(o) (SP_OBJECT (o)->style->getStrokePaintServer())
 
 enum {
     SP_PAINT_TYPE_NONE,
@@ -160,17 +160,12 @@ struct SPIPaint {
     unsigned currentcolor : 1;
     unsigned type : 2;
     struct {
-        struct {
-            SPPaintServer *server;
-            gchar *uri;
-        } paint;
+        SPPaintServerReference *href; 
         SPColor color;
         SVGICCColor *iccColor;
     } value;
 };
 
-struct SPFilterReference;
-
 /// Filter type internal to SPStyle
 struct SPIFilter {
     unsigned set : 1;
@@ -235,8 +230,12 @@ public:
 /// An SVG style object.
 struct SPStyle {
     int refcount;
+
     /** Object we are attached to */
     SPObject *object;
+    /** Document we are associated with */
+    SPDocument *document;
+
     /** Our text style component */
     SPTextStyle *text;
     unsigned text_private : 1;
@@ -347,19 +346,21 @@ struct SPStyle {
      * their background image */
     SPIEnum enable_background;
 
-    /// style belongs to a cloned object, must not href anything
+    /// style belongs to a cloned object
     bool cloned; 
-    /// style has hreffed its fill/stroke paintservers, needs to release.
-    bool fill_hreffed; 
-    bool stroke_hreffed; 
 
     sigc::connection release_connection;
 
-    sigc::connection fill_release_connection;
-    sigc::connection fill_modified_connection;
+    sigc::connection filter_modified_connection;
+    sigc::connection fill_ps_modified_connection;
+    sigc::connection stroke_ps_modified_connection;
 
-    sigc::connection stroke_release_connection;
-    sigc::connection stroke_modified_connection;
+    SPObject *getFilter() {if (filter.href) return filter.href->getObject(); else return NULL;}
+    const gchar *getFilterURI() {if (filter.href) return filter.href->getURI()->toString(); else return NULL;}
+    SPPaintServer *getFillPaintServer() {if (fill.value.href) return fill.value.href->getObject(); else return NULL;}
+    const gchar *getFillURI() {if (fill.value.href) return fill.value.href->getURI()->toString(); else return NULL;}
+    SPPaintServer *getStrokePaintServer() {if (stroke.value.href) return stroke.value.href->getObject(); else return NULL;}
+    const gchar *getStrokeURI() {if (stroke.value.href) return stroke.value.href->getURI()->toString(); else return NULL;}
 };
 
 SPStyle *sp_style_new(SPDocument *document);
@@ -384,6 +385,8 @@ gchar *sp_style_write_string(SPStyle const *style, guint flags = SP_STYLE_FLAG_I
 
 gchar *sp_style_write_difference(SPStyle const *from, SPStyle const *to);
 
+void sp_style_set_to_uri_string (SPStyle *style, bool isfill, const gchar *uri);
+
 /* SPTextStyle */
 
 enum SPCSSFontSize {