Code

Next roud of NR ==> Geom conversion
[inkscape.git] / src / desktop-style.cpp
1 #define __SP_DESKTOP_STYLE_C__
3 /** \file
4  * Desktop style management
5  *
6  * Authors:
7  *   bulia byak
8  *   verbalshadow
9  *
10  * Copyright (C) 2004, 2006 authors
11  *
12  * Released under GNU GPL, read the file 'COPYING' for more information
13  */
15 #include <string>
16 #include <cstring>
18 #include "desktop.h"
19 #include "color-rgba.h"
20 #include "svg/css-ostringstream.h"
21 #include "svg/svg.h"
22 #include "svg/svg-color.h"
23 #include "selection.h"
24 #include "inkscape.h"
25 #include "style.h"
26 #include "prefs-utils.h"
27 #include "sp-use.h"
28 #include "sp-feblend.h"
29 #include "sp-filter.h"
30 #include "sp-filter-reference.h"
31 #include "sp-gaussian-blur.h"
32 #include "sp-flowtext.h"
33 #include "sp-flowregion.h"
34 #include "sp-flowdiv.h"
35 #include "sp-linear-gradient.h"
36 #include "sp-pattern.h"
37 #include "sp-radial-gradient.h"
38 #include "sp-textpath.h"
39 #include "sp-tref.h"
40 #include "sp-tspan.h"
41 #include "xml/repr.h"
42 #include "libnrtype/font-style-to-pos.h"
43 #include "sp-path.h"
45 #include "desktop-style.h"
46 #include "svg/svg-icc-color.h"
47 #include "box3d-side.h"
49 /**
50  * Set color on selection on desktop.
51  */
52 void
53 sp_desktop_set_color(SPDesktop *desktop, ColorRGBA const &color, bool is_relative, bool fill)
54 {
55     /// \todo relative color setting
56     if (is_relative) {
57         g_warning("FIXME: relative color setting not yet implemented");
58         return;
59     }
61     guint32 rgba = SP_RGBA32_F_COMPOSE(color[0], color[1], color[2], color[3]);
62     gchar b[64];
63     sp_svg_write_color(b, sizeof(b), rgba);
64     SPCSSAttr *css = sp_repr_css_attr_new();
65     if (fill) {
66         sp_repr_css_set_property(css, "fill", b);
67         Inkscape::CSSOStringStream osalpha;
68         osalpha << color[3];
69         sp_repr_css_set_property(css, "fill-opacity", osalpha.str().c_str());
70     } else {
71         sp_repr_css_set_property(css, "stroke", b);
72         Inkscape::CSSOStringStream osalpha;
73         osalpha << color[3];
74         sp_repr_css_set_property(css, "stroke-opacity", osalpha.str().c_str());
75     }
77     sp_desktop_set_style(desktop, css);
79     sp_repr_css_attr_unref(css);
80 }
82 /**
83  * Apply style on object and children, recursively.
84  */
85 void
86 sp_desktop_apply_css_recursive(SPObject *o, SPCSSAttr *css, bool skip_lines)
87 {
88     // non-items should not have style
89     if (!SP_IS_ITEM(o))
90         return;
92     // 1. tspans with role=line are not regular objects in that they are not supposed to have style of their own,
93     // but must always inherit from the parent text. Same for textPath.
94     // However, if the line tspan or textPath contains some style (old file?), we reluctantly set our style to it too.
96     // 2. Generally we allow setting style on clones, but when it's inside flowRegion, do not touch
97     // it, be it clone or not; it's just styleless shape (because that's how Inkscape does
98     // flowtext).
100     if (!(skip_lines
101           && ((SP_IS_TSPAN(o) && SP_TSPAN(o)->role == SP_TSPAN_ROLE_LINE)
102               || SP_IS_FLOWDIV(o)
103               || SP_IS_FLOWPARA(o)
104               || SP_IS_TEXTPATH(o))
105           && !SP_OBJECT_REPR(o)->attribute("style"))
106         &&
107         !(SP_IS_FLOWREGION(o) ||
108           SP_IS_FLOWREGIONEXCLUDE(o) ||
109           (SP_IS_USE(o) &&
110            SP_OBJECT_PARENT(o) &&
111            (SP_IS_FLOWREGION(SP_OBJECT_PARENT(o)) ||
112             SP_IS_FLOWREGIONEXCLUDE(SP_OBJECT_PARENT(o))
113            )
114           )
115          )
116         ) {
118         SPCSSAttr *css_set = sp_repr_css_attr_new();
119         sp_repr_css_merge(css_set, css);
121         // Scale the style by the inverse of the accumulated parent transform in the paste context.
122         {
123             Geom::Matrix const local(sp_item_i2doc_affine(SP_ITEM(o)));
124             double const ex(local.descrim());
125             if ( ( ex != 0. )
126                  && ( ex != 1. ) ) {
127                 sp_css_attr_scale(css_set, 1/ex);
128             }
129         }
131         sp_repr_css_change(SP_OBJECT_REPR(o), css_set, "style");
133         sp_repr_css_attr_unref(css_set);
134     }
136     // setting style on child of clone spills into the clone original (via shared repr), don't do it!
137     if (SP_IS_USE(o))
138         return;
140     for (SPObject *child = sp_object_first_child(SP_OBJECT(o)) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
141         if (sp_repr_css_property(css, "opacity", NULL) != NULL) {
142             // Unset properties which are accumulating and thus should not be set recursively.
143             // For example, setting opacity 0.5 on a group recursively would result in the visible opacity of 0.25 for an item in the group.
144             SPCSSAttr *css_recurse = sp_repr_css_attr_new();
145             sp_repr_css_merge(css_recurse, css);
146             sp_repr_css_set_property(css_recurse, "opacity", NULL);
147             sp_desktop_apply_css_recursive(child, css_recurse, skip_lines);
148             sp_repr_css_attr_unref(css_recurse);
149         } else {
150             sp_desktop_apply_css_recursive(child, css, skip_lines);
151         }
152     }
155 /**
156  * Apply style on selection on desktop.
157  */
158 void
159 sp_desktop_set_style(SPDesktop *desktop, SPCSSAttr *css, bool change, bool write_current)
161     if (write_current) {
162 // 1. Set internal value
163         sp_repr_css_merge(desktop->current, css);
165 // 1a. Write to prefs; make a copy and unset any URIs first
166         SPCSSAttr *css_write = sp_repr_css_attr_new();
167         sp_repr_css_merge(css_write, css);
168         sp_css_attr_unset_uris(css_write);
169         sp_repr_css_change(inkscape_get_repr(INKSCAPE, "desktop"), css_write, "style");
170         for (const GSList *i = desktop->selection->itemList(); i != NULL; i = i->next) {
171             /* last used styles for 3D box faces are stored separately */
172             if (SP_IS_BOX3D_SIDE (i->data)) {
173                 const char * descr  = box3d_side_axes_string(SP_BOX3D_SIDE(i->data));
174                 if (descr != NULL) {
175                     gchar *style_grp = g_strconcat ("desktop.", descr, NULL);
176                     sp_repr_css_change(inkscape_get_repr(INKSCAPE, style_grp), css_write, "style");
177                     g_free (style_grp);
178                 }
179             }
180         }
181         sp_repr_css_attr_unref(css_write);
182     }
184     if (!change)
185         return;
187 // 2. Emit signal
188     bool intercepted = desktop->_set_style_signal.emit(css);
190 /** \todo
191  * FIXME: in set_style, compensate pattern and gradient fills, stroke width,
192  * rect corners, font size for the object's own transform so that pasting
193  * fills does not depend on preserve/optimize.
194  */
196 // 3. If nobody has intercepted the signal, apply the style to the selection
197     if (!intercepted) {
198         for (GSList const *i = desktop->selection->itemList(); i != NULL; i = i->next) {
199             /// \todo if the style is text-only, apply only to texts?
200             sp_desktop_apply_css_recursive(SP_OBJECT(i->data), css, true);
201         }
202     }
205 /**
206  * Return the desktop's current style.
207  */
208 SPCSSAttr *
209 sp_desktop_get_style(SPDesktop *desktop, bool with_text)
211     SPCSSAttr *css = sp_repr_css_attr_new();
212     sp_repr_css_merge(css, desktop->current);
213     if (!css->attributeList()) {
214         sp_repr_css_attr_unref(css);
215         return NULL;
216     } else {
217         if (!with_text) {
218             css = sp_css_attr_unset_text(css);
219         }
220         return css;
221     }
224 /**
225  * Return the desktop's current color.
226  */
227 guint32
228 sp_desktop_get_color(SPDesktop *desktop, bool is_fill)
230     guint32 r = 0; // if there's no color, return black
231     gchar const *property = sp_repr_css_property(desktop->current,
232                                                  is_fill ? "fill" : "stroke",
233                                                  "#000");
235     if (desktop->current && property) { // if there is style and the property in it,
236         if (strncmp(property, "url", 3)) { // and if it's not url,
237             // read it
238             r = sp_svg_read_color(property, r);
239         }
240     }
242     return r;
245 double
246 sp_desktop_get_master_opacity_tool(SPDesktop *desktop, char const *tool, bool *has_opacity)
248     SPCSSAttr *css = NULL;
249     gfloat value = 1.0; // default if nothing else found
250     if (has_opacity)
251         *has_opacity = false;
252     if (prefs_get_double_attribute(tool, "usecurrent", 0) != 0) {
253         css = sp_desktop_get_style(desktop, true);
254     } else { 
255         Inkscape::XML::Node *tool_repr = inkscape_get_repr(INKSCAPE, tool);
256         if (tool_repr) {
257             css = sp_repr_css_attr_inherited(tool_repr, "style");
258         }
259     }
260    
261     if (css) {
262         gchar const *property = css ? sp_repr_css_property(css, "opacity", "1.000") : 0;
263            
264         if (desktop->current && property) { // if there is style and the property in it,
265             if ( !sp_svg_number_read_f(property, &value) ) {
266                 value = 1.0; // things failed. set back to the default
267             } else {
268                 if (has_opacity)
269                    *has_opacity = false;
270             }
271         }
273         sp_repr_css_attr_unref(css);
274     }
276     return value;
278 double
279 sp_desktop_get_opacity_tool(SPDesktop *desktop, char const *tool, bool is_fill)
281     SPCSSAttr *css = NULL;
282     gfloat value = 1.0; // default if nothing else found
283     if (prefs_get_double_attribute(tool, "usecurrent", 0) != 0) {
284         css = sp_desktop_get_style(desktop, true);
285     } else { 
286         Inkscape::XML::Node *tool_repr = inkscape_get_repr(INKSCAPE, tool);
287         if (tool_repr) {
288             css = sp_repr_css_attr_inherited(tool_repr, "style");
289         }
290     }
291    
292     if (css) {
293         gchar const *property = css ? sp_repr_css_property(css, is_fill ? "fill-opacity": "stroke-opacity", "1.000") : 0;
294            
295         if (desktop->current && property) { // if there is style and the property in it,
296             if ( !sp_svg_number_read_f(property, &value) ) {
297                 value = 1.0; // things failed. set back to the default
298             }
299         }
301         sp_repr_css_attr_unref(css);
302     }
304     return value;
307 guint32
308 sp_desktop_get_color_tool(SPDesktop *desktop, char const *tool, bool is_fill, bool *has_color)
310     SPCSSAttr *css = NULL;
311     guint32 r = 0; // if there's no color, return black
312     if (has_color)
313         *has_color = false;
314     if (prefs_get_int_attribute(tool, "usecurrent", 0) != 0) {
315         css = sp_desktop_get_style(desktop, true);
316     } else {
317         Inkscape::XML::Node *tool_repr = inkscape_get_repr(INKSCAPE, tool);
318         if (tool_repr) {
319             css = sp_repr_css_attr_inherited(tool_repr, "style");
320         }
321     }
322    
323     if (css) {
324         gchar const *property = sp_repr_css_property(css, is_fill ? "fill" : "stroke", "#000");
325            
326         if (desktop->current && property) { // if there is style and the property in it,
327             if (strncmp(property, "url", 3) && strncmp(property, "none", 4)) { // and if it's not url or none,
328                 // read it
329                 r = sp_svg_read_color(property, r);
330                 if (has_color)
331                     *has_color = true;
332             }
333         }
335         sp_repr_css_attr_unref(css);
336     }
338     return r | 0xff;
341 /**
342  * Apply the desktop's current style or the tool style to repr.
343  */
344 void
345 sp_desktop_apply_style_tool(SPDesktop *desktop, Inkscape::XML::Node *repr, char const *tool, bool with_text)
347     SPCSSAttr *css_current = sp_desktop_get_style(desktop, with_text);
348     if ((prefs_get_int_attribute(tool, "usecurrent", 0) != 0) && css_current) {
349         sp_repr_css_set(repr, css_current, "style");
350     } else {
351         Inkscape::XML::Node *tool_repr = inkscape_get_repr(INKSCAPE, tool);
352         if (tool_repr) {
353             SPCSSAttr *css = sp_repr_css_attr_inherited(tool_repr, "style");
354             sp_repr_css_set(repr, css, "style");
355             sp_repr_css_attr_unref(css);
356         }
357     }
358     if (css_current) {
359         sp_repr_css_attr_unref(css_current);
360     }
363 /**
364  * Returns the font size (in SVG pixels) of the text tool style (if text
365  * tool uses its own style) or desktop style (otherwise).
366 */
367 double
368 sp_desktop_get_font_size_tool(SPDesktop *desktop)
370     (void)desktop; // TODO cleanup
371     gchar const *desktop_style = inkscape_get_repr(INKSCAPE, "desktop")->attribute("style");
372     gchar const *style_str = NULL;
373     if ((prefs_get_int_attribute("tools.text", "usecurrent", 0) != 0) && desktop_style) {
374         style_str = desktop_style;
375     } else {
376         Inkscape::XML::Node *tool_repr = inkscape_get_repr(INKSCAPE, "tools.text");
377         if (tool_repr) {
378             style_str = tool_repr->attribute("style");
379         }
380     }
382     double ret = 12;
383     if (style_str) {
384         SPStyle *style = sp_style_new(SP_ACTIVE_DOCUMENT);
385         sp_style_merge_from_style_string(style, style_str);
386         ret = style->font_size.computed;
387         sp_style_unref(style);
388     }
389     return ret;
392 /** Determine average stroke width, simple method */
393 // see TODO in dialogs/stroke-style.cpp on how to get rid of this eventually
394 gdouble
395 stroke_average_width (GSList const *objects)
397     if (g_slist_length ((GSList *) objects) == 0)
398         return NR_HUGE;
400     gdouble avgwidth = 0.0;
401     bool notstroked = true;
402     int n_notstroked = 0;
404     for (GSList const *l = objects; l != NULL; l = l->next) {
405         if (!SP_IS_ITEM (l->data))
406             continue;
408         Geom::Matrix i2d = sp_item_i2d_affine (SP_ITEM(l->data));
410         SPObject *object = SP_OBJECT(l->data);
412         if ( object->style->stroke.isNone() ) {
413             ++n_notstroked;   // do not count nonstroked objects
414             continue;
415         } else {
416             notstroked = false;
417         }
419         avgwidth += SP_OBJECT_STYLE (object)->stroke_width.computed * i2d.descrim();
420     }
422     if (notstroked)
423         return NR_HUGE;
425     return avgwidth / (g_slist_length ((GSList *) objects) - n_notstroked);
428 /**
429  * Write to style_res the average fill or stroke of list of objects, if applicable.
430  */
431 int
432 objects_query_fillstroke (GSList *objects, SPStyle *style_res, bool const isfill)
434     if (g_slist_length(objects) == 0) {
435         /* No objects, set empty */
436         return QUERY_STYLE_NOTHING;
437     }
439     SPIPaint *paint_res = isfill? &style_res->fill : &style_res->stroke;
440     bool paintImpossible = true;
441     paint_res->set = TRUE;
443     SVGICCColor* iccColor = 0;
444     bool iccSeen = false;
445     gfloat c[4];
446     c[0] = c[1] = c[2] = c[3] = 0.0;
447     gint num = 0;
449     gfloat prev[3];
450     prev[0] = prev[1] = prev[2] = 0.0;
451     bool same_color = true;
453     for (GSList const *i = objects; i != NULL; i = i->next) {
454         SPObject *obj = SP_OBJECT (i->data);
455         SPStyle *style = SP_OBJECT_STYLE (obj);
456         if (!style) continue;
458         SPIPaint *paint = isfill? &style->fill : &style->stroke;
460         // We consider paint "effectively set" for anything within text hierarchy
461         SPObject *parent = SP_OBJECT_PARENT (obj);
462         bool paint_effectively_set =
463             paint->set || (SP_IS_TEXT(parent) || SP_IS_TEXTPATH(parent) || SP_IS_TSPAN(parent)
464             || SP_IS_FLOWTEXT(parent) || SP_IS_FLOWDIV(parent) || SP_IS_FLOWPARA(parent)
465             || SP_IS_FLOWTSPAN(parent) || SP_IS_FLOWLINE(parent));
467         // 1. Bail out with QUERY_STYLE_MULTIPLE_DIFFERENT if necessary
469         if ((!paintImpossible) && (!paint->isSameType(*paint_res) || (paint_res->set != paint_effectively_set))) {
470             return QUERY_STYLE_MULTIPLE_DIFFERENT;  // different types of paint
471         }
473         if (paint_res->set && paint->set && paint_res->isPaintserver()) {
474             // both previous paint and this paint were a server, see if the servers are compatible
476             SPPaintServer *server_res = isfill? SP_STYLE_FILL_SERVER (style_res) : SP_STYLE_STROKE_SERVER (style_res);
477             SPPaintServer *server = isfill? SP_STYLE_FILL_SERVER (style) : SP_STYLE_STROKE_SERVER (style);
479             if (SP_IS_LINEARGRADIENT (server_res)) {
481                 if (!SP_IS_LINEARGRADIENT(server))
482                    return QUERY_STYLE_MULTIPLE_DIFFERENT;  // different kind of server
484                 SPGradient *vector = sp_gradient_get_vector ( SP_GRADIENT (server), FALSE );
485                 SPGradient *vector_res = sp_gradient_get_vector ( SP_GRADIENT (server_res), FALSE );
486                 if (vector_res != vector)
487                    return QUERY_STYLE_MULTIPLE_DIFFERENT;  // different gradient vectors
489             } else if (SP_IS_RADIALGRADIENT (server_res)) {
491                 if (!SP_IS_RADIALGRADIENT(server))
492                    return QUERY_STYLE_MULTIPLE_DIFFERENT;  // different kind of server
494                 SPGradient *vector = sp_gradient_get_vector ( SP_GRADIENT (server), FALSE );
495                 SPGradient *vector_res = sp_gradient_get_vector ( SP_GRADIENT (server_res), FALSE );
496                 if (vector_res != vector)
497                    return QUERY_STYLE_MULTIPLE_DIFFERENT;  // different gradient vectors
499             } else if (SP_IS_PATTERN (server_res)) {
501                 if (!SP_IS_PATTERN(server))
502                    return QUERY_STYLE_MULTIPLE_DIFFERENT;  // different kind of server
504                 SPPattern *pat = pattern_getroot (SP_PATTERN (server));
505                 SPPattern *pat_res = pattern_getroot (SP_PATTERN (server_res));
506                 if (pat_res != pat)
507                    return QUERY_STYLE_MULTIPLE_DIFFERENT;  // different pattern roots
508             }
509         }
511         // 2. Sum color, copy server from paint to paint_res
513         if (paint_res->set && paint_effectively_set && paint->isColor()) {
514             gfloat d[3];
515             sp_color_get_rgb_floatv (&paint->value.color, d);
517             // Check if this color is the same as previous
518             if (paintImpossible) {
519                 prev[0] = d[0];
520                 prev[1] = d[1];
521                 prev[2] = d[2];
522                 paint_res->setColor(d[0], d[1], d[2]);
523                 iccColor = paint->value.color.icc;
524                 iccSeen = true;
525             } else {
526                 if (same_color && (prev[0] != d[0] || prev[1] != d[1] || prev[2] != d[2]))
527                     same_color = false;
528                 if ( iccSeen ) {
529                     if(paint->value.color.icc) {
530                         // TODO fix this
531                         iccColor = 0;
532                     }
533                 }
534             }
536             // average color
537             c[0] += d[0];
538             c[1] += d[1];
539             c[2] += d[2];
540             c[3] += SP_SCALE24_TO_FLOAT (isfill? style->fill_opacity.value : style->stroke_opacity.value);
541             num ++;
542         }
544        paintImpossible = false;
545        paint_res->colorSet = paint->colorSet;
546        paint_res->currentcolor = paint->currentcolor;
547        if (paint_res->set && paint_effectively_set && paint->isPaintserver()) { // copy the server
548            if (isfill) {
549                sp_style_set_to_uri_string (style_res, true, style->getFillURI());
550            } else {
551                sp_style_set_to_uri_string (style_res, false, style->getStrokeURI());
552            }
553        }
554        paint_res->set = paint_effectively_set;
555        style_res->fill_rule.computed = style->fill_rule.computed; // no averaging on this, just use the last one
556     }
558     // After all objects processed, divide the color if necessary and return
559     if (paint_res->set && paint_res->isColor()) { // set the color
560         g_assert (num >= 1);
562         c[0] /= num;
563         c[1] /= num;
564         c[2] /= num;
565         c[3] /= num;
566         paint_res->setColor(c[0], c[1], c[2]);
567         if (isfill) {
568             style_res->fill_opacity.value = SP_SCALE24_FROM_FLOAT (c[3]);
569         } else {
570             style_res->stroke_opacity.value = SP_SCALE24_FROM_FLOAT (c[3]);
571         }
574         if ( iccSeen && iccColor ) {
575             // TODO check for existing
576             SVGICCColor* tmp = new SVGICCColor(*iccColor);
577             paint_res->value.color.icc = tmp;
578         }
580         if (num > 1) {
581             if (same_color)
582                 return QUERY_STYLE_MULTIPLE_SAME;
583             else
584                 return QUERY_STYLE_MULTIPLE_AVERAGED;
585         } else {
586             return QUERY_STYLE_SINGLE;
587         }
588     }
590     // Not color
591     if (g_slist_length(objects) > 1) {
592         return QUERY_STYLE_MULTIPLE_SAME;
593     } else {
594         return QUERY_STYLE_SINGLE;
595     }
598 /**
599  * Write to style_res the average opacity of a list of objects.
600  */
601 int
602 objects_query_opacity (GSList *objects, SPStyle *style_res)
604     if (g_slist_length(objects) == 0) {
605         /* No objects, set empty */
606         return QUERY_STYLE_NOTHING;
607     }
609     gdouble opacity_sum = 0;
610     gdouble opacity_prev = -1;
611     bool same_opacity = true;
612     guint opacity_items = 0;
615     for (GSList const *i = objects; i != NULL; i = i->next) {
616         SPObject *obj = SP_OBJECT (i->data);
617         SPStyle *style = SP_OBJECT_STYLE (obj);
618         if (!style) continue;
620         double opacity = SP_SCALE24_TO_FLOAT(style->opacity.value);
621         opacity_sum += opacity;
622         if (opacity_prev != -1 && opacity != opacity_prev)
623             same_opacity = false;
624         opacity_prev = opacity;
625         opacity_items ++;
626     }
627     if (opacity_items > 1)
628         opacity_sum /= opacity_items;
630     style_res->opacity.value = SP_SCALE24_FROM_FLOAT(opacity_sum);
632     if (opacity_items == 0) {
633         return QUERY_STYLE_NOTHING;
634     } else if (opacity_items == 1) {
635         return QUERY_STYLE_SINGLE;
636     } else {
637         if (same_opacity)
638             return QUERY_STYLE_MULTIPLE_SAME;
639         else
640             return QUERY_STYLE_MULTIPLE_AVERAGED;
641     }
644 /**
645  * Write to style_res the average stroke width of a list of objects.
646  */
647 int
648 objects_query_strokewidth (GSList *objects, SPStyle *style_res)
650     if (g_slist_length(objects) == 0) {
651         /* No objects, set empty */
652         return QUERY_STYLE_NOTHING;
653     }
655     gdouble avgwidth = 0.0;
657     gdouble prev_sw = -1;
658     bool same_sw = true;
660     int n_stroked = 0;
662     for (GSList const *i = objects; i != NULL; i = i->next) {
663         SPObject *obj = SP_OBJECT (i->data);
664         if (!SP_IS_ITEM(obj)) continue;
665         SPStyle *style = SP_OBJECT_STYLE (obj);
666         if (!style) continue;
668         if ( style->stroke.isNone() ) {
669             continue;
670         }
672         n_stroked ++;
674         Geom::Matrix i2d = sp_item_i2d_affine (SP_ITEM(obj));
675         double sw = style->stroke_width.computed * i2d.descrim();
677         if (prev_sw != -1 && fabs(sw - prev_sw) > 1e-3)
678             same_sw = false;
679         prev_sw = sw;
681         avgwidth += sw;
682     }
684     if (n_stroked > 1)
685         avgwidth /= (n_stroked);
687     style_res->stroke_width.computed = avgwidth;
688     style_res->stroke_width.set = true;
690     if (n_stroked == 0) {
691         return QUERY_STYLE_NOTHING;
692     } else if (n_stroked == 1) {
693         return QUERY_STYLE_SINGLE;
694     } else {
695         if (same_sw)
696             return QUERY_STYLE_MULTIPLE_SAME;
697         else
698             return QUERY_STYLE_MULTIPLE_AVERAGED;
699     }
702 /**
703  * Write to style_res the average miter limit of a list of objects.
704  */
705 int
706 objects_query_miterlimit (GSList *objects, SPStyle *style_res)
708     if (g_slist_length(objects) == 0) {
709         /* No objects, set empty */
710         return QUERY_STYLE_NOTHING;
711     }
713     gdouble avgml = 0.0;
714     int n_stroked = 0;
716     gdouble prev_ml = -1;
717     bool same_ml = true;
719     for (GSList const *i = objects; i != NULL; i = i->next) {
720         SPObject *obj = SP_OBJECT (i->data);
721         if (!SP_IS_ITEM(obj)) continue;
722         SPStyle *style = SP_OBJECT_STYLE (obj);
723         if (!style) continue;
725         if ( style->stroke.isNone() ) {
726             continue;
727         }
729         n_stroked ++;
731         if (prev_ml != -1 && fabs(style->stroke_miterlimit.value - prev_ml) > 1e-3)
732             same_ml = false;
733         prev_ml = style->stroke_miterlimit.value;
735         avgml += style->stroke_miterlimit.value;
736     }
738     if (n_stroked > 1)
739         avgml /= (n_stroked);
741     style_res->stroke_miterlimit.value = avgml;
742     style_res->stroke_miterlimit.set = true;
744     if (n_stroked == 0) {
745         return QUERY_STYLE_NOTHING;
746     } else if (n_stroked == 1) {
747         return QUERY_STYLE_SINGLE;
748     } else {
749         if (same_ml)
750             return QUERY_STYLE_MULTIPLE_SAME;
751         else
752             return QUERY_STYLE_MULTIPLE_AVERAGED;
753     }
756 /**
757  * Write to style_res the stroke cap of a list of objects.
758  */
759 int
760 objects_query_strokecap (GSList *objects, SPStyle *style_res)
762     if (g_slist_length(objects) == 0) {
763         /* No objects, set empty */
764         return QUERY_STYLE_NOTHING;
765     }
767     int cap = -1;
768     gdouble prev_cap = -1;
769     bool same_cap = true;
770     int n_stroked = 0;
772     for (GSList const *i = objects; i != NULL; i = i->next) {
773         SPObject *obj = SP_OBJECT (i->data);
774         if (!SP_IS_ITEM(obj)) continue;
775         SPStyle *style = SP_OBJECT_STYLE (obj);
776         if (!style) continue;
778         if ( style->stroke.isNone() ) {
779             continue;
780         }
782         n_stroked ++;
784         if (prev_cap != -1 && style->stroke_linecap.value != prev_cap)
785             same_cap = false;
786         prev_cap = style->stroke_linecap.value;
788         cap = style->stroke_linecap.value;
789     }
791     style_res->stroke_linecap.value = cap;
792     style_res->stroke_linecap.set = true;
794     if (n_stroked == 0) {
795         return QUERY_STYLE_NOTHING;
796     } else if (n_stroked == 1) {
797         return QUERY_STYLE_SINGLE;
798     } else {
799         if (same_cap)
800             return QUERY_STYLE_MULTIPLE_SAME;
801         else
802             return QUERY_STYLE_MULTIPLE_DIFFERENT;
803     }
806 /**
807  * Write to style_res the stroke join of a list of objects.
808  */
809 int
810 objects_query_strokejoin (GSList *objects, SPStyle *style_res)
812     if (g_slist_length(objects) == 0) {
813         /* No objects, set empty */
814         return QUERY_STYLE_NOTHING;
815     }
817     int join = -1;
818     gdouble prev_join = -1;
819     bool same_join = true;
820     int n_stroked = 0;
822     for (GSList const *i = objects; i != NULL; i = i->next) {
823         SPObject *obj = SP_OBJECT (i->data);
824         if (!SP_IS_ITEM(obj)) continue;
825         SPStyle *style = SP_OBJECT_STYLE (obj);
826         if (!style) continue;
828         if ( style->stroke.isNone() ) {
829             continue;
830         }
832         n_stroked ++;
834         if (prev_join != -1 && style->stroke_linejoin.value != prev_join)
835             same_join = false;
836         prev_join = style->stroke_linejoin.value;
838         join = style->stroke_linejoin.value;
839     }
841     style_res->stroke_linejoin.value = join;
842     style_res->stroke_linejoin.set = true;
844     if (n_stroked == 0) {
845         return QUERY_STYLE_NOTHING;
846     } else if (n_stroked == 1) {
847         return QUERY_STYLE_SINGLE;
848     } else {
849         if (same_join)
850             return QUERY_STYLE_MULTIPLE_SAME;
851         else
852             return QUERY_STYLE_MULTIPLE_DIFFERENT;
853     }
856 /**
857  * Write to style_res the average font size and spacing of objects.
858  */
859 int
860 objects_query_fontnumbers (GSList *objects, SPStyle *style_res)
862     bool different = false;
864     double size = 0;
865     double letterspacing = 0;
866     double linespacing = 0;
867     bool linespacing_normal = false;
868     bool letterspacing_normal = false;
870     double size_prev = 0;
871     double letterspacing_prev = 0;
872     double linespacing_prev = 0;
874     /// \todo FIXME: add word spacing, kerns? rotates?
876     int texts = 0;
878     for (GSList const *i = objects; i != NULL; i = i->next) {
879         SPObject *obj = SP_OBJECT (i->data);
881         if (!SP_IS_TEXT(obj) && !SP_IS_FLOWTEXT(obj)
882             && !SP_IS_TSPAN(obj) && !SP_IS_TREF(obj) && !SP_IS_TEXTPATH(obj)
883             && !SP_IS_FLOWDIV(obj) && !SP_IS_FLOWPARA(obj) && !SP_IS_FLOWTSPAN(obj))
884             continue;
886         SPStyle *style = SP_OBJECT_STYLE (obj);
887         if (!style) continue;
889         texts ++;
890         size += style->font_size.computed * Geom::Matrix(sp_item_i2d_affine(SP_ITEM(obj))).descrim(); /// \todo FIXME: we assume non-% units here
892         if (style->letter_spacing.normal) {
893             if (!different && (letterspacing_prev == 0 || letterspacing_prev == letterspacing))
894                 letterspacing_normal = true;
895         } else {
896             letterspacing += style->letter_spacing.computed; /// \todo FIXME: we assume non-% units here
897             letterspacing_normal = false;
898         }
900         double linespacing_current;
901         if (style->line_height.normal) {
902             linespacing_current = Inkscape::Text::Layout::LINE_HEIGHT_NORMAL;
903             if (!different && (linespacing_prev == 0 || linespacing_prev == linespacing_current))
904                 linespacing_normal = true;
905         } else if (style->line_height.unit == SP_CSS_UNIT_PERCENT || style->font_size.computed == 0) {
906             linespacing_current = style->line_height.value;
907             linespacing_normal = false;
908         } else { // we need % here
909             linespacing_current = style->line_height.computed / style->font_size.computed;
910             linespacing_normal = false;
911         }
912         linespacing += linespacing_current;
914         if ((size_prev != 0 && style->font_size.computed != size_prev) ||
915             (letterspacing_prev != 0 && style->letter_spacing.computed != letterspacing_prev) ||
916             (linespacing_prev != 0 && linespacing_current != linespacing_prev)) {
917             different = true;
918         }
920         size_prev = style->font_size.computed;
921         letterspacing_prev = style->letter_spacing.computed;
922         linespacing_prev = linespacing_current;
924         // FIXME: we must detect MULTIPLE_DIFFERENT for these too
925         style_res->text_anchor.computed = style->text_anchor.computed;
926         style_res->writing_mode.computed = style->writing_mode.computed;
927     }
929     if (texts == 0)
930         return QUERY_STYLE_NOTHING;
932     if (texts > 1) {
933         size /= texts;
934         letterspacing /= texts;
935         linespacing /= texts;
936     }
938     style_res->font_size.computed = size;
939     style_res->font_size.type = SP_FONT_SIZE_LENGTH;
941     style_res->letter_spacing.normal = letterspacing_normal;
942     style_res->letter_spacing.computed = letterspacing;
944     style_res->line_height.normal = linespacing_normal;
945     style_res->line_height.computed = linespacing;
946     style_res->line_height.value = linespacing;
947     style_res->line_height.unit = SP_CSS_UNIT_PERCENT;
949     if (texts > 1) {
950         if (different) {
951             return QUERY_STYLE_MULTIPLE_AVERAGED;
952         } else {
953             return QUERY_STYLE_MULTIPLE_SAME;
954         }
955     } else {
956         return QUERY_STYLE_SINGLE;
957     }
960 /**
961  * Write to style_res the average font style of objects.
962  */
963 int
964 objects_query_fontstyle (GSList *objects, SPStyle *style_res)
966     bool different = false;
967     bool set = false;
969     int texts = 0;
971     for (GSList const *i = objects; i != NULL; i = i->next) {
972         SPObject *obj = SP_OBJECT (i->data);
974         if (!SP_IS_TEXT(obj) && !SP_IS_FLOWTEXT(obj)
975             && !SP_IS_TSPAN(obj) && !SP_IS_TREF(obj) && !SP_IS_TEXTPATH(obj)
976             && !SP_IS_FLOWDIV(obj) && !SP_IS_FLOWPARA(obj) && !SP_IS_FLOWTSPAN(obj))
977             continue;
979         SPStyle *style = SP_OBJECT_STYLE (obj);
980         if (!style) continue;
982         texts ++;
984         if (set &&
985             font_style_to_pos(*style_res).signature() != font_style_to_pos(*style).signature() ) {
986             different = true;  // different styles
987         }
989         set = TRUE;
990         style_res->font_weight.value = style_res->font_weight.computed = style->font_weight.computed;
991         style_res->font_style.value = style_res->font_style.computed = style->font_style.computed;
992         style_res->font_stretch.value = style_res->font_stretch.computed = style->font_stretch.computed;
993         style_res->font_variant.value = style_res->font_variant.computed = style->font_variant.computed;
994         style_res->text_align.value = style_res->text_align.computed = style->text_align.computed;
995     }
997     if (texts == 0 || !set)
998         return QUERY_STYLE_NOTHING;
1000     if (texts > 1) {
1001         if (different) {
1002             return QUERY_STYLE_MULTIPLE_DIFFERENT;
1003         } else {
1004             return QUERY_STYLE_MULTIPLE_SAME;
1005         }
1006     } else {
1007         return QUERY_STYLE_SINGLE;
1008     }
1011 /**
1012  * Write to style_res the average font family of objects.
1013  */
1014 int
1015 objects_query_fontfamily (GSList *objects, SPStyle *style_res)
1017     bool different = false;
1018     int texts = 0;
1020     if (style_res->text->font_family.value) {
1021         g_free(style_res->text->font_family.value);
1022         style_res->text->font_family.value = NULL;
1023     }
1024     style_res->text->font_family.set = FALSE;
1026     for (GSList const *i = objects; i != NULL; i = i->next) {
1027         SPObject *obj = SP_OBJECT (i->data);
1029         if (!SP_IS_TEXT(obj) && !SP_IS_FLOWTEXT(obj)
1030             && !SP_IS_TSPAN(obj) && !SP_IS_TREF(obj) && !SP_IS_TEXTPATH(obj)
1031             && !SP_IS_FLOWDIV(obj) && !SP_IS_FLOWPARA(obj) && !SP_IS_FLOWTSPAN(obj))
1032             continue;
1034         SPStyle *style = SP_OBJECT_STYLE (obj);
1035         if (!style) continue;
1037         texts ++;
1039         if (style_res->text->font_family.value && style->text->font_family.value &&
1040             strcmp (style_res->text->font_family.value, style->text->font_family.value)) {
1041             different = true;  // different fonts
1042         }
1044         if (style_res->text->font_family.value) {
1045             g_free(style_res->text->font_family.value);
1046             style_res->text->font_family.value = NULL;
1047         }
1049         style_res->text->font_family.set = TRUE;
1050         style_res->text->font_family.value = g_strdup(style->text->font_family.value);
1051     }
1053     if (texts == 0 || !style_res->text->font_family.set)
1054         return QUERY_STYLE_NOTHING;
1056     if (texts > 1) {
1057         if (different) {
1058             return QUERY_STYLE_MULTIPLE_DIFFERENT;
1059         } else {
1060             return QUERY_STYLE_MULTIPLE_SAME;
1061         }
1062     } else {
1063         return QUERY_STYLE_SINGLE;
1064     }
1067 int
1068 objects_query_fontspecification (GSList *objects, SPStyle *style_res)
1070     bool different = false;
1071     int texts = 0;
1073     if (style_res->text->font_specification.value) {
1074         g_free(style_res->text->font_specification.value);
1075         style_res->text->font_specification.value = NULL;
1076     }
1077     style_res->text->font_specification.set = FALSE;
1079     for (GSList const *i = objects; i != NULL; i = i->next) {
1080         SPObject *obj = SP_OBJECT (i->data);
1082         if (!SP_IS_TEXT(obj) && !SP_IS_FLOWTEXT(obj)
1083             && !SP_IS_TSPAN(obj) && !SP_IS_TREF(obj) && !SP_IS_TEXTPATH(obj)
1084             && !SP_IS_FLOWDIV(obj) && !SP_IS_FLOWPARA(obj) && !SP_IS_FLOWTSPAN(obj))
1085             continue;
1087         SPStyle *style = SP_OBJECT_STYLE (obj);
1088         if (!style) continue;
1090         texts ++;
1092         if (style_res->text->font_specification.value && style_res->text->font_specification.set &&   
1093             style->text->font_specification.value && style->text->font_specification.set &&
1094             strcmp (style_res->text->font_specification.value, style->text->font_specification.value)) {
1095             different = true;  // different fonts
1096         }
1097         
1098         if (style->text->font_specification.set) {
1100             if (style_res->text->font_specification.value) {
1101                 g_free(style_res->text->font_specification.value);
1102                 style_res->text->font_specification.value = NULL;
1103             }
1104     
1105             style_res->text->font_specification.set = TRUE;
1106             style_res->text->font_specification.value = g_strdup(style->text->font_specification.value);
1107         }
1108     }
1110     if (texts == 0)
1111         return QUERY_STYLE_NOTHING;
1113     if (texts > 1) {
1114         if (different) {
1115             return QUERY_STYLE_MULTIPLE_DIFFERENT;
1116         } else {
1117             return QUERY_STYLE_MULTIPLE_SAME;
1118         }
1119     } else {
1120         return QUERY_STYLE_SINGLE;
1121     }
1124 int
1125 objects_query_blend (GSList *objects, SPStyle *style_res)
1127     const int empty_prev = -2;
1128     const int complex_filter = 5;
1129     int blend = 0;
1130     float blend_prev = empty_prev;
1131     bool same_blend = true;
1132     guint items = 0;
1133     
1134     for (GSList const *i = objects; i != NULL; i = i->next) {
1135         SPObject *obj = SP_OBJECT (i->data);
1136         SPStyle *style = SP_OBJECT_STYLE (obj);
1137         if(!style || !SP_IS_ITEM(obj)) continue;
1139         items++;
1141         //if object has a filter
1142         if (style->filter.set && style->getFilter()) {
1143             int blurcount = 0;
1144             int blendcount = 0;
1146             // determine whether filter is simple (blend and/or blur) or complex
1147             for(SPObject *primitive_obj = style->getFilter()->children;
1148                 primitive_obj && SP_IS_FILTER_PRIMITIVE(primitive_obj);
1149                 primitive_obj = primitive_obj->next) {
1150                 SPFilterPrimitive *primitive = SP_FILTER_PRIMITIVE(primitive_obj);
1151                 if(SP_IS_FEBLEND(primitive))
1152                     ++blendcount;
1153                 else if(SP_IS_GAUSSIANBLUR(primitive))
1154                     ++blurcount;
1155                 else {
1156                     blurcount = complex_filter;
1157                     break;
1158                 }
1159             }
1161             // simple filter
1162             if(blurcount == 1 || blendcount == 1) {
1163                 for(SPObject *primitive_obj = style->getFilter()->children;
1164                     primitive_obj && SP_IS_FILTER_PRIMITIVE(primitive_obj);
1165                     primitive_obj = primitive_obj->next) {
1166                     if(SP_IS_FEBLEND(primitive_obj)) {
1167                         SPFeBlend *spblend = SP_FEBLEND(primitive_obj);
1168                         blend = spblend->blend_mode;
1169                     }
1170                 }
1171             }
1172             else {
1173                 blend = complex_filter;
1174             }
1175         }
1176         // defaults to blend mode = "normal"
1177         else {
1178             blend = 0;
1179         }
1181         if(blend_prev != empty_prev && blend_prev != blend)
1182             same_blend = false;
1183         blend_prev = blend;
1184     }
1186     if (items > 0) {
1187         style_res->filter_blend_mode.value = blend;
1188     }
1190     if (items == 0) {
1191         return QUERY_STYLE_NOTHING;
1192     } else if (items == 1) {
1193         return QUERY_STYLE_SINGLE;
1194     } else {
1195         if(same_blend)
1196             return QUERY_STYLE_MULTIPLE_SAME;
1197         else
1198             return QUERY_STYLE_MULTIPLE_DIFFERENT;
1199     }
1202 /**
1203  * Write to style_res the average blurring of a list of objects.
1204  */
1205 int
1206 objects_query_blur (GSList *objects, SPStyle *style_res)
1208    if (g_slist_length(objects) == 0) {
1209         /* No objects, set empty */
1210         return QUERY_STYLE_NOTHING;
1211     }
1213     float blur_sum = 0;
1214     float blur_prev = -1;
1215     bool same_blur = true;
1216     guint blur_items = 0;
1217     guint items = 0;
1218     
1219     for (GSList const *i = objects; i != NULL; i = i->next) {
1220         SPObject *obj = SP_OBJECT (i->data);
1221         SPStyle *style = SP_OBJECT_STYLE (obj);
1222         if (!style) continue;
1223         if (!SP_IS_ITEM(obj)) continue;
1225         Geom::Matrix i2d = sp_item_i2d_affine (SP_ITEM(obj));
1227         items ++;
1229         //if object has a filter
1230         if (style->filter.set && style->getFilter()) {
1231             //cycle through filter primitives
1232             SPObject *primitive_obj = style->getFilter()->children;
1233             while (primitive_obj) {
1234                 if (SP_IS_FILTER_PRIMITIVE(primitive_obj)) {
1235                     SPFilterPrimitive *primitive = SP_FILTER_PRIMITIVE(primitive_obj);
1236                     
1237                     //if primitive is gaussianblur
1238                     if(SP_IS_GAUSSIANBLUR(primitive)) {
1239                         SPGaussianBlur * spblur = SP_GAUSSIANBLUR(primitive);
1240                         float num = spblur->stdDeviation.getNumber();
1241                         blur_sum += num * i2d.descrim();
1242                         if (blur_prev != -1 && fabs (num - blur_prev) > 1e-2) // rather low tolerance because difference in blur radii is much harder to notice than e.g. difference in sizes
1243                             same_blur = false;
1244                         blur_prev = num;
1245                         //TODO: deal with opt number, for the moment it's not necessary to the ui.
1246                         blur_items ++;
1247                     }
1248                 }
1249                 primitive_obj = primitive_obj->next;
1250             }
1251         }
1252     }
1254     if (items > 0) {
1255         if (blur_items > 0)
1256             blur_sum /= blur_items;
1257         style_res->filter_gaussianBlur_deviation.value = blur_sum;
1258     }
1260     if (items == 0) {
1261         return QUERY_STYLE_NOTHING;
1262     } else if (items == 1) {
1263         return QUERY_STYLE_SINGLE;
1264     } else {
1265         if (same_blur)
1266             return QUERY_STYLE_MULTIPLE_SAME;
1267         else
1268             return QUERY_STYLE_MULTIPLE_AVERAGED;
1269     }
1272 /**
1273  * Query the given list of objects for the given property, write
1274  * the result to style, return appropriate flag.
1275  */
1276 int
1277 sp_desktop_query_style_from_list (GSList *list, SPStyle *style, int property)
1279     if (property == QUERY_STYLE_PROPERTY_FILL) {
1280         return objects_query_fillstroke (list, style, true);
1281     } else if (property == QUERY_STYLE_PROPERTY_STROKE) {
1282         return objects_query_fillstroke (list, style, false);
1284     } else if (property == QUERY_STYLE_PROPERTY_STROKEWIDTH) {
1285         return objects_query_strokewidth (list, style);
1286     } else if (property == QUERY_STYLE_PROPERTY_STROKEMITERLIMIT) {
1287         return objects_query_miterlimit (list, style);
1288     } else if (property == QUERY_STYLE_PROPERTY_STROKECAP) {
1289         return objects_query_strokecap (list, style);
1290     } else if (property == QUERY_STYLE_PROPERTY_STROKEJOIN) {
1291         return objects_query_strokejoin (list, style);
1293     } else if (property == QUERY_STYLE_PROPERTY_MASTEROPACITY) {
1294         return objects_query_opacity (list, style);
1295         
1296     } else if (property == QUERY_STYLE_PROPERTY_FONT_SPECIFICATION) {
1297         return objects_query_fontspecification (list, style);
1298     } else if (property == QUERY_STYLE_PROPERTY_FONTFAMILY) {
1299         return objects_query_fontfamily (list, style);
1300     } else if (property == QUERY_STYLE_PROPERTY_FONTSTYLE) {
1301         return objects_query_fontstyle (list, style);
1302     } else if (property == QUERY_STYLE_PROPERTY_FONTNUMBERS) {
1303         return objects_query_fontnumbers (list, style);
1305     } else if (property == QUERY_STYLE_PROPERTY_BLEND) {
1306         return objects_query_blend (list, style);
1307     } else if (property == QUERY_STYLE_PROPERTY_BLUR) {
1308         return objects_query_blur (list, style);
1309     }
1310     return QUERY_STYLE_NOTHING;
1314 /**
1315  * Query the subselection (if any) or selection on the given desktop for the given property, write
1316  * the result to style, return appropriate flag.
1317  */
1318 int
1319 sp_desktop_query_style(SPDesktop *desktop, SPStyle *style, int property)
1321     int ret = desktop->_query_style_signal.emit(style, property);
1323     if (ret != QUERY_STYLE_NOTHING)
1324         return ret; // subselection returned a style, pass it on
1326     // otherwise, do querying and averaging over selection
1327     return sp_desktop_query_style_from_list ((GSList *) desktop->selection->itemList(), style, property);
1330 /**
1331  * Do the same as sp_desktop_query_style for all (defined) style properties, return true if at 
1332  * least one of the properties did not return QUERY_STYLE_NOTHING.
1333  */
1334 bool
1335 sp_desktop_query_style_all (SPDesktop *desktop, SPStyle *query)
1337         int result_family = sp_desktop_query_style (desktop, query, QUERY_STYLE_PROPERTY_FONTFAMILY);
1338         int result_fstyle = sp_desktop_query_style (desktop, query, QUERY_STYLE_PROPERTY_FONTSTYLE);
1339         int result_fnumbers = sp_desktop_query_style (desktop, query, QUERY_STYLE_PROPERTY_FONTNUMBERS);
1340         int result_fill = sp_desktop_query_style (desktop, query, QUERY_STYLE_PROPERTY_FILL);
1341         int result_stroke = sp_desktop_query_style (desktop, query, QUERY_STYLE_PROPERTY_STROKE);
1342         int result_strokewidth = sp_desktop_query_style (desktop, query, QUERY_STYLE_PROPERTY_STROKEWIDTH);
1343         int result_strokemiterlimit = sp_desktop_query_style (desktop, query, QUERY_STYLE_PROPERTY_STROKEMITERLIMIT);
1344         int result_strokecap = sp_desktop_query_style (desktop, query, QUERY_STYLE_PROPERTY_STROKECAP);
1345         int result_strokejoin = sp_desktop_query_style (desktop, query, QUERY_STYLE_PROPERTY_STROKEJOIN);
1346         int result_opacity = sp_desktop_query_style (desktop, query, QUERY_STYLE_PROPERTY_MASTEROPACITY);
1347         int result_blur = sp_desktop_query_style (desktop, query, QUERY_STYLE_PROPERTY_BLUR);
1348         
1349         return (result_family != QUERY_STYLE_NOTHING || 
1350                 result_fstyle != QUERY_STYLE_NOTHING || 
1351                 result_fnumbers != QUERY_STYLE_NOTHING || 
1352                 result_fill != QUERY_STYLE_NOTHING || 
1353                 result_stroke != QUERY_STYLE_NOTHING || 
1354                 result_opacity != QUERY_STYLE_NOTHING || 
1355                 result_strokewidth != QUERY_STYLE_NOTHING || 
1356                 result_strokemiterlimit != QUERY_STYLE_NOTHING ||
1357                 result_strokecap != QUERY_STYLE_NOTHING ||
1358                 result_strokejoin != QUERY_STYLE_NOTHING ||
1359                 result_blur != QUERY_STYLE_NOTHING);
1363 /*
1364   Local Variables:
1365   mode:c++
1366   c-file-style:"stroustrup"
1367   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
1368   indent-tabs-mode:nil
1369   fill-column:99
1370   End:
1371 */
1372 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :