Code

remove antediluvian cruft
[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             NR::Matrix const local(sp_item_i2doc_affine(SP_ITEM(o)));
124             double const ex(NR::expansion(local));
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)
248     SPCSSAttr *css = NULL;
249     gfloat value = 1.0; // default if nothing else found
250     if (prefs_get_double_attribute(tool, "usecurrent", 0) != 0) {
251         css = sp_desktop_get_style(desktop, true);
252     } else { 
253         Inkscape::XML::Node *tool_repr = inkscape_get_repr(INKSCAPE, tool);
254         if (tool_repr) {
255             css = sp_repr_css_attr_inherited(tool_repr, "style");
256         }
257     }
258    
259     if (css) {
260         gchar const *property = css ? sp_repr_css_property(css, "opacity", "1.000") : 0;
261            
262         if (desktop->current && property) { // if there is style and the property in it,
263             if ( !sp_svg_number_read_f(property, &value) ) {
264                 value = 1.0; // things failed. set back to the default
265             }
266         }
268         sp_repr_css_attr_unref(css);
269     }
271     return value;
273 double
274 sp_desktop_get_opacity_tool(SPDesktop *desktop, char const *tool, bool is_fill)
276     SPCSSAttr *css = NULL;
277     gfloat value = 1.0; // default if nothing else found
278     if (prefs_get_double_attribute(tool, "usecurrent", 0) != 0) {
279         css = sp_desktop_get_style(desktop, true);
280     } else { 
281         Inkscape::XML::Node *tool_repr = inkscape_get_repr(INKSCAPE, tool);
282         if (tool_repr) {
283             css = sp_repr_css_attr_inherited(tool_repr, "style");
284         }
285     }
286    
287     if (css) {
288         gchar const *property = css ? sp_repr_css_property(css, is_fill ? "fill-opacity": "stroke-opacity", "1.000") : 0;
289            
290         if (desktop->current && property) { // if there is style and the property in it,
291             if ( !sp_svg_number_read_f(property, &value) ) {
292                 value = 1.0; // things failed. set back to the default
293             }
294         }
296         sp_repr_css_attr_unref(css);
297     }
299     return value;
301 guint32
302 sp_desktop_get_color_tool(SPDesktop *desktop, char const *tool, bool is_fill)
304     SPCSSAttr *css = NULL;
305     guint32 r = 0; // if there's no color, return black
306     if (prefs_get_int_attribute(tool, "usecurrent", 0) != 0) {
307         css = sp_desktop_get_style(desktop, true);
308     } else {
309         Inkscape::XML::Node *tool_repr = inkscape_get_repr(INKSCAPE, tool);
310         if (tool_repr) {
311             css = sp_repr_css_attr_inherited(tool_repr, "style");
312         }
313     }
314    
315     if (css) {
316         gchar const *property = sp_repr_css_property(css, is_fill ? "fill" : "stroke", "#000");
317            
318         if (desktop->current && property) { // if there is style and the property in it,
319             if (strncmp(property, "url", 3)) { // and if it's not url,
320                 // read it
321                 r = sp_svg_read_color(property, r);
322             }
323         }
325         sp_repr_css_attr_unref(css);
326     }
328     return r | 0xff;
330 /**
331  * Apply the desktop's current style or the tool style to repr.
332  */
333 void
334 sp_desktop_apply_style_tool(SPDesktop *desktop, Inkscape::XML::Node *repr, char const *tool, bool with_text)
336     SPCSSAttr *css_current = sp_desktop_get_style(desktop, with_text);
337     if ((prefs_get_int_attribute(tool, "usecurrent", 0) != 0) && css_current) {
338         sp_repr_css_set(repr, css_current, "style");
339     } else {
340         Inkscape::XML::Node *tool_repr = inkscape_get_repr(INKSCAPE, tool);
341         if (tool_repr) {
342             SPCSSAttr *css = sp_repr_css_attr_inherited(tool_repr, "style");
343             sp_repr_css_set(repr, css, "style");
344             sp_repr_css_attr_unref(css);
345         }
346     }
347     if (css_current) {
348         sp_repr_css_attr_unref(css_current);
349     }
352 /**
353  * Returns the font size (in SVG pixels) of the text tool style (if text
354  * tool uses its own style) or desktop style (otherwise).
355 */
356 double
357 sp_desktop_get_font_size_tool(SPDesktop *desktop)
359     (void)desktop; // TODO cleanup
360     gchar const *desktop_style = inkscape_get_repr(INKSCAPE, "desktop")->attribute("style");
361     gchar const *style_str = NULL;
362     if ((prefs_get_int_attribute("tools.text", "usecurrent", 0) != 0) && desktop_style) {
363         style_str = desktop_style;
364     } else {
365         Inkscape::XML::Node *tool_repr = inkscape_get_repr(INKSCAPE, "tools.text");
366         if (tool_repr) {
367             style_str = tool_repr->attribute("style");
368         }
369     }
371     double ret = 12;
372     if (style_str) {
373         SPStyle *style = sp_style_new(SP_ACTIVE_DOCUMENT);
374         sp_style_merge_from_style_string(style, style_str);
375         ret = style->font_size.computed;
376         sp_style_unref(style);
377     }
378     return ret;
381 /** Determine average stroke width, simple method */
382 // see TODO in dialogs/stroke-style.cpp on how to get rid of this eventually
383 gdouble
384 stroke_average_width (GSList const *objects)
386     if (g_slist_length ((GSList *) objects) == 0)
387         return NR_HUGE;
389     gdouble avgwidth = 0.0;
390     bool notstroked = true;
391     int n_notstroked = 0;
393     for (GSList const *l = objects; l != NULL; l = l->next) {
394         if (!SP_IS_ITEM (l->data))
395             continue;
397         NR::Matrix i2d = sp_item_i2d_affine (SP_ITEM(l->data));
399         SPObject *object = SP_OBJECT(l->data);
401         if ( object->style->stroke.isNone() ) {
402             ++n_notstroked;   // do not count nonstroked objects
403             continue;
404         } else {
405             notstroked = false;
406         }
408         avgwidth += SP_OBJECT_STYLE (object)->stroke_width.computed * NR::expansion(i2d);
409     }
411     if (notstroked)
412         return NR_HUGE;
414     return avgwidth / (g_slist_length ((GSList *) objects) - n_notstroked);
417 /**
418  * Write to style_res the average fill or stroke of list of objects, if applicable.
419  */
420 int
421 objects_query_fillstroke (GSList *objects, SPStyle *style_res, bool const isfill)
423     if (g_slist_length(objects) == 0) {
424         /* No objects, set empty */
425         return QUERY_STYLE_NOTHING;
426     }
428     SPIPaint *paint_res = isfill? &style_res->fill : &style_res->stroke;
429     bool paintImpossible = true;
430     paint_res->set = TRUE;
432     SVGICCColor* iccColor = 0;
433     bool iccSeen = false;
434     gfloat c[4];
435     c[0] = c[1] = c[2] = c[3] = 0.0;
436     gint num = 0;
438     gfloat prev[3];
439     prev[0] = prev[1] = prev[2] = 0.0;
440     bool same_color = true;
442     for (GSList const *i = objects; i != NULL; i = i->next) {
443         SPObject *obj = SP_OBJECT (i->data);
444         SPStyle *style = SP_OBJECT_STYLE (obj);
445         if (!style) continue;
447         SPIPaint *paint = isfill? &style->fill : &style->stroke;
449         // We consider paint "effectively set" for anything within text hierarchy
450         SPObject *parent = SP_OBJECT_PARENT (obj);
451         bool paint_effectively_set =
452             paint->set || (SP_IS_TEXT(parent) || SP_IS_TEXTPATH(parent) || SP_IS_TSPAN(parent)
453             || SP_IS_FLOWTEXT(parent) || SP_IS_FLOWDIV(parent) || SP_IS_FLOWPARA(parent)
454             || SP_IS_FLOWTSPAN(parent) || SP_IS_FLOWLINE(parent));
456         // 1. Bail out with QUERY_STYLE_MULTIPLE_DIFFERENT if necessary
458         if ((!paintImpossible) && (!paint->isSameType(*paint_res) || (paint_res->set != paint_effectively_set))) {
459             return QUERY_STYLE_MULTIPLE_DIFFERENT;  // different types of paint
460         }
462         if (paint_res->set && paint->set && paint_res->isPaintserver()) {
463             // both previous paint and this paint were a server, see if the servers are compatible
465             SPPaintServer *server_res = isfill? SP_STYLE_FILL_SERVER (style_res) : SP_STYLE_STROKE_SERVER (style_res);
466             SPPaintServer *server = isfill? SP_STYLE_FILL_SERVER (style) : SP_STYLE_STROKE_SERVER (style);
468             if (SP_IS_LINEARGRADIENT (server_res)) {
470                 if (!SP_IS_LINEARGRADIENT(server))
471                    return QUERY_STYLE_MULTIPLE_DIFFERENT;  // different kind of server
473                 SPGradient *vector = sp_gradient_get_vector ( SP_GRADIENT (server), FALSE );
474                 SPGradient *vector_res = sp_gradient_get_vector ( SP_GRADIENT (server_res), FALSE );
475                 if (vector_res != vector)
476                    return QUERY_STYLE_MULTIPLE_DIFFERENT;  // different gradient vectors
478             } else if (SP_IS_RADIALGRADIENT (server_res)) {
480                 if (!SP_IS_RADIALGRADIENT(server))
481                    return QUERY_STYLE_MULTIPLE_DIFFERENT;  // different kind of server
483                 SPGradient *vector = sp_gradient_get_vector ( SP_GRADIENT (server), FALSE );
484                 SPGradient *vector_res = sp_gradient_get_vector ( SP_GRADIENT (server_res), FALSE );
485                 if (vector_res != vector)
486                    return QUERY_STYLE_MULTIPLE_DIFFERENT;  // different gradient vectors
488             } else if (SP_IS_PATTERN (server_res)) {
490                 if (!SP_IS_PATTERN(server))
491                    return QUERY_STYLE_MULTIPLE_DIFFERENT;  // different kind of server
493                 SPPattern *pat = pattern_getroot (SP_PATTERN (server));
494                 SPPattern *pat_res = pattern_getroot (SP_PATTERN (server_res));
495                 if (pat_res != pat)
496                    return QUERY_STYLE_MULTIPLE_DIFFERENT;  // different pattern roots
497             }
498         }
500         // 2. Sum color, copy server from paint to paint_res
502         if (paint_res->set && paint_effectively_set && paint->isColor()) {
503             gfloat d[3];
504             sp_color_get_rgb_floatv (&paint->value.color, d);
506             // Check if this color is the same as previous
507             if (paintImpossible) {
508                 prev[0] = d[0];
509                 prev[1] = d[1];
510                 prev[2] = d[2];
511                 paint_res->setColor(d[0], d[1], d[2]);
512                 iccColor = paint->value.color.icc;
513                 iccSeen = true;
514             } else {
515                 if (same_color && (prev[0] != d[0] || prev[1] != d[1] || prev[2] != d[2]))
516                     same_color = false;
517                 if ( iccSeen ) {
518                     if(paint->value.color.icc) {
519                         // TODO fix this
520                         iccColor = 0;
521                     }
522                 }
523             }
525             // average color
526             c[0] += d[0];
527             c[1] += d[1];
528             c[2] += d[2];
529             c[3] += SP_SCALE24_TO_FLOAT (isfill? style->fill_opacity.value : style->stroke_opacity.value);
530             num ++;
531         }
533        paintImpossible = false;
534        paint_res->colorSet = paint->colorSet;
535        paint_res->currentcolor = paint->currentcolor;
536        if (paint_res->set && paint_effectively_set && paint->isPaintserver()) { // copy the server
537            if (isfill) {
538                sp_style_set_to_uri_string (style_res, true, style->getFillURI());
539            } else {
540                sp_style_set_to_uri_string (style_res, false, style->getStrokeURI());
541            }
542        }
543        paint_res->set = paint_effectively_set;
544        style_res->fill_rule.computed = style->fill_rule.computed; // no averaging on this, just use the last one
545     }
547     // After all objects processed, divide the color if necessary and return
548     if (paint_res->set && paint_res->isColor()) { // set the color
549         g_assert (num >= 1);
551         c[0] /= num;
552         c[1] /= num;
553         c[2] /= num;
554         c[3] /= num;
555         paint_res->setColor(c[0], c[1], c[2]);
556         if (isfill) {
557             style_res->fill_opacity.value = SP_SCALE24_FROM_FLOAT (c[3]);
558         } else {
559             style_res->stroke_opacity.value = SP_SCALE24_FROM_FLOAT (c[3]);
560         }
563         if ( iccSeen && iccColor ) {
564             // TODO check for existing
565             SVGICCColor* tmp = new SVGICCColor(*iccColor);
566             paint_res->value.color.icc = tmp;
567         }
569         if (num > 1) {
570             if (same_color)
571                 return QUERY_STYLE_MULTIPLE_SAME;
572             else
573                 return QUERY_STYLE_MULTIPLE_AVERAGED;
574         } else {
575             return QUERY_STYLE_SINGLE;
576         }
577     }
579     // Not color
580     if (g_slist_length(objects) > 1) {
581         return QUERY_STYLE_MULTIPLE_SAME;
582     } else {
583         return QUERY_STYLE_SINGLE;
584     }
587 /**
588  * Write to style_res the average opacity of a list of objects.
589  */
590 int
591 objects_query_opacity (GSList *objects, SPStyle *style_res)
593     if (g_slist_length(objects) == 0) {
594         /* No objects, set empty */
595         return QUERY_STYLE_NOTHING;
596     }
598     gdouble opacity_sum = 0;
599     gdouble opacity_prev = -1;
600     bool same_opacity = true;
601     guint opacity_items = 0;
604     for (GSList const *i = objects; i != NULL; i = i->next) {
605         SPObject *obj = SP_OBJECT (i->data);
606         SPStyle *style = SP_OBJECT_STYLE (obj);
607         if (!style) continue;
609         double opacity = SP_SCALE24_TO_FLOAT(style->opacity.value);
610         opacity_sum += opacity;
611         if (opacity_prev != -1 && opacity != opacity_prev)
612             same_opacity = false;
613         opacity_prev = opacity;
614         opacity_items ++;
615     }
616     if (opacity_items > 1)
617         opacity_sum /= opacity_items;
619     style_res->opacity.value = SP_SCALE24_FROM_FLOAT(opacity_sum);
621     if (opacity_items == 0) {
622         return QUERY_STYLE_NOTHING;
623     } else if (opacity_items == 1) {
624         return QUERY_STYLE_SINGLE;
625     } else {
626         if (same_opacity)
627             return QUERY_STYLE_MULTIPLE_SAME;
628         else
629             return QUERY_STYLE_MULTIPLE_AVERAGED;
630     }
633 /**
634  * Write to style_res the average stroke width of a list of objects.
635  */
636 int
637 objects_query_strokewidth (GSList *objects, SPStyle *style_res)
639     if (g_slist_length(objects) == 0) {
640         /* No objects, set empty */
641         return QUERY_STYLE_NOTHING;
642     }
644     gdouble avgwidth = 0.0;
646     gdouble prev_sw = -1;
647     bool same_sw = true;
649     int n_stroked = 0;
651     for (GSList const *i = objects; i != NULL; i = i->next) {
652         SPObject *obj = SP_OBJECT (i->data);
653         if (!SP_IS_ITEM(obj)) continue;
654         SPStyle *style = SP_OBJECT_STYLE (obj);
655         if (!style) continue;
657         if ( style->stroke.isNone() ) {
658             continue;
659         }
661         n_stroked ++;
663         NR::Matrix i2d = sp_item_i2d_affine (SP_ITEM(obj));
664         double sw = style->stroke_width.computed * NR::expansion(i2d);
666         if (prev_sw != -1 && fabs(sw - prev_sw) > 1e-3)
667             same_sw = false;
668         prev_sw = sw;
670         avgwidth += sw;
671     }
673     if (n_stroked > 1)
674         avgwidth /= (n_stroked);
676     style_res->stroke_width.computed = avgwidth;
677     style_res->stroke_width.set = true;
679     if (n_stroked == 0) {
680         return QUERY_STYLE_NOTHING;
681     } else if (n_stroked == 1) {
682         return QUERY_STYLE_SINGLE;
683     } else {
684         if (same_sw)
685             return QUERY_STYLE_MULTIPLE_SAME;
686         else
687             return QUERY_STYLE_MULTIPLE_AVERAGED;
688     }
691 /**
692  * Write to style_res the average miter limit of a list of objects.
693  */
694 int
695 objects_query_miterlimit (GSList *objects, SPStyle *style_res)
697     if (g_slist_length(objects) == 0) {
698         /* No objects, set empty */
699         return QUERY_STYLE_NOTHING;
700     }
702     gdouble avgml = 0.0;
703     int n_stroked = 0;
705     gdouble prev_ml = -1;
706     bool same_ml = true;
708     for (GSList const *i = objects; i != NULL; i = i->next) {
709         SPObject *obj = SP_OBJECT (i->data);
710         if (!SP_IS_ITEM(obj)) continue;
711         SPStyle *style = SP_OBJECT_STYLE (obj);
712         if (!style) continue;
714         if ( style->stroke.isNone() ) {
715             continue;
716         }
718         n_stroked ++;
720         if (prev_ml != -1 && fabs(style->stroke_miterlimit.value - prev_ml) > 1e-3)
721             same_ml = false;
722         prev_ml = style->stroke_miterlimit.value;
724         avgml += style->stroke_miterlimit.value;
725     }
727     if (n_stroked > 1)
728         avgml /= (n_stroked);
730     style_res->stroke_miterlimit.value = avgml;
731     style_res->stroke_miterlimit.set = true;
733     if (n_stroked == 0) {
734         return QUERY_STYLE_NOTHING;
735     } else if (n_stroked == 1) {
736         return QUERY_STYLE_SINGLE;
737     } else {
738         if (same_ml)
739             return QUERY_STYLE_MULTIPLE_SAME;
740         else
741             return QUERY_STYLE_MULTIPLE_AVERAGED;
742     }
745 /**
746  * Write to style_res the stroke cap of a list of objects.
747  */
748 int
749 objects_query_strokecap (GSList *objects, SPStyle *style_res)
751     if (g_slist_length(objects) == 0) {
752         /* No objects, set empty */
753         return QUERY_STYLE_NOTHING;
754     }
756     int cap = -1;
757     gdouble prev_cap = -1;
758     bool same_cap = true;
759     int n_stroked = 0;
761     for (GSList const *i = objects; i != NULL; i = i->next) {
762         SPObject *obj = SP_OBJECT (i->data);
763         if (!SP_IS_ITEM(obj)) continue;
764         SPStyle *style = SP_OBJECT_STYLE (obj);
765         if (!style) continue;
767         if ( style->stroke.isNone() ) {
768             continue;
769         }
771         n_stroked ++;
773         if (prev_cap != -1 && style->stroke_linecap.value != prev_cap)
774             same_cap = false;
775         prev_cap = style->stroke_linecap.value;
777         cap = style->stroke_linecap.value;
778     }
780     style_res->stroke_linecap.value = cap;
781     style_res->stroke_linecap.set = true;
783     if (n_stroked == 0) {
784         return QUERY_STYLE_NOTHING;
785     } else if (n_stroked == 1) {
786         return QUERY_STYLE_SINGLE;
787     } else {
788         if (same_cap)
789             return QUERY_STYLE_MULTIPLE_SAME;
790         else
791             return QUERY_STYLE_MULTIPLE_DIFFERENT;
792     }
795 /**
796  * Write to style_res the stroke join of a list of objects.
797  */
798 int
799 objects_query_strokejoin (GSList *objects, SPStyle *style_res)
801     if (g_slist_length(objects) == 0) {
802         /* No objects, set empty */
803         return QUERY_STYLE_NOTHING;
804     }
806     int join = -1;
807     gdouble prev_join = -1;
808     bool same_join = true;
809     int n_stroked = 0;
811     for (GSList const *i = objects; i != NULL; i = i->next) {
812         SPObject *obj = SP_OBJECT (i->data);
813         if (!SP_IS_ITEM(obj)) continue;
814         SPStyle *style = SP_OBJECT_STYLE (obj);
815         if (!style) continue;
817         if ( style->stroke.isNone() ) {
818             continue;
819         }
821         n_stroked ++;
823         if (prev_join != -1 && style->stroke_linejoin.value != prev_join)
824             same_join = false;
825         prev_join = style->stroke_linejoin.value;
827         join = style->stroke_linejoin.value;
828     }
830     style_res->stroke_linejoin.value = join;
831     style_res->stroke_linejoin.set = true;
833     if (n_stroked == 0) {
834         return QUERY_STYLE_NOTHING;
835     } else if (n_stroked == 1) {
836         return QUERY_STYLE_SINGLE;
837     } else {
838         if (same_join)
839             return QUERY_STYLE_MULTIPLE_SAME;
840         else
841             return QUERY_STYLE_MULTIPLE_DIFFERENT;
842     }
845 /**
846  * Write to style_res the average font size and spacing of objects.
847  */
848 int
849 objects_query_fontnumbers (GSList *objects, SPStyle *style_res)
851     bool different = false;
853     double size = 0;
854     double letterspacing = 0;
855     double linespacing = 0;
856     bool linespacing_normal = false;
857     bool letterspacing_normal = false;
859     double size_prev = 0;
860     double letterspacing_prev = 0;
861     double linespacing_prev = 0;
863     /// \todo FIXME: add word spacing, kerns? rotates?
865     int texts = 0;
867     for (GSList const *i = objects; i != NULL; i = i->next) {
868         SPObject *obj = SP_OBJECT (i->data);
870         if (!SP_IS_TEXT(obj) && !SP_IS_FLOWTEXT(obj)
871             && !SP_IS_TSPAN(obj) && !SP_IS_TREF(obj) && !SP_IS_TEXTPATH(obj)
872             && !SP_IS_FLOWDIV(obj) && !SP_IS_FLOWPARA(obj) && !SP_IS_FLOWTSPAN(obj))
873             continue;
875         SPStyle *style = SP_OBJECT_STYLE (obj);
876         if (!style) continue;
878         texts ++;
879         size += style->font_size.computed * NR::expansion(sp_item_i2d_affine(SP_ITEM(obj))); /// \todo FIXME: we assume non-% units here
881         if (style->letter_spacing.normal) {
882             if (!different && (letterspacing_prev == 0 || letterspacing_prev == letterspacing))
883                 letterspacing_normal = true;
884         } else {
885             letterspacing += style->letter_spacing.computed; /// \todo FIXME: we assume non-% units here
886             letterspacing_normal = false;
887         }
889         double linespacing_current;
890         if (style->line_height.normal) {
891             linespacing_current = Inkscape::Text::Layout::LINE_HEIGHT_NORMAL;
892             if (!different && (linespacing_prev == 0 || linespacing_prev == linespacing_current))
893                 linespacing_normal = true;
894         } else if (style->line_height.unit == SP_CSS_UNIT_PERCENT || style->font_size.computed == 0) {
895             linespacing_current = style->line_height.value;
896             linespacing_normal = false;
897         } else { // we need % here
898             linespacing_current = style->line_height.computed / style->font_size.computed;
899             linespacing_normal = false;
900         }
901         linespacing += linespacing_current;
903         if ((size_prev != 0 && style->font_size.computed != size_prev) ||
904             (letterspacing_prev != 0 && style->letter_spacing.computed != letterspacing_prev) ||
905             (linespacing_prev != 0 && linespacing_current != linespacing_prev)) {
906             different = true;
907         }
909         size_prev = style->font_size.computed;
910         letterspacing_prev = style->letter_spacing.computed;
911         linespacing_prev = linespacing_current;
913         // FIXME: we must detect MULTIPLE_DIFFERENT for these too
914         style_res->text_anchor.computed = style->text_anchor.computed;
915         style_res->writing_mode.computed = style->writing_mode.computed;
916     }
918     if (texts == 0)
919         return QUERY_STYLE_NOTHING;
921     if (texts > 1) {
922         size /= texts;
923         letterspacing /= texts;
924         linespacing /= texts;
925     }
927     style_res->font_size.computed = size;
928     style_res->font_size.type = SP_FONT_SIZE_LENGTH;
930     style_res->letter_spacing.normal = letterspacing_normal;
931     style_res->letter_spacing.computed = letterspacing;
933     style_res->line_height.normal = linespacing_normal;
934     style_res->line_height.computed = linespacing;
935     style_res->line_height.value = linespacing;
936     style_res->line_height.unit = SP_CSS_UNIT_PERCENT;
938     if (texts > 1) {
939         if (different) {
940             return QUERY_STYLE_MULTIPLE_AVERAGED;
941         } else {
942             return QUERY_STYLE_MULTIPLE_SAME;
943         }
944     } else {
945         return QUERY_STYLE_SINGLE;
946     }
949 /**
950  * Write to style_res the average font style of objects.
951  */
952 int
953 objects_query_fontstyle (GSList *objects, SPStyle *style_res)
955     bool different = false;
956     bool set = false;
958     int texts = 0;
960     for (GSList const *i = objects; i != NULL; i = i->next) {
961         SPObject *obj = SP_OBJECT (i->data);
963         if (!SP_IS_TEXT(obj) && !SP_IS_FLOWTEXT(obj)
964             && !SP_IS_TSPAN(obj) && !SP_IS_TREF(obj) && !SP_IS_TEXTPATH(obj)
965             && !SP_IS_FLOWDIV(obj) && !SP_IS_FLOWPARA(obj) && !SP_IS_FLOWTSPAN(obj))
966             continue;
968         SPStyle *style = SP_OBJECT_STYLE (obj);
969         if (!style) continue;
971         texts ++;
973         if (set &&
974             font_style_to_pos(*style_res).signature() != font_style_to_pos(*style).signature() ) {
975             different = true;  // different styles
976         }
978         set = TRUE;
979         style_res->font_weight.value = style_res->font_weight.computed = style->font_weight.computed;
980         style_res->font_style.value = style_res->font_style.computed = style->font_style.computed;
981         style_res->font_stretch.value = style_res->font_stretch.computed = style->font_stretch.computed;
982         style_res->font_variant.value = style_res->font_variant.computed = style->font_variant.computed;
983         style_res->text_align.value = style_res->text_align.computed = style->text_align.computed;
984     }
986     if (texts == 0 || !set)
987         return QUERY_STYLE_NOTHING;
989     if (texts > 1) {
990         if (different) {
991             return QUERY_STYLE_MULTIPLE_DIFFERENT;
992         } else {
993             return QUERY_STYLE_MULTIPLE_SAME;
994         }
995     } else {
996         return QUERY_STYLE_SINGLE;
997     }
1000 /**
1001  * Write to style_res the average font family of objects.
1002  */
1003 int
1004 objects_query_fontfamily (GSList *objects, SPStyle *style_res)
1006     bool different = false;
1007     int texts = 0;
1009     if (style_res->text->font_family.value) {
1010         g_free(style_res->text->font_family.value);
1011         style_res->text->font_family.value = NULL;
1012     }
1013     style_res->text->font_family.set = FALSE;
1015     for (GSList const *i = objects; i != NULL; i = i->next) {
1016         SPObject *obj = SP_OBJECT (i->data);
1018         if (!SP_IS_TEXT(obj) && !SP_IS_FLOWTEXT(obj)
1019             && !SP_IS_TSPAN(obj) && !SP_IS_TREF(obj) && !SP_IS_TEXTPATH(obj)
1020             && !SP_IS_FLOWDIV(obj) && !SP_IS_FLOWPARA(obj) && !SP_IS_FLOWTSPAN(obj))
1021             continue;
1023         SPStyle *style = SP_OBJECT_STYLE (obj);
1024         if (!style) continue;
1026         texts ++;
1028         if (style_res->text->font_family.value && style->text->font_family.value &&
1029             strcmp (style_res->text->font_family.value, style->text->font_family.value)) {
1030             different = true;  // different fonts
1031         }
1033         if (style_res->text->font_family.value) {
1034             g_free(style_res->text->font_family.value);
1035             style_res->text->font_family.value = NULL;
1036         }
1038         style_res->text->font_family.set = TRUE;
1039         style_res->text->font_family.value = g_strdup(style->text->font_family.value);
1040     }
1042     if (texts == 0 || !style_res->text->font_family.set)
1043         return QUERY_STYLE_NOTHING;
1045     if (texts > 1) {
1046         if (different) {
1047             return QUERY_STYLE_MULTIPLE_DIFFERENT;
1048         } else {
1049             return QUERY_STYLE_MULTIPLE_SAME;
1050         }
1051     } else {
1052         return QUERY_STYLE_SINGLE;
1053     }
1056 int
1057 objects_query_fontspecification (GSList *objects, SPStyle *style_res)
1059     bool different = false;
1060     int texts = 0;
1062     if (style_res->text->font_specification.value) {
1063         g_free(style_res->text->font_specification.value);
1064         style_res->text->font_specification.value = NULL;
1065     }
1066     style_res->text->font_specification.set = FALSE;
1068     for (GSList const *i = objects; i != NULL; i = i->next) {
1069         SPObject *obj = SP_OBJECT (i->data);
1071         if (!SP_IS_TEXT(obj) && !SP_IS_FLOWTEXT(obj)
1072             && !SP_IS_TSPAN(obj) && !SP_IS_TREF(obj) && !SP_IS_TEXTPATH(obj)
1073             && !SP_IS_FLOWDIV(obj) && !SP_IS_FLOWPARA(obj) && !SP_IS_FLOWTSPAN(obj))
1074             continue;
1076         SPStyle *style = SP_OBJECT_STYLE (obj);
1077         if (!style) continue;
1079         texts ++;
1081         if (style_res->text->font_specification.value && style_res->text->font_specification.set &&   
1082             style->text->font_specification.value && style->text->font_specification.set &&
1083             strcmp (style_res->text->font_specification.value, style->text->font_specification.value)) {
1084             different = true;  // different fonts
1085         }
1086         
1087         if (style->text->font_specification.set) {
1089             if (style_res->text->font_specification.value) {
1090                 g_free(style_res->text->font_specification.value);
1091                 style_res->text->font_specification.value = NULL;
1092             }
1093     
1094             style_res->text->font_specification.set = TRUE;
1095             style_res->text->font_specification.value = g_strdup(style->text->font_specification.value);
1096         }
1097     }
1099     if (texts == 0)
1100         return QUERY_STYLE_NOTHING;
1102     if (texts > 1) {
1103         if (different) {
1104             return QUERY_STYLE_MULTIPLE_DIFFERENT;
1105         } else {
1106             return QUERY_STYLE_MULTIPLE_SAME;
1107         }
1108     } else {
1109         return QUERY_STYLE_SINGLE;
1110     }
1113 int
1114 objects_query_blend (GSList *objects, SPStyle *style_res)
1116     const int empty_prev = -2;
1117     const int complex_filter = 5;
1118     int blend = 0;
1119     float blend_prev = empty_prev;
1120     bool same_blend = true;
1121     guint items = 0;
1122     
1123     for (GSList const *i = objects; i != NULL; i = i->next) {
1124         SPObject *obj = SP_OBJECT (i->data);
1125         SPStyle *style = SP_OBJECT_STYLE (obj);
1126         if(!style || !SP_IS_ITEM(obj)) continue;
1128         items++;
1130         //if object has a filter
1131         if (style->filter.set && style->getFilter()) {
1132             int blurcount = 0;
1133             int blendcount = 0;
1135             // determine whether filter is simple (blend and/or blur) or complex
1136             for(SPObject *primitive_obj = style->getFilter()->children;
1137                 primitive_obj && SP_IS_FILTER_PRIMITIVE(primitive_obj);
1138                 primitive_obj = primitive_obj->next) {
1139                 SPFilterPrimitive *primitive = SP_FILTER_PRIMITIVE(primitive_obj);
1140                 if(SP_IS_FEBLEND(primitive))
1141                     ++blendcount;
1142                 else if(SP_IS_GAUSSIANBLUR(primitive))
1143                     ++blurcount;
1144                 else {
1145                     blurcount = complex_filter;
1146                     break;
1147                 }
1148             }
1150             // simple filter
1151             if(blurcount == 1 || blendcount == 1) {
1152                 for(SPObject *primitive_obj = style->getFilter()->children;
1153                     primitive_obj && SP_IS_FILTER_PRIMITIVE(primitive_obj);
1154                     primitive_obj = primitive_obj->next) {
1155                     if(SP_IS_FEBLEND(primitive_obj)) {
1156                         SPFeBlend *spblend = SP_FEBLEND(primitive_obj);
1157                         blend = spblend->blend_mode;
1158                     }
1159                 }
1160             }
1161             else {
1162                 blend = complex_filter;
1163             }
1164         }
1165         // defaults to blend mode = "normal"
1166         else {
1167             blend = 0;
1168         }
1170         if(blend_prev != empty_prev && blend_prev != blend)
1171             same_blend = false;
1172         blend_prev = blend;
1173     }
1175     if (items > 0) {
1176         style_res->filter_blend_mode.value = blend;
1177     }
1179     if (items == 0) {
1180         return QUERY_STYLE_NOTHING;
1181     } else if (items == 1) {
1182         return QUERY_STYLE_SINGLE;
1183     } else {
1184         if(same_blend)
1185             return QUERY_STYLE_MULTIPLE_SAME;
1186         else
1187             return QUERY_STYLE_MULTIPLE_DIFFERENT;
1188     }
1191 /**
1192  * Write to style_res the average blurring of a list of objects.
1193  */
1194 int
1195 objects_query_blur (GSList *objects, SPStyle *style_res)
1197    if (g_slist_length(objects) == 0) {
1198         /* No objects, set empty */
1199         return QUERY_STYLE_NOTHING;
1200     }
1202     float blur_sum = 0;
1203     float blur_prev = -1;
1204     bool same_blur = true;
1205     guint blur_items = 0;
1206     guint items = 0;
1207     
1208     for (GSList const *i = objects; i != NULL; i = i->next) {
1209         SPObject *obj = SP_OBJECT (i->data);
1210         SPStyle *style = SP_OBJECT_STYLE (obj);
1211         if (!style) continue;
1212         if (!SP_IS_ITEM(obj)) continue;
1214         NR::Matrix i2d = sp_item_i2d_affine (SP_ITEM(obj));
1216         items ++;
1218         //if object has a filter
1219         if (style->filter.set && style->getFilter()) {
1220             //cycle through filter primitives
1221             SPObject *primitive_obj = style->getFilter()->children;
1222             while (primitive_obj) {
1223                 if (SP_IS_FILTER_PRIMITIVE(primitive_obj)) {
1224                     SPFilterPrimitive *primitive = SP_FILTER_PRIMITIVE(primitive_obj);
1225                     
1226                     //if primitive is gaussianblur
1227                     if(SP_IS_GAUSSIANBLUR(primitive)) {
1228                         SPGaussianBlur * spblur = SP_GAUSSIANBLUR(primitive);
1229                         float num = spblur->stdDeviation.getNumber();
1230                         blur_sum += num * NR::expansion(i2d);
1231                         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
1232                             same_blur = false;
1233                         blur_prev = num;
1234                         //TODO: deal with opt number, for the moment it's not necessary to the ui.
1235                         blur_items ++;
1236                     }
1237                 }
1238                 primitive_obj = primitive_obj->next;
1239             }
1240         }
1241     }
1243     if (items > 0) {
1244         if (blur_items > 0)
1245             blur_sum /= blur_items;
1246         style_res->filter_gaussianBlur_deviation.value = blur_sum;
1247     }
1249     if (items == 0) {
1250         return QUERY_STYLE_NOTHING;
1251     } else if (items == 1) {
1252         return QUERY_STYLE_SINGLE;
1253     } else {
1254         if (same_blur)
1255             return QUERY_STYLE_MULTIPLE_SAME;
1256         else
1257             return QUERY_STYLE_MULTIPLE_AVERAGED;
1258     }
1261 /**
1262  * Query the given list of objects for the given property, write
1263  * the result to style, return appropriate flag.
1264  */
1265 int
1266 sp_desktop_query_style_from_list (GSList *list, SPStyle *style, int property)
1268     if (property == QUERY_STYLE_PROPERTY_FILL) {
1269         return objects_query_fillstroke (list, style, true);
1270     } else if (property == QUERY_STYLE_PROPERTY_STROKE) {
1271         return objects_query_fillstroke (list, style, false);
1273     } else if (property == QUERY_STYLE_PROPERTY_STROKEWIDTH) {
1274         return objects_query_strokewidth (list, style);
1275     } else if (property == QUERY_STYLE_PROPERTY_STROKEMITERLIMIT) {
1276         return objects_query_miterlimit (list, style);
1277     } else if (property == QUERY_STYLE_PROPERTY_STROKECAP) {
1278         return objects_query_strokecap (list, style);
1279     } else if (property == QUERY_STYLE_PROPERTY_STROKEJOIN) {
1280         return objects_query_strokejoin (list, style);
1282     } else if (property == QUERY_STYLE_PROPERTY_MASTEROPACITY) {
1283         return objects_query_opacity (list, style);
1284         
1285     } else if (property == QUERY_STYLE_PROPERTY_FONT_SPECIFICATION) {
1286         return objects_query_fontspecification (list, style);
1287     } else if (property == QUERY_STYLE_PROPERTY_FONTFAMILY) {
1288         return objects_query_fontfamily (list, style);
1289     } else if (property == QUERY_STYLE_PROPERTY_FONTSTYLE) {
1290         return objects_query_fontstyle (list, style);
1291     } else if (property == QUERY_STYLE_PROPERTY_FONTNUMBERS) {
1292         return objects_query_fontnumbers (list, style);
1294     } else if (property == QUERY_STYLE_PROPERTY_BLEND) {
1295         return objects_query_blend (list, style);
1296     } else if (property == QUERY_STYLE_PROPERTY_BLUR) {
1297         return objects_query_blur (list, style);
1298     }
1299     return QUERY_STYLE_NOTHING;
1303 /**
1304  * Query the subselection (if any) or selection on the given desktop for the given property, write
1305  * the result to style, return appropriate flag.
1306  */
1307 int
1308 sp_desktop_query_style(SPDesktop *desktop, SPStyle *style, int property)
1310     int ret = desktop->_query_style_signal.emit(style, property);
1312     if (ret != QUERY_STYLE_NOTHING)
1313         return ret; // subselection returned a style, pass it on
1315     // otherwise, do querying and averaging over selection
1316     return sp_desktop_query_style_from_list ((GSList *) desktop->selection->itemList(), style, property);
1319 /**
1320  * Do the same as sp_desktop_query_style for all (defined) style properties, return true if at 
1321  * least one of the properties did not return QUERY_STYLE_NOTHING.
1322  */
1323 bool
1324 sp_desktop_query_style_all (SPDesktop *desktop, SPStyle *query)
1326         int result_family = sp_desktop_query_style (desktop, query, QUERY_STYLE_PROPERTY_FONTFAMILY);
1327         int result_fstyle = sp_desktop_query_style (desktop, query, QUERY_STYLE_PROPERTY_FONTSTYLE);
1328         int result_fnumbers = sp_desktop_query_style (desktop, query, QUERY_STYLE_PROPERTY_FONTNUMBERS);
1329         int result_fill = sp_desktop_query_style (desktop, query, QUERY_STYLE_PROPERTY_FILL);
1330         int result_stroke = sp_desktop_query_style (desktop, query, QUERY_STYLE_PROPERTY_STROKE);
1331         int result_strokewidth = sp_desktop_query_style (desktop, query, QUERY_STYLE_PROPERTY_STROKEWIDTH);
1332         int result_strokemiterlimit = sp_desktop_query_style (desktop, query, QUERY_STYLE_PROPERTY_STROKEMITERLIMIT);
1333         int result_strokecap = sp_desktop_query_style (desktop, query, QUERY_STYLE_PROPERTY_STROKECAP);
1334         int result_strokejoin = sp_desktop_query_style (desktop, query, QUERY_STYLE_PROPERTY_STROKEJOIN);
1335         int result_opacity = sp_desktop_query_style (desktop, query, QUERY_STYLE_PROPERTY_MASTEROPACITY);
1336         int result_blur = sp_desktop_query_style (desktop, query, QUERY_STYLE_PROPERTY_BLUR);
1337         
1338         return (result_family != QUERY_STYLE_NOTHING || 
1339                 result_fstyle != QUERY_STYLE_NOTHING || 
1340                 result_fnumbers != QUERY_STYLE_NOTHING || 
1341                 result_fill != QUERY_STYLE_NOTHING || 
1342                 result_stroke != QUERY_STYLE_NOTHING || 
1343                 result_opacity != QUERY_STYLE_NOTHING || 
1344                 result_strokewidth != QUERY_STYLE_NOTHING || 
1345                 result_strokemiterlimit != QUERY_STYLE_NOTHING ||
1346                 result_strokecap != QUERY_STYLE_NOTHING ||
1347                 result_strokejoin != QUERY_STYLE_NOTHING ||
1348                 result_blur != QUERY_STYLE_NOTHING);
1352 /*
1353   Local Variables:
1354   mode:c++
1355   c-file-style:"stroustrup"
1356   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
1357   indent-tabs-mode:nil
1358   fill-column:99
1359   End:
1360 */
1361 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :