r23832 by jghali - Also enable Black and White colors to be defined using a CIELab color model
scribus-commit
scribus-commit at lists.scribus.net
Tue May 26 00:12:07 UTC 2020
Author: jghali
Date: Tue May 26 00:12:07 2020
New Revision: 23832
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23832
Log:
Also enable Black and White colors to be defined using a CIELab color model
Modified:
trunk/Scribus/scribus/sccolor.cpp
Modified: trunk/Scribus/scribus/sccolor.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23832&path=/trunk/Scribus/scribus/sccolor.cpp
==============================================================================
--- trunk/Scribus/scribus/sccolor.cpp (original)
+++ trunk/Scribus/scribus/sccolor.cpp Tue May 26 00:12:07 2020
@@ -461,60 +461,78 @@
void ColorList::ensureBlack()
{
- bool addBlack = true;
ColorList::Iterator itb = find("Black");
- if (itb != end())
- {
- ScColor& black = itb.value();
- colorModel model = black.getColorModel();
- if (model == colorModelCMYK)
- {
- double c, m, y, k;
- black.getCMYK(&c, &m, &y, &k);
- if (c != 0.0 || m != 0.0 || y != 0.0 || k != 1.0)
- black.setCmykColorF(0.0, 0.0, 0.0, 1.0);
- addBlack = false;
- }
- else if (model == colorModelRGB)
- {
- double r, g, b;
- black.getRGB(&r, &g, &b);
- if (r != 0.0 || g != 0.0 || b != 0.0)
- black.setRgbColorF(0.0, 0.0, 0.0);
- addBlack = false;
- }
- }
- if (addBlack)
+ if (itb == end())
+ {
insert("Black", ScColor(0, 0, 0, 255));
+ return;
+ }
+
+ ScColor& black = itb.value();
+ colorModel model = black.getColorModel();
+ if (model == colorModelRGB)
+ {
+ double r, g, b;
+ black.getRGB(&r, &g, &b);
+ if (r != 0.0 || g != 0.0 || b != 0.0)
+ black.setRgbColorF(0.0, 0.0, 0.0);
+ }
+ else if (model == colorModelCMYK)
+ {
+ double c, m, y, k;
+ black.getCMYK(&c, &m, &y, &k);
+ if (c != 0.0 || m != 0.0 || y != 0.0 || k != 1.0)
+ black.setCmykColorF(0.0, 0.0, 0.0, 1.0);
+ }
+ else if (model == colorModelLab)
+ {
+ double l, a, b;
+ black.getLab(&l, &a, &b);
+ if (l != 0.0 || a != 0.0 || b != 0.0)
+ black.setLabColor(0.0, 0.0, 0.0);
+ }
+ else
+ {
+ black.setCmykColorF(0.0, 0.0, 0.0, 1.0);
+ }
}
void ColorList::ensureWhite()
{
- bool addWhite = true;
ColorList::Iterator itw = find("White");
- if (itw != end())
- {
- ScColor& white = itw.value();
- colorModel model = white.getColorModel();
- if (model == colorModelCMYK)
- {
- double c, m, y, k;
- white.getCMYK(&c, &m, &y, &k);
- if (c != 0.0 || m != 0.0 || y != 0.0 || k != 0.0)
- white.setCmykColorF(0.0, 0.0, 0.0, 0.0);
- addWhite = false;
- }
- else if (model == colorModelRGB)
- {
- double r, g, b;
- white.getRGB(&r, &g, &b);
- if (r != 1.0 || g != 1.0 || b != 1.0)
- white.setRgbColorF(1.0, 1.0, 1.0);
- addWhite = false;
- }
- }
- if (addWhite)
+ if (itw == end())
+ {
insert("White", ScColor(0, 0, 0, 0));
+ return;
+ }
+
+ ScColor& white = itw.value();
+ colorModel model = white.getColorModel();
+ if (model == colorModelRGB)
+ {
+ double r, g, b;
+ white.getRGB(&r, &g, &b);
+ if (r != 1.0 || g != 1.0 || b != 1.0)
+ white.setRgbColorF(1.0, 1.0, 1.0);
+ }
+ else if (model == colorModelCMYK)
+ {
+ double c, m, y, k;
+ white.getCMYK(&c, &m, &y, &k);
+ if (c != 0.0 || m != 0.0 || y != 0.0 || k != 0.0)
+ white.setCmykColorF(0.0, 0.0, 0.0, 0.0);
+ }
+ else if (model == colorModelLab)
+ {
+ double l, a, b;
+ white.getLab(&l, &a, &b);
+ if (l != 100.0 || a != 0.0 || b != 0.0)
+ white.setLabColor(100.0, 0.0, 0.0);
+ }
+ else
+ {
+ white.setCmykColorF(0.0, 0.0, 0.0, 0.0);
+ }
}
void ColorList::ensureRegistration()
More information about the scribus-commit
mailing list