summaryrefslogtreecommitdiffstats
path: root/src/desktop-style.cpp
diff options
context:
space:
mode:
authorArcadie M. Cracan <acracan@gmail.com>2009-12-27 11:31:36 +0000
committerArcadie M. Cracan <acracan@gmail.com>2009-12-27 11:31:36 +0000
commit30eaa4a74569f4fc5ee802ee3883201379c18235 (patch)
treeaf9d0af2df52735f67a9f4af1a821f6d2fe2f242 /src/desktop-style.cpp
parentConnector tool: make connectors avoid the convex hull of shapes. (diff)
parentWarning cleanup (diff)
downloadinkscape-30eaa4a74569f4fc5ee802ee3883201379c18235.tar.gz
inkscape-30eaa4a74569f4fc5ee802ee3883201379c18235.zip
Connector tool: make connectors avoid the convex hull of shapes.
(bzr r8857.1.2)
Diffstat (limited to 'src/desktop-style.cpp')
-rw-r--r--src/desktop-style.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp
index c8782051b..2afcd6109 100644
--- a/src/desktop-style.cpp
+++ b/src/desktop-style.cpp
@@ -44,6 +44,7 @@
#include "desktop-style.h"
#include "svg/svg-icc-color.h"
+#include "svg/svg-device-color.h"
#include "box3d-side.h"
/**
@@ -432,6 +433,8 @@ objects_query_fillstroke (GSList *objects, SPStyle *style_res, bool const isfill
paint_res->set = TRUE;
SVGICCColor* iccColor = 0;
+ SVGDeviceColor* devColor = 0;
+
bool iccSeen = false;
gfloat c[4];
c[0] = c[1] = c[2] = c[3] = 0.0;
@@ -529,6 +532,23 @@ objects_query_fillstroke (GSList *objects, SPStyle *style_res, bool const isfill
c[1] += d[1];
c[2] += d[2];
c[3] += SP_SCALE24_TO_FLOAT (isfill? style->fill_opacity.value : style->stroke_opacity.value);
+
+ // average device color
+ unsigned int it;
+ if (i==objects /*if this is the first object in the GList*/
+ && paint->value.color.device){
+ devColor = new SVGDeviceColor(*paint->value.color.device);
+ for (it=0; it < paint->value.color.device->colors.size(); it++){
+ devColor->colors[it] = 0;
+ }
+ }
+
+ if (devColor && paint->value.color.device && paint->value.color.device->type == devColor->type){
+ for (it=0; it < paint->value.color.device->colors.size(); it++){
+ devColor->colors[it] += paint->value.color.device->colors[it];
+ }
+ }
+
num ++;
}
@@ -568,6 +588,14 @@ objects_query_fillstroke (GSList *objects, SPStyle *style_res, bool const isfill
paint_res->value.color.icc = tmp;
}
+ // divide and store the device-color
+ if (devColor){
+ for (unsigned int it=0; it < devColor->colors.size(); it++){
+ devColor->colors[it] /= num;
+ }
+ paint_res->value.color.device = devColor;
+ }
+
if (num > 1) {
if (same_color)
return QUERY_STYLE_MULTIPLE_SAME;