summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4a1822d)
raw | patch | inline | side by side (parent: 4a1822d)
author | Jon A. Cruz <jon@joncruz.org> | |
Wed, 7 Jul 2010 07:41:42 +0000 (00:41 -0700) | ||
committer | Jon A. Cruz <jon@joncruz.org> | |
Wed, 7 Jul 2010 07:41:42 +0000 (00:41 -0700) |
"commit the awesomesauce"
src/color.cpp | patch | blob | history | |
src/color.h | patch | blob | history | |
src/desktop-style.cpp | patch | blob | history | |
src/style.cpp | patch | blob | history | |
src/svg/Makefile_insert | patch | blob | history | |
src/svg/svg-color.cpp | patch | blob | history | |
src/svg/svg-color.h | patch | blob | history | |
src/svg/svg-device-color.h | [deleted file] | patch | blob | history |
src/widgets/sp-color-scales.cpp | patch | blob | history |
diff --git a/src/color.cpp b/src/color.cpp
index 07c15ff15d9cb8d3ab16bb6119420b56b0955e12..ae1bfa05dd36abbd43e0e696156822310ac24764 100644 (file)
--- a/src/color.cpp
+++ b/src/color.cpp
#include <math.h>
#include "color.h"
#include "svg/svg-icc-color.h"
-#include "svg/svg-device-color.h"
#include "svg/svg-color.h"
#include "svg/css-ostringstream.h"
#define PROFILE_EPSILON 0.00000001
SPColor::SPColor() :
- icc(0),
- device(0)
+ icc(0)
{
v.c[0] = 0;
v.c[1] = 0;
}
SPColor::SPColor( SPColor const& other ) :
- icc(0),
- device(0)
+ icc(0)
{
*this = other;
}
SPColor::SPColor( float r, float g, float b ) :
- icc(0),
- device(0)
+ icc(0)
{
set( r, g, b );
}
SPColor::SPColor( guint32 value ) :
- icc(0),
- device(0)
+ icc(0)
{
set( value );
}
SPColor::~SPColor()
{
delete icc;
- delete device;
icc = 0;
- device = 0;
}
SPColor& SPColor::operator= (SPColor const& other)
{
SVGICCColor* tmp_icc = other.icc ? new SVGICCColor(*other.icc) : 0;
- SVGDeviceColor* tmp_device = other.device ? new SVGDeviceColor(*other.device) : 0;
v.c[0] = other.v.c[0];
v.c[1] = other.v.c[1];
}
icc = tmp_icc;
- if ( device ) {
- delete device;
- }
- device = tmp_device;
-
return *this;
}
&& (v.c[2] != other.v.c[2]);
match &= profileMatches( icc, other.icc );
-//TODO?: match &= devicecolorMatches( device, other.device );
return match;
}
css << ')';
}
- if ( device && device->type != DEVICE_COLOR_INVALID) {
- if ( !css.str().empty() ) {
- css << " ";
- }
-
- switch(device->type){
- case DEVICE_GRAY:
- css << "device-gray(";
- break;
- case DEVICE_RGB:
- css << "device-rgb(";
- break;
- case DEVICE_CMYK:
- css << "device-cmyk(";
- break;
- case DEVICE_NCHANNEL:
- css << "device-nchannel(";
- break;
- case DEVICE_COLOR_INVALID:
- //should not be reached
- break;
- }
-
- for (vector<double>::const_iterator i(device->colors.begin()),
- iEnd(device->colors.end());
- i != iEnd; ++i) {
- if (i!=device->colors.begin()) css << ", ";
- css << *i;
- }
- css << ')';
- }
-
return css.str();
}
diff --git a/src/color.h b/src/color.h
index 7fd351360e23ff25068356fd3ae9851dd8e94e46..bebeaec60b4e188bb2dbe7ae8514c6fbb8858b01 100644 (file)
--- a/src/color.h
+++ b/src/color.h
#define SP_RGBA32_F_COMPOSE(r,g,b,a) SP_RGBA32_U_COMPOSE (SP_COLOR_F_TO_U (r), SP_COLOR_F_TO_U (g), SP_COLOR_F_TO_U (b), SP_COLOR_F_TO_U (a))
struct SVGICCColor;
-struct SVGDeviceColor;
/**
* An RGB color with optional icc-color part
std::string toString() const;
SVGICCColor* icc;
- SVGDeviceColor* device;
union {
float c[3];
} v;
diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp
index e11fa14939204e7efb06b2e4e846a93bc96a1c26..5866b14fbe054637abcf8bee8d7f646ace0cf8ae 100644 (file)
--- a/src/desktop-style.cpp
+++ b/src/desktop-style.cpp
#include "desktop-style.h"
#include "svg/svg-icc-color.h"
-#include "svg/svg-device-color.h"
#include "box3d-side.h"
/**
@@ -466,7 +465,6 @@ 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];
@@ -570,22 +568,6 @@ objects_query_fillstroke (GSList *objects, SPStyle *style_res, bool const isfill
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 ++;
}
@@ -625,14 +607,6 @@ 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;
diff --git a/src/style.cpp b/src/style.cpp
index 2b5804671890d0a87f4869c7fc5c2fdfccfe381b..ffc1fb0aeaf9eb6681eb8e352c851cc5f03e4ca5 100644 (file)
--- a/src/style.cpp
+++ b/src/style.cpp
#include "svg/svg.h"
#include "svg/svg-color.h"
#include "svg/svg-icc-color.h"
-#include "svg/svg-device-color.h"
#include "display/canvas-bpath.h"
#include "attributes.h"
@@ -3259,17 +3258,6 @@ sp_style_read_ipaint(SPIPaint *paint, gchar const *str, SPStyle *style, SPDocume
}
paint->value.color.icc = tmp;
}
- if (strneq(str, "device-gray(", 12) ||
- strneq(str, "device-rgb(", 11) ||
- strneq(str, "device-cmyk(", 12) ||
- strneq(str, "device-nchannel(", 16)) {
- SVGDeviceColor* tmp = new SVGDeviceColor();
- if ( ! sp_svg_read_device_color( str, &str, tmp ) ) {
- delete tmp;
- tmp = 0;
- }
- paint->value.color.device = tmp;
- }
}
}
}
index c27b2291c87a57da4ae23319f5b77a035337c182..265210a4500da289046d59c65e70d9aefcab081a 100644 (file)
--- a/src/svg/Makefile_insert
+++ b/src/svg/Makefile_insert
svg/svg-affine.cpp \
svg/svg-color.cpp \
svg/svg-color.h \
- svg/svg-device-color.h \
svg/svg-icc-color.h \
svg/svg-length.cpp \
svg/svg-length.h \
diff --git a/src/svg/svg-color.cpp b/src/svg/svg-color.cpp
index 7d43b68eef18d75c2e82c6f7d4e967ceb1f2ee95..04f387798f792073f5a6ab87741c51dfef77846c 100644 (file)
--- a/src/svg/svg-color.cpp
+++ b/src/svg/svg-color.cpp
#include "preferences.h"
#include "svg-color.h"
#include "svg-icc-color.h"
-#include "svg-device-color.h"
#if ENABLE_LCMS
#include <lcms.h>
return sp_svg_read_icc_color(str, NULL, dest);
}
-bool sp_svg_read_device_color( gchar const *str, gchar const **end_ptr, SVGDeviceColor* dest)
-{
- bool good = true;
- unsigned int max_colors;
-
- if ( end_ptr ) {
- *end_ptr = str;
- }
- if ( dest ) {
- dest->colors.clear();
- }
-
- if ( !str ) {
- // invalid input
- good = false;
- } else {
- while ( g_ascii_isspace(*str) ) {
- str++;
- }
-
- dest->type = DEVICE_COLOR_INVALID;
- if (strneq( str, "device-gray(", 12 )){
- dest->type = DEVICE_GRAY;
- max_colors=1;
- str += 12;
- }
-
- if (strneq( str, "device-rgb(", 11 )){
- dest->type = DEVICE_RGB;
- max_colors=3;
- str += 11;
- }
-
- if (strneq( str, "device-cmyk(", 12 )){
- dest->type = DEVICE_CMYK;
- max_colors=4;
- str += 12;
- }
-
- if (strneq( str, "device-nchannel(", 16 )){
- dest->type = DEVICE_NCHANNEL;
- max_colors=0;
- str += 16;
- }
-
- if ( dest->type != DEVICE_COLOR_INVALID ) {
- while ( g_ascii_isspace(*str) ) {
- str++;
- }
-
- while ( *str && *str != ')' ) {
- if ( g_ascii_isdigit(*str) || *str == '.' || *str == '-' || *str == '+') {
- gchar* endPtr = 0;
- gdouble dbl = g_ascii_strtod( str, &endPtr );
- if ( !errno ) {
- if ( dest ) {
- dest->colors.push_back( dbl );
- }
- str = endPtr;
- } else {
- good = false;
- break;
- }
-
- while ( g_ascii_isspace(*str) || *str == ',' ) {
- str++;
- }
- } else {
- break;
- }
- }
- }
-
- // We need to have ended on a closing parenthesis
- if ( good ) {
- while ( g_ascii_isspace(*str) ) {
- str++;
- }
- good &= (*str == ')');
- }
- }
-
- if ( dest->colors.size() == 0) good=false;
- if ( dest->type != DEVICE_NCHANNEL && (dest->colors.size() != max_colors)) good=false;
-
- if ( good ) {
- if ( end_ptr ) {
- *end_ptr = str;
- }
- } else {
- if ( dest ) {
- dest->type = DEVICE_COLOR_INVALID;
- dest->colors.clear();
- }
- }
-
- return good;
-}
-
-
-bool sp_svg_read_device_color( gchar const *str, SVGDeviceColor* dest)
-{
- return sp_svg_read_device_color(str, NULL, dest);
-}
/*
Local Variables:
diff --git a/src/svg/svg-color.h b/src/svg/svg-color.h
index f4e534652abbf650bd0acbb6e461af3ae8461622..a3868c149b9473293d50691b88b3db20bdfd7913 100644 (file)
--- a/src/svg/svg-color.h
+++ b/src/svg/svg-color.h
#include <glib/gtypes.h>
class SVGICCColor;
-class SVGDeviceColor;
guint32 sp_svg_read_color(gchar const *str, unsigned int dfl);
guint32 sp_svg_read_color(gchar const *str, gchar const **end_ptr, guint32 def);
bool sp_svg_read_icc_color( gchar const *str, gchar const **end_ptr, SVGICCColor* dest );
bool sp_svg_read_icc_color( gchar const *str, SVGICCColor* dest );
-bool sp_svg_read_device_color( gchar const *str, gchar const **end_ptr, SVGDeviceColor* dest );
-bool sp_svg_read_device_color( gchar const *str, SVGDeviceColor* dest );
void icc_color_to_sRGB(SVGICCColor* dest, guchar* r, guchar* g, guchar* b);
#endif /* !SVG_SVG_COLOR_H_SEEN */
diff --git a/src/svg/svg-device-color.h b/src/svg/svg-device-color.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef SVG_DEVICE_COLOR_H_SEEN
-#define SVG_DEVICE_COLOR_H_SEEN
-
-#include <string>
-#include <vector>
-
-typedef enum {DEVICE_COLOR_INVALID, DEVICE_GRAY, DEVICE_RGB, DEVICE_CMYK, DEVICE_NCHANNEL} SVGDeviceColorType;
-
-struct SVGDeviceColor {
- SVGDeviceColorType type;
- std::vector<double> colors;
-};
-
-
-#endif /* !SVG_DEVICE_COLOR_H_SEEN */
-
-/*
- Local Variables:
- mode:c++
- c-file-style:"stroustrup"
- c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
- indent-tabs-mode:nil
- fill-column:99
- End:
-*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
index e41b81e5c327f0724f5e165de7ce3653ee12c1e0..d20cf65ef5a0091b0760134019cacd5817a6f31f 100644 (file)
#include "../dialogs/dialog-events.h"
#include "sp-color-scales.h"
#include "svg/svg-icc-color.h"
-#include "svg/svg-device-color.h"
#define CSC_CHANNEL_R (1 << 0)
#define CSC_CHANNEL_G (1 << 1)
case SP_COLOR_SCALES_MODE_CMYK:
{
_getCmykaFloatv( c );
- color.device = new SVGDeviceColor();
- color.device->type=DEVICE_CMYK;
- color.device->colors.clear();
- for (int i=0;i<4;i++){
- color.device->colors.push_back(c[i]);
- }
float rgb[3];
sp_color_cmyk_to_rgb_floatv( rgb, c[0], c[1], c[2], c[3] );
gtk_widget_show (_b[4]);
_updating = TRUE;
- if (_color.device && _color.device->type == DEVICE_CMYK){
- setScaled( _a[0], _color.device->colors[0] );
- setScaled( _a[1], _color.device->colors[1] );
- setScaled( _a[2], _color.device->colors[2] );
- setScaled( _a[3], _color.device->colors[3] );
- } else {
- //If we still dont have a device-color, convert from rbga
- sp_color_rgb_to_cmyk_floatv (c, rgba[0], rgba[1], rgba[2]);
- setScaled( _a[0], c[0] );
- setScaled( _a[1], c[1] );
- setScaled( _a[2], c[2] );
- setScaled( _a[3], c[3] );
- }
+ sp_color_rgb_to_cmyk_floatv (c, rgba[0], rgba[1], rgba[2]);
+ setScaled( _a[0], c[0] );
+ setScaled( _a[1], c[1] );
+ setScaled( _a[2], c[2] );
+ setScaled( _a[3], c[3] );
+
setScaled( _a[4], rgba[3] );
_updating = FALSE;
_updateSliders( CSC_CHANNELS_ALL );