summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 63efeb3)
raw | patch | inline | side by side (parent: 63efeb3)
author | Felipe C. da S. Sanches <juca@members.fsf.org> | |
Sun, 6 Dec 2009 08:00:44 +0000 (06:00 -0200) | ||
committer | Felipe C. da S. Sanches <juca@members.fsf.org> | |
Sun, 6 Dec 2009 08:00:44 +0000 (06:00 -0200) |
* related to https://bugs.launchpad.net/inkscape/+bug/444021
po/inkscape.pot | patch | blob | history | |
src/color.cpp | patch | blob | history | |
src/color.h | patch | blob | history | |
src/style.cpp | 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 | [new file with mode: 0644] | patch | blob |
diff --git a/po/inkscape.pot b/po/inkscape.pot
index ced8b271331b554adf32faf292c043deb1848a09..22fabbcc85c897efe08e9e268b1cb9ab7dfafb01 100644 (file)
--- a/po/inkscape.pot
+++ b/po/inkscape.pot
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: inkscape-devel@lists.sourceforge.net\n"
-"POT-Creation-Date: 2009-12-03 13:24+0100\n"
+"POT-Creation-Date: 2009-12-06 02:47-0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
#. alpha of color under cursor, to show in the statusbar
#. locale-sensitive printf is OK, since this goes to the UI, not into SVG
-#: ../src/dropper-context.cpp:302
+#: ../src/dropper-context.cpp:310
#, c-format
msgid " alpha %.3g"
msgstr ""
#. where the color is picked, to show in the statusbar
-#: ../src/dropper-context.cpp:304
+#: ../src/dropper-context.cpp:312
#, c-format
msgid ", averaged with radius %d"
msgstr ""
-#: ../src/dropper-context.cpp:304
+#: ../src/dropper-context.cpp:312
#, c-format
msgid " under cursor"
msgstr ""
#. message, to show in the statusbar
-#: ../src/dropper-context.cpp:306
+#: ../src/dropper-context.cpp:314
msgid "<b>Release mouse</b> to set color."
msgstr ""
-#: ../src/dropper-context.cpp:306 ../src/tools-switch.cpp:216
+#: ../src/dropper-context.cpp:314 ../src/tools-switch.cpp:216
msgid ""
"<b>Click</b> to set fill, <b>Shift+click</b> to set stroke; <b>drag</b> to "
"average color in area; with <b>Alt</b> to pick inverse color; <b>Ctrl+C</b> "
"to copy the color under mouse to clipboard"
msgstr ""
-#: ../src/dropper-context.cpp:344
+#: ../src/dropper-context.cpp:352
msgid "Set picked color"
msgstr ""
#: ../src/extension/internal/bitmap/modulate.cpp:41
#: ../src/flood-context.cpp:250 ../src/widgets/sp-color-icc-selector.cpp:236
#: ../src/widgets/sp-color-icc-selector.cpp:237
-#: ../src/widgets/sp-color-scales.cpp:426
-#: ../src/widgets/sp-color-scales.cpp:427 ../src/widgets/toolbox.cpp:4308
+#: ../src/widgets/sp-color-scales.cpp:431
+#: ../src/widgets/sp-color-scales.cpp:432 ../src/widgets/toolbox.cpp:4308
#: ../share/extensions/color_randomize.inx.h:2
msgid "Hue"
msgstr ""
#: ../src/flood-context.cpp:251 ../src/ui/dialog/inkscape-preferences.cpp:841
#: ../src/widgets/sp-color-icc-selector.cpp:236
#: ../src/widgets/sp-color-icc-selector.cpp:237
-#: ../src/widgets/sp-color-scales.cpp:429
-#: ../src/widgets/sp-color-scales.cpp:430 ../src/widgets/toolbox.cpp:4323
+#: ../src/widgets/sp-color-scales.cpp:434
+#: ../src/widgets/sp-color-scales.cpp:435 ../src/widgets/toolbox.cpp:4323
#: ../share/extensions/color_randomize.inx.h:5
msgid "Saturation"
msgstr ""
#: ../src/filter-enums.cpp:102 ../src/flood-context.cpp:247
#: ../src/widgets/sp-color-icc-selector.cpp:234
-#: ../src/widgets/sp-color-scales.cpp:400
-#: ../src/widgets/sp-color-scales.cpp:401
+#: ../src/widgets/sp-color-scales.cpp:405
+#: ../src/widgets/sp-color-scales.cpp:406
msgid "Red"
msgstr ""
#: ../src/filter-enums.cpp:103 ../src/flood-context.cpp:248
#: ../src/widgets/sp-color-icc-selector.cpp:234
-#: ../src/widgets/sp-color-scales.cpp:403
-#: ../src/widgets/sp-color-scales.cpp:404
+#: ../src/widgets/sp-color-scales.cpp:408
+#: ../src/widgets/sp-color-scales.cpp:409
msgid "Green"
msgstr ""
#: ../src/filter-enums.cpp:104 ../src/flood-context.cpp:249
#: ../src/widgets/sp-color-icc-selector.cpp:234
-#: ../src/widgets/sp-color-scales.cpp:406
-#: ../src/widgets/sp-color-scales.cpp:407
+#: ../src/widgets/sp-color-scales.cpp:411
+#: ../src/widgets/sp-color-scales.cpp:412
msgid "Blue"
msgstr ""
msgstr ""
#: ../src/flood-context.cpp:252 ../src/widgets/sp-color-icc-selector.cpp:237
-#: ../src/widgets/sp-color-scales.cpp:432
-#: ../src/widgets/sp-color-scales.cpp:433 ../src/widgets/toolbox.cpp:4338
+#: ../src/widgets/sp-color-scales.cpp:437
+#: ../src/widgets/sp-color-scales.cpp:438 ../src/widgets/toolbox.cpp:4338
#: ../share/extensions/color_randomize.inx.h:3
msgid "Lightness"
msgstr ""
msgstr ""
#. this is only used with 2 or more objects
-#: ../src/selection-describer.cpp:211 ../src/tweak-context.cpp:202
+#: ../src/selection-describer.cpp:211 ../src/spray-context.cpp:288
+#: ../src/tweak-context.cpp:202
#, c-format
msgid "<b>%i</b> object selected"
msgid_plural "<b>%i</b> objects selected"
msgid "at %d degrees, through (%s,%s)"
msgstr ""
-#: ../src/sp-image.cpp:1128
+#: ../src/sp-image.cpp:1135
msgid "embedded"
msgstr ""
-#: ../src/sp-image.cpp:1136
+#: ../src/sp-image.cpp:1143
#, c-format
msgid "<b>Image with bad reference</b>: %s"
msgstr ""
-#: ../src/sp-image.cpp:1137
+#: ../src/sp-image.cpp:1144
#, c-format
msgid "<b>Image</b> %d × %d: %s"
msgstr ""
msgid "<b>Orphaned clone</b>"
msgstr ""
+#: ../src/spray-context.cpp:290 ../src/tweak-context.cpp:204
+#, c-format
+msgid "<b>Nothing</b> selected"
+msgstr ""
+
+#: ../src/spray-context.cpp:296
+#, c-format
+msgid ""
+"%s. Drag, click or scroll to spray <b>copies</b> of the initial selection"
+msgstr ""
+
+#: ../src/spray-context.cpp:299
+#, c-format
+msgid ""
+"%s. Drag, click or scroll to spray <b>clones</b> of the initial selection"
+msgstr ""
+
+#: ../src/spray-context.cpp:302
+#, c-format
+msgid ""
+"%s. Drag, click or scroll to spray in a <b>single path</b> of the initial "
+"selection"
+msgstr ""
+
+#: ../src/spray-context.cpp:305
+#, c-format
+msgid "%s. Modify <b>spray</b> options"
+msgstr ""
+
+#: ../src/spray-context.cpp:917
+msgid "<b>Nothing selected!</b> Select objects to spray."
+msgstr ""
+
+#: ../src/spray-context.cpp:1025 ../src/widgets/toolbox.cpp:4525
+msgid "Spray with copies"
+msgstr ""
+
+#: ../src/spray-context.cpp:1029 ../src/widgets/toolbox.cpp:4532
+msgid "Spray with clones"
+msgstr ""
+
+#: ../src/spray-context.cpp:1033
+msgid "Spray in single path"
+msgstr ""
+
#: ../src/star-context.cpp:333
msgid "<b>Ctrl</b>: snap angle; keep rays radial"
msgstr ""
msgid "Trace: Done. %ld nodes created"
msgstr ""
-#: ../src/tweak-context.cpp:204
-#, c-format
-msgid "<b>Nothing</b> selected"
-msgstr ""
-
#: ../src/tweak-context.cpp:210
#, c-format
msgid "%s. Drag to <b>move</b>."
#: ../src/ui/dialog/align-and-distribute.cpp:509
#: ../src/ui/dialog/align-and-distribute.cpp:789
-#: ../src/widgets/toolbox.cpp:7475
+#: ../src/ui/dialog/spray-option.cpp:116 ../src/ui/dialog/spray-option.cpp:194
+#: ../src/ui/dialog/spray-option.cpp:212 ../src/widgets/toolbox.cpp:7475
msgid "Remove overlaps"
msgstr ""
#. Inkscape::GC::release(defsRepr);
#. inform the document, so we can undo
#. Color Management
-#: ../src/ui/dialog/document-properties.cpp:451 ../src/verbs.cpp:2755
+#: ../src/ui/dialog/document-properties.cpp:452 ../src/verbs.cpp:2755
msgid "Link Color Profile"
msgstr ""
-#: ../src/ui/dialog/document-properties.cpp:524
+#: ../src/ui/dialog/document-properties.cpp:525
msgid "Remove linked color profile"
msgstr ""
-#: ../src/ui/dialog/document-properties.cpp:538
+#: ../src/ui/dialog/document-properties.cpp:539
msgid "<b>Linked Color Profiles:</b>"
msgstr ""
-#: ../src/ui/dialog/document-properties.cpp:540
+#: ../src/ui/dialog/document-properties.cpp:541
msgid "<b>Available Color Profiles:</b>"
msgstr ""
-#: ../src/ui/dialog/document-properties.cpp:542
+#: ../src/ui/dialog/document-properties.cpp:543
msgid "Link Profile"
msgstr ""
-#: ../src/ui/dialog/document-properties.cpp:573
+#: ../src/ui/dialog/document-properties.cpp:574
msgid "Profile Name"
msgstr ""
-#: ../src/ui/dialog/document-properties.cpp:604
+#: ../src/ui/dialog/document-properties.cpp:605
msgid "<b>External script files:</b>"
msgstr ""
-#: ../src/ui/dialog/document-properties.cpp:606
+#: ../src/ui/dialog/document-properties.cpp:607
#: ../src/ui/dialog/swatches.cpp:463
msgid "Add"
msgstr ""
-#: ../src/ui/dialog/document-properties.cpp:629
+#: ../src/ui/dialog/document-properties.cpp:630
msgid "Filename"
msgstr ""
#. inform the document, so we can undo
-#: ../src/ui/dialog/document-properties.cpp:669
+#: ../src/ui/dialog/document-properties.cpp:670
msgid "Add external script..."
msgstr ""
-#: ../src/ui/dialog/document-properties.cpp:693
+#: ../src/ui/dialog/document-properties.cpp:694
msgid "Remove external script"
msgstr ""
-#: ../src/ui/dialog/document-properties.cpp:774
+#: ../src/ui/dialog/document-properties.cpp:775
msgid "<b>Creation</b>"
msgstr ""
-#: ../src/ui/dialog/document-properties.cpp:775
+#: ../src/ui/dialog/document-properties.cpp:776
msgid "<b>Defined grids</b>"
msgstr ""
-#: ../src/ui/dialog/document-properties.cpp:985
+#: ../src/ui/dialog/document-properties.cpp:986
msgid "Remove grid"
msgstr ""
msgid "Errors"
msgstr ""
+#: ../src/ui/dialog/spray-option.cpp:154
+#: ../share/extensions/polyhedron_3d.inx.h:26
+msgid "Minimum"
+msgstr ""
+
+#: ../src/ui/dialog/spray-option.cpp:156
+msgid "Min"
+msgstr ""
+
+#: ../src/ui/dialog/spray-option.cpp:164
+#: ../share/extensions/polyhedron_3d.inx.h:24
+msgid "Maximum"
+msgstr ""
+
+#: ../src/ui/dialog/spray-option.cpp:166
+msgid "Max:"
+msgstr ""
+
+#: ../src/ui/dialog/spray-option.cpp:245
+msgid "Distribution"
+msgstr ""
+
+#: ../src/ui/dialog/spray-option.cpp:246
+msgid "Cursor Options"
+msgstr ""
+
+#: ../src/ui/dialog/spray-option.cpp:247
+msgid "Random Options"
+msgstr ""
+
+#: ../src/ui/dialog/spray-option.cpp:251
+msgid "Uniform"
+msgstr ""
+
+#: ../src/ui/dialog/spray-option.cpp:252
+msgid "Gaussian "
+msgstr ""
+
+#: ../src/ui/dialog/spray-option.cpp:253
+msgid "Distribution : "
+msgstr ""
+
+#. ComboBoxText
+#: ../src/ui/dialog/spray-option.cpp:260
+msgid "Uniforme"
+msgstr ""
+
+#: ../src/ui/dialog/spray-option.cpp:261
+msgid "Gaussienne"
+msgstr ""
+
+#. Hbox Random
+#: ../src/ui/dialog/spray-option.cpp:277
+msgid "Scale : "
+msgstr ""
+
+#: ../src/ui/dialog/spray-option.cpp:277
+msgid "Applique un facteur d'échelle"
+msgstr ""
+
+#: ../src/ui/dialog/spray-option.cpp:278
+msgid "Rotation : "
+msgstr ""
+
+#: ../src/ui/dialog/spray-option.cpp:278
+msgid "Fait tourner"
+msgstr ""
+
+#. Hbox Cursor
+#: ../src/ui/dialog/spray-option.cpp:287
+msgid "Ratio : "
+msgstr ""
+
+#: ../src/ui/dialog/spray-option.cpp:287
+msgid "Excentricité de l'ellipse"
+msgstr ""
+
+#: ../src/ui/dialog/spray-option.cpp:288
+msgid "Angle : "
+msgstr ""
+
+#: ../src/ui/dialog/spray-option.cpp:288
+msgid "Angle de l'ellipse"
+msgstr ""
+
+#: ../src/ui/dialog/spray-option.cpp:289
+msgid "Width : "
+msgstr ""
+
+#: ../src/ui/dialog/spray-option.cpp:289
+msgid "Taille de l'ellipse"
+msgstr ""
+
#: ../src/ui/dialog/svg-fonts-dialog.cpp:121
msgid "Set SVG Font attribute"
msgstr ""
#: ../src/ui/widget/selected-style.cpp:236
#: ../src/widgets/sp-color-icc-selector.cpp:238
-#: ../src/widgets/sp-color-scales.cpp:463
-#: ../src/widgets/sp-color-scales.cpp:464
+#: ../src/widgets/sp-color-scales.cpp:468
+#: ../src/widgets/sp-color-scales.cpp:469
msgid "Black"
msgstr ""
msgstr ""
#: ../src/widgets/sp-color-icc-selector.cpp:220
-#: ../src/widgets/sp-color-scales.cpp:399
+#: ../src/widgets/sp-color-scales.cpp:404
msgid "_R"
msgstr ""
#: ../src/widgets/sp-color-icc-selector.cpp:220
#: ../src/widgets/sp-color-icc-selector.cpp:221
-#: ../src/widgets/sp-color-scales.cpp:402
+#: ../src/widgets/sp-color-scales.cpp:407
msgid "_G"
msgstr ""
#: ../src/widgets/sp-color-icc-selector.cpp:220
-#: ../src/widgets/sp-color-scales.cpp:405
+#: ../src/widgets/sp-color-scales.cpp:410
msgid "_B"
msgstr ""
#: ../src/widgets/sp-color-icc-selector.cpp:222
#: ../src/widgets/sp-color-icc-selector.cpp:223
-#: ../src/widgets/sp-color-scales.cpp:425
+#: ../src/widgets/sp-color-scales.cpp:430
msgid "_H"
msgstr ""
#: ../src/widgets/sp-color-icc-selector.cpp:222
#: ../src/widgets/sp-color-icc-selector.cpp:223
-#: ../src/widgets/sp-color-scales.cpp:428
+#: ../src/widgets/sp-color-scales.cpp:433
msgid "_S"
msgstr ""
#: ../src/widgets/sp-color-icc-selector.cpp:223
-#: ../src/widgets/sp-color-scales.cpp:431
+#: ../src/widgets/sp-color-scales.cpp:436
msgid "_L"
msgstr ""
#: ../src/widgets/sp-color-icc-selector.cpp:224
#: ../src/widgets/sp-color-icc-selector.cpp:225
-#: ../src/widgets/sp-color-scales.cpp:453
+#: ../src/widgets/sp-color-scales.cpp:458
msgid "_C"
msgstr ""
#: ../src/widgets/sp-color-icc-selector.cpp:224
#: ../src/widgets/sp-color-icc-selector.cpp:225
-#: ../src/widgets/sp-color-scales.cpp:456
+#: ../src/widgets/sp-color-scales.cpp:461
msgid "_M"
msgstr ""
#: ../src/widgets/sp-color-icc-selector.cpp:224
#: ../src/widgets/sp-color-icc-selector.cpp:225
-#: ../src/widgets/sp-color-scales.cpp:459
+#: ../src/widgets/sp-color-scales.cpp:464
msgid "_Y"
msgstr ""
#: ../src/widgets/sp-color-icc-selector.cpp:224
-#: ../src/widgets/sp-color-scales.cpp:462
+#: ../src/widgets/sp-color-scales.cpp:467
msgid "_K"
msgstr ""
#: ../src/widgets/sp-color-icc-selector.cpp:238
#: ../src/widgets/sp-color-icc-selector.cpp:239
-#: ../src/widgets/sp-color-scales.cpp:454
-#: ../src/widgets/sp-color-scales.cpp:455
+#: ../src/widgets/sp-color-scales.cpp:459
+#: ../src/widgets/sp-color-scales.cpp:460
msgid "Cyan"
msgstr ""
#: ../src/widgets/sp-color-icc-selector.cpp:238
#: ../src/widgets/sp-color-icc-selector.cpp:239
-#: ../src/widgets/sp-color-scales.cpp:457
-#: ../src/widgets/sp-color-scales.cpp:458
+#: ../src/widgets/sp-color-scales.cpp:462
+#: ../src/widgets/sp-color-scales.cpp:463
msgid "Magenta"
msgstr ""
#: ../src/widgets/sp-color-icc-selector.cpp:238
#: ../src/widgets/sp-color-icc-selector.cpp:239
-#: ../src/widgets/sp-color-scales.cpp:460
-#: ../src/widgets/sp-color-scales.cpp:461
+#: ../src/widgets/sp-color-scales.cpp:465
+#: ../src/widgets/sp-color-scales.cpp:466
msgid "Yellow"
msgstr ""
#. Label
#: ../src/widgets/sp-color-icc-selector.cpp:380
-#: ../src/widgets/sp-color-scales.cpp:408
-#: ../src/widgets/sp-color-scales.cpp:434
-#: ../src/widgets/sp-color-scales.cpp:465
-#: ../src/widgets/sp-color-wheel-selector.cpp:134
+#: ../src/widgets/sp-color-scales.cpp:413
+#: ../src/widgets/sp-color-scales.cpp:439
+#: ../src/widgets/sp-color-scales.cpp:470
+#: ../src/widgets/sp-color-wheel-selector.cpp:135
msgid "_A"
msgstr ""
#: ../src/widgets/sp-color-icc-selector.cpp:390
#: ../src/widgets/sp-color-icc-selector.cpp:402
-#: ../src/widgets/sp-color-scales.cpp:409
-#: ../src/widgets/sp-color-scales.cpp:410
-#: ../src/widgets/sp-color-scales.cpp:435
-#: ../src/widgets/sp-color-scales.cpp:436
-#: ../src/widgets/sp-color-scales.cpp:466
-#: ../src/widgets/sp-color-scales.cpp:467
-#: ../src/widgets/sp-color-wheel-selector.cpp:144
-#: ../src/widgets/sp-color-wheel-selector.cpp:156
+#: ../src/widgets/sp-color-scales.cpp:414
+#: ../src/widgets/sp-color-scales.cpp:415
+#: ../src/widgets/sp-color-scales.cpp:440
+#: ../src/widgets/sp-color-scales.cpp:441
+#: ../src/widgets/sp-color-scales.cpp:471
+#: ../src/widgets/sp-color-scales.cpp:472
+#: ../src/widgets/sp-color-wheel-selector.cpp:145
+#: ../src/widgets/sp-color-wheel-selector.cpp:157
msgid "Alpha (opacity)"
msgstr ""
-#: ../src/widgets/sp-color-notebook.cpp:330
+#: ../src/widgets/sp-color-notebook.cpp:339
+msgid "Color Managed"
+msgstr ""
+
+#: ../src/widgets/sp-color-notebook.cpp:347
+msgid "Out of gamut!"
+msgstr ""
+
+#: ../src/widgets/sp-color-notebook.cpp:355
+msgid "Too much ink!"
+msgstr ""
+
+#. Create RGBA entry and color preview
+#: ../src/widgets/sp-color-notebook.cpp:362
msgid "RGBA_:"
msgstr ""
-#: ../src/widgets/sp-color-notebook.cpp:338
+#: ../src/widgets/sp-color-notebook.cpp:370
msgid "Hexadecimal RGBA value of the color"
msgstr ""
-#: ../src/widgets/sp-color-scales.cpp:79
+#: ../src/widgets/sp-color-scales.cpp:80
msgid "RGB"
msgstr ""
-#: ../src/widgets/sp-color-scales.cpp:79
+#: ../src/widgets/sp-color-scales.cpp:80
msgid "HSL"
msgstr ""
-#: ../src/widgets/sp-color-scales.cpp:79
+#: ../src/widgets/sp-color-scales.cpp:80
msgid "CMYK"
msgstr ""
msgid "Unnamed"
msgstr ""
-#: ../src/widgets/sp-color-wheel-selector.cpp:61
+#: ../src/widgets/sp-color-wheel-selector.cpp:62
msgid "Wheel"
msgstr ""
msgid "The standard deviation of the spray action"
msgstr ""
-#: ../src/widgets/toolbox.cpp:4525
-msgid "Spray with copies"
-msgstr ""
-
#: ../src/widgets/toolbox.cpp:4526
msgid "Spray copies of the initial selection"
msgstr ""
-#: ../src/widgets/toolbox.cpp:4532
-msgid "Spray with clones"
-msgstr ""
-
#: ../src/widgets/toolbox.cpp:4533
msgid "Spray clones of the initial selection"
msgstr ""
msgid "Unable to find image data."
msgstr ""
-#: ../share/extensions/inkex.py:66
+#: ../share/extensions/inkex.py:67
msgid ""
"The fantastic lxml wrapper for libxml2 is required by inkex.py and therefore "
"this extension. Please download and install the latest version from http://"
"by a command like: sudo apt-get install python-lxml"
msgstr ""
-#: ../share/extensions/inkex.py:222
+#: ../share/extensions/inkex.py:223
#, python-format
msgid "No matching node for expression: %s"
msgstr ""
msgid "Load from file"
msgstr ""
-#: ../share/extensions/polyhedron_3d.inx.h:24
-msgid "Maximum"
-msgstr ""
-
-#: ../share/extensions/polyhedron_3d.inx.h:26
-msgid "Minimum"
-msgstr ""
-
#: ../share/extensions/polyhedron_3d.inx.h:27
msgid "Model file"
msgstr ""
diff --git a/src/color.cpp b/src/color.cpp
index b16d9950fec134755ad423e89656ba60dd7f4333..abaab6310005d238ee2ce50528765303baa71ce3 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)
+ icc(0),
+ device(0)
{
v.c[0] = 0;
v.c[1] = 0;
}
SPColor::SPColor( SPColor const& other ) :
- icc(0)
+ icc(0),
+ device(0)
{
*this = other;
}
SPColor::SPColor( float r, float g, float b ) :
- icc(0)
+ icc(0),
+ device(0)
{
set( r, g, b );
}
SPColor::SPColor( guint32 value ) :
- icc(0)
+ icc(0),
+ device(0)
{
set( value );
}
SPColor::~SPColor()
{
delete icc;
+ delete device;
icc = 0;
+ device = 0;
}
SPColor& SPColor::operator= (SPColor const& other)
{
- SVGICCColor* tmp = other.icc ? new SVGICCColor(*other.icc) : 0;
+ 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];
v.c[2] = other.v.c[2];
if ( icc ) {
delete icc;
}
- icc = tmp;
+ 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) {
+ css << ", " << *i;
+ }
+ css << ')';
+ }
+
return css.str();
}
diff --git a/src/color.h b/src/color.h
index bebeaec60b4e188bb2dbe7ae8514c6fbb8858b01..7fd351360e23ff25068356fd3ae9851dd8e94e46 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/style.cpp b/src/style.cpp
index 0b946f3488ede5da9b9bcabcb56ced53586c2889..111018c2a5df104a246b449010c05cd3f8d3010b 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"
@@ -3184,6 +3185,17 @@ 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;
+ }
}
}
}
diff --git a/src/svg/svg-color.cpp b/src/svg/svg-color.cpp
index d6b33402faba8da0dd29e7ee00e73864b5ea8cd2..0eaa4431a1e59a265e0eb258443a7bf2d1454fae 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 );
+g_message("color: %f", 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:
mode:c++
diff --git a/src/svg/svg-color.h b/src/svg/svg-color.h
index a3868c149b9473293d50691b88b3db20bdfd7913..f4e534652abbf650bd0acbb6e461af3ae8461622 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
@@ -0,0 +1,26 @@
+#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 :