X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fstyle.h;h=2e928224b932518b740c02017ab6d11f570d4bbd;hb=2f0993d11346cad40098fafdcce23e8cb65127a3;hp=333344ad9b2fd280b21d645cc1b8805d56022a38;hpb=226d6d28236ad91c681c13bcf1cff4c1639b153b;p=inkscape.git diff --git a/src/style.h b/src/style.h index 333344ad9..2e928224b 100644 --- a/src/style.h +++ b/src/style.h @@ -16,6 +16,13 @@ #include "color.h" #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 namespace Inkscape { namespace XML { @@ -25,10 +32,6 @@ class Node; class SPCSSAttr; -namespace Inkscape { -gchar *parse_css_url(gchar const *string); -} - class SPIFloat; class SPIScale24; class SPIInt; @@ -136,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, @@ -148,21 +151,28 @@ enum { SP_PAINT_TYPE_IMPOSSIBLE }; +class SVGICCColor; + /// Paint type internal to SPStyle. struct SPIPaint { unsigned set : 1; unsigned inherit : 1; unsigned currentcolor : 1; unsigned type : 2; - union { + struct { + SPPaintServerReference *href; SPColor color; - struct { - SPPaintServer *server; - gchar *uri; - } paint; + SVGICCColor *iccColor; } value; }; +/// Filter type internal to SPStyle +struct SPIFilter { + unsigned set : 1; + unsigned inherit : 1; + SPFilterReference *href; +}; + enum { SP_FONT_SIZE_LITERAL, SP_FONT_SIZE_LENGTH, @@ -220,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; @@ -319,15 +333,37 @@ struct SPStyle { /** Marker list */ SPIString marker[SP_MARKER_LOC_QTY]; - /// style belongs to a cloned object, must not href anything + /** Filter effect */ + SPIFilter filter; + + SPIEnum filter_blend_mode; + + /** normally not used, but duplicates the Gaussian blur deviation (if any) from the attached + filter when the style is used for querying */ + SPILength filter_gaussianBlur_deviation; + + /** enable-background, used for defining where filter effects get + * their background image */ + SPIEnum enable_background; + + /// style belongs to a cloned object bool cloned; - /// style has hreffed its paintservers, needs to release - bool hreffed; - /// style is listening to changes in paintservers, need to disconnect - bool listening; + + sigc::connection release_connection; + + sigc::connection filter_modified_connection; + sigc::connection fill_ps_modified_connection; + sigc::connection stroke_ps_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(); +SPStyle *sp_style_new(SPDocument *document); SPStyle *sp_style_new_from_object(SPObject *object); @@ -349,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 { @@ -479,6 +517,11 @@ enum SPCSSDisplay { SP_CSS_DISPLAY_TABLE_CAPTION }; +enum SPEnableBackground { + SP_CSS_BACKGROUND_ACCUMULATE, + SP_CSS_BACKGROUND_NEW +}; + /// An SPTextStyle has a refcount, a font family, and a font name. struct SPTextStyle { int refcount; @@ -498,6 +541,11 @@ SPCSSAttr *sp_css_attr_scale(SPCSSAttr *css, double ex); void sp_style_unset_property_attrs(SPObject *o); +void sp_style_set_property_url (SPObject *item, gchar const *property, SPObject *linked, bool recursive); + +gchar *attribute_unquote(gchar const *val); +gchar *css2_escape_quote(gchar const *val); + #endif