From: Felipe C. da S. Sanches Date: Sun, 6 Dec 2009 08:00:44 +0000 (-0200) Subject: * infrastructure to store device colors as described in http://www.w3.org/TR/2009... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=89a1c5ba2e49701dd5fa7ff627430b86283fa52e;p=inkscape.git * infrastructure to store device colors as described in w3.org/TR/2009/WD-SVGColor12-20091001/#device * related to https://bugs.launchpad.net/inkscape/+bug/444021 --- diff --git a/po/inkscape.pot b/po/inkscape.pot index ced8b2713..22fabbcc8 100644 --- a/po/inkscape.pot +++ b/po/inkscape.pot @@ -8,7 +8,7 @@ msgid "" 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 \n" "Language-Team: LANGUAGE \n" @@ -4161,35 +4161,35 @@ msgstr "" #. 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 "Release mouse 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 "" "Click to set fill, Shift+click to set stroke; drag to " "average color in area; with Alt to pick inverse color; Ctrl+C " "to copy the color under mouse to clipboard" msgstr "" -#: ../src/dropper-context.cpp:344 +#: ../src/dropper-context.cpp:352 msgid "Set picked color" msgstr "" @@ -4726,8 +4726,8 @@ 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 "" @@ -4736,8 +4736,8 @@ 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 "" @@ -5770,22 +5770,22 @@ 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 "" @@ -5822,8 +5822,8 @@ msgid "Visible Colors" 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 "" @@ -9484,7 +9484,8 @@ msgid "Use Shift+D to look up frame" 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 "%i object selected" msgid_plural "%i objects selected" @@ -9684,16 +9685,16 @@ msgstr "" 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 "Image with bad reference: %s" msgstr "" -#: ../src/sp-image.cpp:1137 +#: ../src/sp-image.cpp:1144 #, c-format msgid "Image %d × %d: %s" msgstr "" @@ -9995,6 +9996,51 @@ msgstr "" msgid "Orphaned clone" msgstr "" +#: ../src/spray-context.cpp:290 ../src/tweak-context.cpp:204 +#, c-format +msgid "Nothing selected" +msgstr "" + +#: ../src/spray-context.cpp:296 +#, c-format +msgid "" +"%s. Drag, click or scroll to spray copies of the initial selection" +msgstr "" + +#: ../src/spray-context.cpp:299 +#, c-format +msgid "" +"%s. Drag, click or scroll to spray clones of the initial selection" +msgstr "" + +#: ../src/spray-context.cpp:302 +#, c-format +msgid "" +"%s. Drag, click or scroll to spray in a single path of the initial " +"selection" +msgstr "" + +#: ../src/spray-context.cpp:305 +#, c-format +msgid "%s. Modify spray options" +msgstr "" + +#: ../src/spray-context.cpp:917 +msgid "Nothing selected! 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 "Ctrl: snap angle; keep rays radial" msgstr "" @@ -10384,11 +10430,6 @@ msgstr "" msgid "Trace: Done. %ld nodes created" msgstr "" -#: ../src/tweak-context.cpp:204 -#, c-format -msgid "Nothing selected" -msgstr "" - #: ../src/tweak-context.cpp:210 #, c-format msgid "%s. Drag to move." @@ -10701,7 +10742,8 @@ msgstr "" #: ../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 "" @@ -11196,61 +11238,61 @@ 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 "Linked Color Profiles:" msgstr "" -#: ../src/ui/dialog/document-properties.cpp:540 +#: ../src/ui/dialog/document-properties.cpp:541 msgid "Available Color Profiles:" 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 "External script files:" 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 "Creation" msgstr "" -#: ../src/ui/dialog/document-properties.cpp:775 +#: ../src/ui/dialog/document-properties.cpp:776 msgid "Defined grids" msgstr "" -#: ../src/ui/dialog/document-properties.cpp:985 +#: ../src/ui/dialog/document-properties.cpp:986 msgid "Remove grid" msgstr "" @@ -14242,6 +14284,99 @@ 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 "" @@ -15346,8 +15481,8 @@ 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 "" @@ -17849,58 +17984,58 @@ msgid "CMS" 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 "" @@ -17910,22 +18045,22 @@ 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 "" @@ -17939,43 +18074,56 @@ 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 "" @@ -17983,7 +18131,7 @@ msgstr "" msgid "Unnamed" msgstr "" -#: ../src/widgets/sp-color-wheel-selector.cpp:61 +#: ../src/widgets/sp-color-wheel-selector.cpp:62 msgid "Wheel" msgstr "" @@ -19184,18 +19332,10 @@ 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 "" @@ -19905,7 +20045,7 @@ 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://" @@ -19913,7 +20053,7 @@ msgid "" "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 "" @@ -21655,14 +21795,6 @@ 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 b16d9950f..abaab6310 100644 --- a/src/color.cpp +++ b/src/color.cpp @@ -17,6 +17,7 @@ #include #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" @@ -29,7 +30,8 @@ static bool profileMatches( SVGICCColor const* first, SVGICCColor const* second #define PROFILE_EPSILON 0.00000001 SPColor::SPColor() : - icc(0) + icc(0), + device(0) { v.c[0] = 0; v.c[1] = 0; @@ -37,19 +39,22 @@ SPColor::SPColor() : } 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 ); } @@ -57,20 +62,29 @@ SPColor::SPColor( guint32 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; } @@ -86,6 +100,7 @@ bool SPColor::operator == (SPColor const& other) const && (v.c[2] != other.v.c[2]); match &= profileMatches( icc, other.icc ); +//TODO?: match &= devicecolorMatches( device, other.device ); return match; } @@ -204,6 +219,37 @@ std::string SPColor::toString() const 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::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 bebeaec60..7fd351360 100644 --- a/src/color.h +++ b/src/color.h @@ -34,6 +34,7 @@ #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 @@ -59,6 +60,7 @@ struct SPColor { std::string toString() const; SVGICCColor* icc; + SVGDeviceColor* device; union { float c[3]; } v; diff --git a/src/style.cpp b/src/style.cpp index 0b946f348..111018c2a 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -28,6 +28,7 @@ #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 d6b33402f..0eaa4431a 100644 --- a/src/svg/svg-color.cpp +++ b/src/svg/svg-color.cpp @@ -35,6 +35,7 @@ #include "preferences.h" #include "svg-color.h" #include "svg-icc-color.h" +#include "svg-device-color.h" #if ENABLE_LCMS #include @@ -604,6 +605,112 @@ bool sp_svg_read_icc_color( gchar const *str, SVGICCColor* dest ) 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 a3868c149..f4e534652 100644 --- a/src/svg/svg-color.h +++ b/src/svg/svg-color.h @@ -4,6 +4,7 @@ #include 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); @@ -11,6 +12,8 @@ void sp_svg_write_color(char *buf, unsigned int buflen, unsigned int rgba32); 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 new file mode 100644 index 000000000..305133ed3 --- /dev/null +++ b/src/svg/svg-device-color.h @@ -0,0 +1,26 @@ +#ifndef SVG_DEVICE_COLOR_H_SEEN +#define SVG_DEVICE_COLOR_H_SEEN + +#include +#include + +typedef enum {DEVICE_COLOR_INVALID, DEVICE_GRAY, DEVICE_RGB, DEVICE_CMYK, DEVICE_NCHANNEL} SVGDeviceColorType; + +struct SVGDeviceColor { + SVGDeviceColorType type; + std::vector 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 :