r20152 by fschmid - Fixed rounding errors in the color editor, minor improvements to Lab-Colorspace.
scribus-commit
scribus-commit at lists.scribus.net
Sun Jun 7 09:26:51 UTC 2015
Author: fschmid
Date: Sun Jun 7 09:26:51 2015
New Revision: 20152
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=20152
Log:
Fixed rounding errors in the color editor, minor improvements to Lab-Colorspace.
Modified:
trunk/Scribus/scribus/colormgmt/sclcms2colormgmtengineimpl.cpp
trunk/Scribus/scribus/sccolorengine.cpp
trunk/Scribus/scribus/sccolorengine.h
trunk/Scribus/scribus/scribuscore.cpp
trunk/Scribus/scribus/scribusdoc.cpp
trunk/Scribus/scribus/ui/cmykfw.cpp
trunk/Scribus/scribus/ui/colorchart.cpp
trunk/Scribus/scribus/ui/colorchart.h
Modified: trunk/Scribus/scribus/colormgmt/sclcms2colormgmtengineimpl.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20152&path=/trunk/Scribus/scribus/colormgmt/sclcms2colormgmtengineimpl.cpp
==============================================================================
--- trunk/Scribus/scribus/colormgmt/sclcms2colormgmtengineimpl.cpp (original)
+++ trunk/Scribus/scribus/colormgmt/sclcms2colormgmtengineimpl.cpp Sun Jun 7 09:26:51 2015
@@ -219,7 +219,7 @@
if (!profile.isNull())
return profile;
- cmsHPROFILE lcmsProf = cmsCreateLab2Profile(NULL);
+ cmsHPROFILE lcmsProf = cmsCreateLab4Profile(NULL);
if (lcmsProf)
{
ScLcms2ColorProfileImpl* profData = new ScLcms2ColorProfileImpl(engine, lcmsProf);
Modified: trunk/Scribus/scribus/sccolorengine.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20152&path=/trunk/Scribus/scribus/sccolorengine.cpp
==============================================================================
--- trunk/Scribus/scribus/sccolorengine.cpp (original)
+++ trunk/Scribus/scribus/sccolorengine.cpp Sun Jun 7 09:26:51 2015
@@ -58,12 +58,12 @@
{
ScColorProfile profRGB = doc ? doc->DocInputRGBProf : ScCore->defaultRGBProfile;
ScColorProfile profLab = ScCore->defaultLabProfile;
- ScColorTransform trans = engine.createTransform(profRGB, Format_RGB_8, profLab, Format_Lab_Dbl, Intent_Perceptual, 0);
+ ScColorTransform trans = engine.createTransform(profRGB, Format_RGB_16, profLab, Format_Lab_Dbl, Intent_Perceptual, 0);
double outC[3];
unsigned short inC[3];
- inC[0] = color.CR;
- inC[1] = color.MG;
- inC[2] = color.YB;
+ inC[0] = color.CR * 257;
+ inC[1] = color.MG * 257;
+ inC[2] = color.YB * 257;
trans.apply(inC, outC, 1);
newCol.setColor(outC[0], outC[1], outC[2]);
}
@@ -71,13 +71,13 @@
{
ScColorProfile profRGB = doc ? doc->DocInputCMYKProf : ScCore->defaultCMYKProfile;
ScColorProfile profLab = ScCore->defaultLabProfile;
- ScColorTransform trans = engine.createTransform(profRGB, Format_CMYK_8, profLab, Format_Lab_Dbl, Intent_Perceptual, 0);
+ ScColorTransform trans = engine.createTransform(profRGB, Format_CMYK_16, profLab, Format_Lab_Dbl, Intent_Perceptual, 0);
double outC[3];
unsigned short inC[4];
- inC[0] = color.CR;
- inC[1] = color.MG;
- inC[2] = color.YB;
- inC[3] = color.K;
+ inC[0] = color.CR * 257;
+ inC[1] = color.MG * 257;
+ inC[2] = color.YB * 257;
+ inC[3] = color.K * 257;
trans.apply(inC, outC, 1);
newCol.setColor(outC[0], outC[1], outC[2]);
}
@@ -117,11 +117,11 @@
inC[0] = color.L_val;
inC[1] = color.a_val;
inC[2] = color.b_val;
- quint8 outC[3];
+ quint16 outC[3];
trans.apply(inC, outC, 1);
- rgb.r = outC[0];
- rgb.g = outC[1];
- rgb.b = outC[2];
+ rgb.r = outC[0] / 257;
+ rgb.g = outC[1] / 257;
+ rgb.b = outC[2] / 257;
}
}
else if (model == colorModelCMYK)
@@ -143,11 +143,11 @@
inC[0] = color.L_val;
inC[1] = color.a_val;
inC[2] = color.b_val;
- quint8 outC[3];
+ quint16 outC[3];
trans.apply(inC, outC, 1);
- rgb.r = outC[0];
- rgb.g = outC[1];
- rgb.b = outC[2];
+ rgb.r = outC[0] / 257;
+ rgb.g = outC[1] / 257;
+ rgb.b = outC[2] / 257;
}
}
@@ -195,10 +195,10 @@
inC[2] = color.b_val;
quint8 outC[4];
trans.apply(inC, outC, 1);
- cmyk.c = outC[0];
- cmyk.m = outC[1];
- cmyk.y = outC[2];
- cmyk.k = outC[3];
+ cmyk.c = outC[0] / 257;
+ cmyk.m = outC[1] / 257;
+ cmyk.y = outC[2] / 257;
+ cmyk.k = outC[3] / 257;
}
}
else if (model == colorModelRGB)
@@ -222,12 +222,12 @@
inC[0] = color.L_val;
inC[1] = color.a_val;
inC[2] = color.b_val;
- quint8 outC[4];
+ quint16 outC[4];
trans.apply(inC, outC, 1);
- cmyk.c = outC[0];
- cmyk.m = outC[1];
- cmyk.y = outC[2];
- cmyk.k = outC[3];
+ cmyk.c = outC[0] / 257;
+ cmyk.m = outC[1] / 257;
+ cmyk.y = outC[2] / 257;
+ cmyk.k = outC[3] / 257;
}
}
@@ -255,12 +255,12 @@
inC[0] = color.L_val * (level / 100.0);
inC[1] = color.a_val;
inC[2] = color.b_val;
- quint8 outC[4];
+ quint16 outC[4];
trans.apply(inC, outC, 1);
- cmyk.c = outC[0];
- cmyk.m = outC[1];
- cmyk.y = outC[2];
- cmyk.k = outC[3];
+ cmyk.c = outC[0] / 257;
+ cmyk.m = outC[1] / 257;
+ cmyk.y = outC[2] / 257;
+ cmyk.k = outC[3] / 257;
}
}
@@ -294,11 +294,11 @@
inC[0] = color.L_val * (level / 100.0);
inC[1] = color.a_val;
inC[2] = color.b_val;
- quint8 outC[3];
+ quint16 outC[3];
trans.apply(inC, outC, 1);
- rgb.r = outC[0];
- rgb.g = outC[1];
- rgb.b = outC[2];
+ rgb.r = outC[0] / 257;
+ rgb.g = outC[1] / 257;
+ rgb.b = outC[2] / 257;
}
}
@@ -329,9 +329,9 @@
inC[0] = color.L_val;
inC[1] = color.a_val;
inC[2] = color.b_val;
- quint8 outC[3];
+ quint16 outC[3];
trans.apply(inC, outC, 1);
- tmp = QColor(outC[0], outC[1], outC[2]);
+ tmp = QColor(outC[0] / 257, outC[1] / 257, outC[2] / 257);
}
return tmp;
}
@@ -365,14 +365,14 @@
inC[0] = color.L_val * (level / 100.0);
inC[1] = color.a_val;
inC[2] = color.b_val;
- quint8 outC[3];
+ quint16 outC[3];
trans.apply(inC, outC, 1);
- tmp = QColor(outC[0], outC[1], outC[2]);
+ tmp = QColor(outC[0] / 257, outC[1] / 257, outC[2] / 257);
}
return tmp;
}
-QColor ScColorEngine::getDisplayColorGC(const ScColor& color, const ScribusDoc* doc)
+QColor ScColorEngine::getDisplayColorGC(const ScColor& color, const ScribusDoc* doc, bool *outOfG)
{
QColor tmp;
bool doSoftProofing = doc ? doc->SoftProofing : false;
@@ -380,6 +380,8 @@
if ( doSoftProofing && doGamutCheck )
{
bool outOfGamutFlag = isOutOfGamut(color, doc);
+ if (outOfG != NULL)
+ *outOfG = outOfGamutFlag;
tmp = outOfGamutFlag ? QColor(0, 255, 0) : getDisplayColor(color, doc);
}
else
@@ -468,7 +470,7 @@
inC[0] = color.L_val * (level / 100.0);
inC[1] = color.a_val;
inC[2] = color.b_val;
- quint8 outC[3];
+ quint16 outC[3];
ScColorTransform trans = doc ? doc->stdLabToRGBTrans : ScCore->defaultLabToRGBTrans;
ScColorTransform transProof = doc ? doc->stdProofLab : ScCore->defaultLabToRGBTrans;
ScColorTransform transProofGC = doc ? doc->stdProofLabGC : ScCore->defaultLabToRGBTrans;
@@ -481,7 +483,7 @@
else
{
trans.apply(inC, outC, 1);
- tmp = QColor(outC[0], outC[1], outC[2]);
+ tmp = QColor(outC[0] / 257, outC[1] / 257, outC[2] / 257);
}
}
Modified: trunk/Scribus/scribus/sccolorengine.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20152&path=/trunk/Scribus/scribus/sccolorengine.h
==============================================================================
--- trunk/Scribus/scribus/sccolorengine.h (original)
+++ trunk/Scribus/scribus/sccolorengine.h Sun Jun 7 09:26:51 2015
@@ -59,7 +59,7 @@
/** \brief Return a color converted to monitor color space. No soft-proofing is done
* If gamut check is valid, the return value may be an gamut warning . */
- static QColor getDisplayColorGC(const ScColor& color, const ScribusDoc* doc);
+ static QColor getDisplayColorGC(const ScColor& color, const ScribusDoc* doc, bool *outOfG = NULL);
/** \brief Return a proofed QColor with 100% shade and optional gamut check.
* If color management is enabled, returned value use the monitor color space. */
Modified: trunk/Scribus/scribus/scribuscore.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20152&path=/trunk/Scribus/scribus/scribuscore.cpp
==============================================================================
--- trunk/Scribus/scribus/scribuscore.cpp (original)
+++ trunk/Scribus/scribus/scribuscore.cpp Sun Jun 7 09:26:51 2015
@@ -427,8 +427,8 @@
defaultCMYKToScreenImageTrans = defaultEngine.createTransform(defaultCMYKProfile, Format_CMYK_8, defaultRGBProfile, Format_RGBA_8, intent, dcmsFlags);
defaultRGBToCMYKTrans = defaultEngine.createTransform(defaultRGBProfile, Format_RGB_16, defaultCMYKProfile, Format_CMYK_16, intent, dcmsFlags);
defaultCMYKToRGBTrans = defaultEngine.createTransform(defaultCMYKProfile, Format_CMYK_16, defaultRGBProfile, Format_RGB_16, intent, dcmsFlags);
- defaultLabToRGBTrans = defaultEngine.createTransform(defaultLabProfile, Format_Lab_Dbl, defaultRGBProfile, Format_RGB_8, Intent_Perceptual, dcmsFlags);
- defaultLabToCMYKTrans = defaultEngine.createTransform(defaultLabProfile, Format_Lab_Dbl, defaultCMYKProfile, Format_CMYK_8, Intent_Perceptual, dcmsFlags);
+ defaultLabToRGBTrans = defaultEngine.createTransform(defaultLabProfile, Format_Lab_Dbl, defaultRGBProfile, Format_RGB_16, Intent_Absolute_Colorimetric, dcmsFlags);
+ defaultLabToCMYKTrans = defaultEngine.createTransform(defaultLabProfile, Format_Lab_Dbl, defaultCMYKProfile, Format_CMYK_16, Intent_Absolute_Colorimetric, dcmsFlags);
if (!defaultRGBToScreenSolidTrans || !defaultRGBToScreenImageTrans ||
!defaultCMYKToScreenImageTrans || !defaultRGBToCMYKTrans ||
!defaultCMYKToRGBTrans || !defaultLabToRGBTrans|| !defaultLabToCMYKTrans)
Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20152&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Sun Jun 7 09:26:51 2015
@@ -1059,8 +1059,8 @@
docPrefsData.colorPrefs.DCMSset.ComponentsInput2 = 4;
if (DocInputRGBProf.colorSpace() == ColorSpace_Cmy)
docPrefsData.colorPrefs.DCMSset.ComponentsInput2 = 3;
- stdLabToRGBTrans = colorEngine.createTransform(ScCore->defaultLabProfile, Format_Lab_Dbl, DocDisplayProf, Format_RGB_8, Intent_Perceptual, dcmsFlags);
- stdLabToCMYKTrans = colorEngine.createTransform(ScCore->defaultLabProfile, Format_Lab_Dbl, DocPrinterProf, Format_CMYK_8, Intent_Perceptual, dcmsFlags);
+ stdLabToRGBTrans = colorEngine.createTransform(ScCore->defaultLabProfile, Format_Lab_Dbl, DocDisplayProf, Format_RGB_16, Intent_Absolute_Colorimetric, dcmsFlags);
+ stdLabToCMYKTrans = colorEngine.createTransform(ScCore->defaultLabProfile, Format_Lab_Dbl, DocPrinterProf, Format_CMYK_16, Intent_Absolute_Colorimetric, dcmsFlags);
bool success = (stdTransRGBMon && stdTransCMYKMon && stdProofImg && stdProofImgCMYK &&
stdTransImg && stdTransRGB && stdTransCMYK && stdProof &&
Modified: trunk/Scribus/scribus/ui/cmykfw.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20152&path=/trunk/Scribus/scribus/ui/cmykfw.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/cmykfw.cpp (original)
+++ trunk/Scribus/scribus/ui/cmykfw.cpp Sun Jun 7 09:26:51 2015
@@ -334,11 +334,11 @@
cyd = cmyk.y / 2.55;
ckd = cmyk.k / 2.55;
CyanSp->setValue(ccd);
- CyanSL->setValue(qRound(ccd));
+ CyanSL->setValue(qRound(ccd * 1000));
MagentaSp->setValue(cmd);
- MagentaSL->setValue(qRound(cmd));
+ MagentaSL->setValue(qRound(cmd * 1000));
YellowSp->setValue(cyd);
- YellowSL->setValue(qRound(cyd));
+ YellowSL->setValue(qRound(cyd * 1000));
BlackSp->setValue(ckd);
BlackSL->setValue(qRound(ckd));
BlackComp = cmyk.k;
@@ -406,13 +406,13 @@
{
int val = qRound(value);
if (CyanSp == sender())
- CyanSL->setValue(val);
+ CyanSL->setValue(val * 1000);
if (MagentaSp == sender())
- MagentaSL->setValue(val);
+ MagentaSL->setValue(val * 1000);
if (YellowSp == sender())
- YellowSL->setValue(val);
+ YellowSL->setValue(val * 1000);
if (BlackSp == sender())
- BlackSL->setValue(val);
+ BlackSL->setValue(val * 1000);
}
void CMYKChoose::slotRightClick()
@@ -435,13 +435,13 @@
disconnect( YellowSp, SIGNAL( valueChanged(double) ), this, SLOT( setValSLiders(double) ) );
disconnect( BlackSp, SIGNAL( valueChanged(double) ), this, SLOT( setValSLiders(double) ) );
if (CyanSL == sender())
- CyanSp->setValue(val);
+ CyanSp->setValue(val / 1000.0);
if (MagentaSL == sender())
- MagentaSp->setValue(val);
+ MagentaSp->setValue(val / 1000.0);
if (YellowSL == sender())
- YellowSp->setValue(val);
+ YellowSp->setValue(val / 1000.0);
if (BlackSL == sender())
- BlackSp->setValue(val);
+ BlackSp->setValue(val / 1000.0);
setColor();
connect( CyanSp, SIGNAL( valueChanged(double) ), this, SLOT( setValSLiders(double) ) );
connect( MagentaSp, SIGNAL( valueChanged(double) ), this, SLOT( setValSLiders(double) ) );
@@ -682,18 +682,18 @@
if (mod == tr("CMYK"))
{
Wsave = false;
- CyanSL->setMaximum( 100 );
- MagentaSL->setMaximum( 100 );
- YellowSL->setMaximum( 100 );
+ CyanSL->setMaximum( 100 * 1000.0);
+ MagentaSL->setMaximum( 100 * 1000.0 );
+ YellowSL->setMaximum( 100 * 1000.0 );
CyanSp->setMaximum( 100 );
MagentaSp->setMaximum( 100);
YellowSp->setMaximum( 100 );
- CyanSL->setSingleStep(1);
- MagentaSL->setSingleStep(1);
- YellowSL->setSingleStep(1);
- CyanSL->setPageStep(10);
- MagentaSL->setPageStep(10);
- YellowSL->setPageStep(10);
+ CyanSL->setSingleStep(1 * 1000.0);
+ MagentaSL->setSingleStep(1 * 1000.0);
+ YellowSL->setSingleStep(1 * 1000.0);
+ CyanSL->setPageStep(10 * 1000.0);
+ MagentaSL->setPageStep(10 * 1000.0);
+ YellowSL->setPageStep(10 * 1000.0);
CyanSp->setDecimals(1);
MagentaSp->setDecimals(1);
YellowSp->setDecimals(1);
@@ -715,21 +715,21 @@
MagentaP->setPixmap(sliderPix(300));
YellowP->setPixmap(sliderPix(60));
BlackP->setPixmap(sliderBlack());
- ColorMap->setEnabled(true);
+ ColorMap->isLabMode = false;
setValues();
}
else if ((mod == tr("Web Safe RGB")) || (mod == tr("RGB")))
{
Wsave = false;
- CyanSL->setMaximum( 255 );
- MagentaSL->setMaximum( 255 );
- YellowSL->setMaximum( 255 );
- CyanSL->setSingleStep(1);
- MagentaSL->setSingleStep(1);
- YellowSL->setSingleStep(1);
- CyanSL->setPageStep(1);
- MagentaSL->setPageStep(1);
- YellowSL->setPageStep(1);
+ CyanSL->setMaximum( 255 * 1000.0 );
+ MagentaSL->setMaximum( 255 * 1000.0 );
+ YellowSL->setMaximum( 255 * 1000.0 );
+ CyanSL->setSingleStep(1 * 1000.0);
+ MagentaSL->setSingleStep(1 * 1000.0);
+ YellowSL->setSingleStep(1 * 1000.0);
+ CyanSL->setPageStep(1 * 1000.0);
+ MagentaSL->setPageStep(1 * 1000.0);
+ YellowSL->setPageStep(1 * 1000.0);
CyanSp->setSingleStep(1);
MagentaSp->setSingleStep(1);
YellowSp->setSingleStep(1);
@@ -753,12 +753,12 @@
if (mod == tr("Web Safe RGB"))
{
Wsave = true;
- CyanSL->setSingleStep(51);
- MagentaSL->setSingleStep(51);
- YellowSL->setSingleStep(51);
- CyanSL->setPageStep(51);
- MagentaSL->setPageStep(51);
- YellowSL->setPageStep(51);
+ CyanSL->setSingleStep(51 * 1000.0);
+ MagentaSL->setSingleStep(51 * 1000.0);
+ YellowSL->setSingleStep(51 * 1000.0);
+ CyanSL->setPageStep(51 * 1000.0);
+ MagentaSL->setPageStep(51 * 1000.0);
+ YellowSL->setPageStep(51 * 1000.0);
CyanSp->setSingleStep(51);
MagentaSp->setSingleStep(51);
YellowSp->setSingleStep(51);
@@ -767,23 +767,23 @@
CyanP->setPixmap(sliderPix(0));
MagentaP->setPixmap(sliderPix(120));
YellowP->setPixmap(sliderPix(240));
+ ColorMap->isLabMode = false;
setValues();
- ColorMap->setEnabled(true);
}
else if (mod == tr("Lab"))
{
Wsave = false;
- CyanSL->setSingleStep(1);
- CyanSL->setPageStep(10);
- CyanSL->setMaximum( 100 );
- MagentaSL->setSingleStep(1);
- MagentaSL->setPageStep(10);
- MagentaSL->setMaximum( 128 );
- MagentaSL->setMinimum( -128 );
- YellowSL->setSingleStep(1);
- YellowSL->setPageStep(10);
- YellowSL->setMaximum( 128 );
- YellowSL->setMinimum( -128 );
+ CyanSL->setSingleStep(1 * 1000.0);
+ CyanSL->setPageStep(10 * 1000.0);
+ CyanSL->setMaximum( 100 * 1000.0 );
+ MagentaSL->setSingleStep(1 * 1000.0);
+ MagentaSL->setPageStep(10 * 1000.0);
+ MagentaSL->setMaximum( 128 * 1000.0 );
+ MagentaSL->setMinimum( -128 * 1000.0 );
+ YellowSL->setSingleStep(1 * 1000.0);
+ YellowSL->setPageStep(10 * 1000.0);
+ YellowSL->setMaximum( 128 * 1000.0 );
+ YellowSL->setMinimum( -128 * 1000.0 );
CyanSp->setDecimals(2);
CyanSp->setSingleStep(1);
@@ -817,7 +817,9 @@
MagentaP->setPixmap(sliderPix(120));
YellowP->setPixmap(sliderPix(240));
setValues();
- ColorMap->setEnabled(false);
+ ColorMap->isLabMode = true;
+ ColorMap->drawPalette(CyanSp->value() * 2.55);
+ ColorMap->setMark(MagentaSp->value(), YellowSp->value());
}
imageN.fill( ScColorEngine::getDisplayColor(Farbe, m_doc) );
if (ScColorEngine::isOutOfGamut(Farbe, m_doc))
@@ -863,6 +865,9 @@
BlackP->setPixmap(sliderBlack());
}
BlackComp = k;
+ ScColorEngine::getRGBColor(tmp, m_doc).getHsv(&h, &s, &v);
+ ColorMap->drawPalette(v);
+ ColorMap->setMark(h, s);
}
else if (Farbe.getColorModel() == colorModelRGB)
{
@@ -879,9 +884,9 @@
CyanSp->setValue(c);
MagentaSp->setValue(m);
YellowSp->setValue(y);
- CyanSL->setValue(c);
- MagentaSL->setValue(m);
- YellowSL->setValue(y);
+ CyanSL->setValue(c * 1000.0);
+ MagentaSL->setValue(m * 1000.0);
+ YellowSL->setValue(y * 1000.0);
blockSignals(false);
}
tmp.setColorRGB(c, m, y);
@@ -896,9 +901,14 @@
YellowP->setPixmap(sliderPix(240));
}
BlackComp = k;
+ ScColorEngine::getRGBColor(tmp, m_doc).getHsv(&h, &s, &v);
+ ColorMap->drawPalette(v);
+ ColorMap->setMark(h, s);
}
else if (Farbe.getColorModel() == colorModelLab)
{
+ double Lalt;
+ Farbe.getLab(&Lalt, &a, &b);
L = CyanSp->value();
a = MagentaSp->value();
b = YellowSp->value();
@@ -911,34 +921,36 @@
YellowP->setPixmap(sliderPix(240));
}
BlackComp = qRound(L * 2.55);
+ if (L != Lalt)
+ ColorMap->drawPalette(L * 2.55);
+ ColorMap->setMark(a, b);
}
imageN.fill(ScColorEngine::getDisplayColor(tmp, m_doc) );
if ( ScColorEngine::isOutOfGamut(tmp, m_doc) )
paintAlert(alertIcon, imageN, 2, 2, false);
- ScColorEngine::getRGBColor(tmp, m_doc).getHsv(&h, &s, &v);
- ColorMap->drawPalette(v);
- ColorMap->setMark(h, s);
NewC->setPixmap( imageN );
}
void CMYKChoose::setColor2(int h, int s, bool ende)
{
- QColor tm = QColor::fromHsv(qMax(qMin(359,h),0), qMax(qMin(255,255-s),0), 255-BlackComp, QColor::Hsv);
- int r, g, b;
- tm.getRgb(&r, &g, &b);
ScColor tmp;
- tmp.fromQColor(tm);
- if (Farbe.getColorModel() == colorModelCMYK)
- {
- CMYKColor cmyk;
- ScColorEngine::getCMYKValues(tmp, m_doc, cmyk);
- tmp.setColor(cmyk.c, cmyk.m, cmyk.y, cmyk.k);
- }
- else if (Farbe.getColorModel() == colorModelLab)
- {
- ScColorEngine::convertToModel(tmp, m_doc, colorModelLab);
- }
-
+ if (Farbe.getColorModel() == colorModelLab)
+ {
+ tmp = ScColor(CyanSp->value(), static_cast<double>(h), static_cast<double>(s));
+ }
+ else
+ {
+ QColor tm = QColor::fromHsv(qMax(qMin(359,h),0), qMax(qMin(255,255-s),0), 255-BlackComp, QColor::Hsv);
+ int r, g, b;
+ tm.getRgb(&r, &g, &b);
+ tmp.fromQColor(tm);
+ if (Farbe.getColorModel() == colorModelCMYK)
+ {
+ CMYKColor cmyk;
+ ScColorEngine::getCMYKValues(tmp, m_doc, cmyk);
+ tmp.setColor(cmyk.c, cmyk.m, cmyk.y, cmyk.k);
+ }
+ }
imageN.fill( ScColorEngine::getDisplayColor(tmp, m_doc) );
if ( ScColorEngine::isOutOfGamut(tmp, m_doc) )
paintAlert(alertIcon, imageN, 2, 2, false);
@@ -1000,13 +1012,13 @@
ScColorEngine::getCMYKValues(Farbe, m_doc, cmyk);
cmyk.getValues(cc, cm, cy, ck);
CyanSp->setValue(cc / 2.55);
- CyanSL->setValue(qRound(cc / 2.55));
+ CyanSL->setValue(qRound(cc / 2.55) * 1000.0);
MagentaSp->setValue(cm / 2.55);
- MagentaSL->setValue(qRound(cm / 2.55));
+ MagentaSL->setValue(qRound(cm / 2.55) * 1000.0);
YellowSp->setValue(cy / 2.55);
- YellowSL->setValue(qRound(cy / 2.55));
+ YellowSL->setValue(qRound(cy / 2.55) * 1000.0);
BlackSp->setValue(ck / 2.55);
- BlackSL->setValue(qRound(ck / 2.55));
+ BlackSL->setValue(qRound(ck / 2.55) * 1000.0);
if (dynamic)
{
CyanP->setPixmap(sliderPix(180));
@@ -1022,11 +1034,11 @@
ScColorEngine::getRGBValues(Farbe, m_doc, rgb);
rgb.getValues(r, g, b);
CyanSp->setValue(static_cast<double>(r));
- CyanSL->setValue(r);
+ CyanSL->setValue(r * 1000.0);
MagentaSp->setValue(static_cast<double>(g));
- MagentaSL->setValue(g);
+ MagentaSL->setValue(g * 1000.0);
YellowSp->setValue(static_cast<double>(b));
- YellowSL->setValue(b);
+ YellowSL->setValue(b * 1000.0);
int h, s, v;
ScColorEngine::getRGBColor(Farbe, m_doc).getHsv(&h, &s, &v);
BlackComp = 255 - v;
@@ -1042,11 +1054,17 @@
double L, a, b;
Farbe.getLab(&L, &a, &b);
CyanSp->setValue(L);
- CyanSL->setValue(L);
+ CyanSL->setValue(L * 1000.0);
MagentaSp->setValue(a);
- MagentaSL->setValue(a);
+ MagentaSL->setValue(a * 1000.0);
YellowSp->setValue(b);
- YellowSL->setValue(b);
+ YellowSL->setValue(b * 1000.0);
+ if (dynamic)
+ {
+ CyanP->setPixmap(sliderPix(0));
+ MagentaP->setPixmap(sliderPix(120));
+ YellowP->setPixmap(sliderPix(240));
+ }
}
CyanSp->blockSignals(false);
CyanSL->blockSignals(false);
Modified: trunk/Scribus/scribus/ui/colorchart.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20152&path=/trunk/Scribus/scribus/ui/colorchart.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/colorchart.cpp (original)
+++ trunk/Scribus/scribus/ui/colorchart.cpp Sun Jun 7 09:26:51 2015
@@ -24,6 +24,9 @@
#include "colorchart.h"
#include <QPainter>
#include "util_color.h"
+#include "util_icon.h"
+#include "sccolorengine.h"
+#include "scribuscore.h"
#include "scribusdoc.h"
ColorChart::ColorChart(QWidget *parent, ScribusDoc* doc) : QWidget(parent), m_doc(doc)
@@ -31,6 +34,7 @@
Xp = 0;
Yp = 0;
doDrawMark = false;
+ isLabMode = false;
setAutoFillBackground(false);
drawPalette(255);
}
@@ -38,19 +42,28 @@
void ColorChart::mouseMoveEvent(QMouseEvent *m)
{
drawMark(m->x(), m->y());
- emit ColorVal(m->x() * 359 / width(), m->y() * 255 / height(), true);
+ if (isLabMode)
+ emit ColorVal(m->x() * 256 / width() - 128, m->y() * 256 / height() - 128, true);
+ else
+ emit ColorVal(m->x() * 359 / width(), m->y() * 255 / height(), true);
}
void ColorChart::mousePressEvent(QMouseEvent *m)
{
drawMark(m->x(), m->y());
- emit ColorVal(m->x() * 359 / width(), m->y() * 255 / height(), true);
+ if (isLabMode)
+ emit ColorVal(m->x() * 256 / width() - 128, m->y() * 256 / height() - 128, true);
+ else
+ emit ColorVal(m->x() * 359 / width(), m->y() * 255 / height(), true);
}
void ColorChart::mouseReleaseEvent(QMouseEvent *m)
{
drawMark(m->x(), m->y());
- emit ColorVal(m->x() * 359 / width(), m->y() * 255 / height(), true);
+ if (isLabMode)
+ emit ColorVal(m->x() * 256 / width() - 128, m->y() * 256 / height() - 128, true);
+ else
+ emit ColorVal(m->x() * 359 / width(), m->y() * 255 / height(), true);
}
void ColorChart::paintEvent(QPaintEvent *e)
@@ -86,27 +99,70 @@
void ColorChart::setMark(int h, int s)
{
- drawMark(h * width() / 359, (255-s) * height() / 255);
+ if (isLabMode)
+ drawMark((h + 128) / 256.0 * width(), (s + 128) / 256.0 * height());
+ else
+ drawMark(h * width() / 359, (255-s) * height() / 255);
}
void ColorChart::drawPalette(int val)
{
int xSize = width();
int ySize = height();
- QImage image(xSize, ySize, QImage::Format_ARGB32_Premultiplied);
- QColor color;
- int x;
- int y;
- for (y = 0; y < ySize; ++y)
+ if (isLabMode)
{
- unsigned int* p = reinterpret_cast<unsigned int*>(image.scanLine(y));
- for(x = 0; x < xSize; ++x)
+ QImage image(256, 256, QImage::Format_ARGB32);
+ bool doSoftProofing = m_doc ? m_doc->SoftProofing : false;
+ bool doGamutCheck = m_doc ? m_doc->Gamut : false;
+ if (doSoftProofing && doGamutCheck)
{
- color.setHsv(360*x/xSize, 256*( ySize - 1 - y )/ySize, val);
- *p = color.rgb();
- ++p;
+ QPainter p;
+ QBrush b(QColor(205,205,205), loadIcon("testfill.png"));
+ p.begin(&image);
+ p.fillRect(0, 0, image.width(), image.height(), b);
+ p.end();
}
+ QColor color;
+ double L = val / 2.55;
+ for (int y = 0; y < 256; y++)
+ {
+ unsigned int* p = reinterpret_cast<unsigned int*>(image.scanLine(y));
+ for (int x = 0; x < 256; x++)
+ {
+ if (doSoftProofing && doGamutCheck)
+ {
+ bool outOfG = false;
+ color = ScColorEngine::getDisplayColorGC(ScColor(L, x - 128.0, y - 128.0), m_doc, &outOfG);
+ if (!outOfG)
+ *p = color.rgb();
+ }
+ else
+ {
+ color = ScColorEngine::getDisplayColor(ScColor(L, x - 128.0, y - 128.0), m_doc);
+ *p = color.rgb();
+ }
+ ++p;
+ }
+ }
+ pmx = QPixmap::fromImage(image.scaled(xSize, ySize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
}
- pmx=QPixmap::fromImage(ProofImage(&image, m_doc));
+ else
+ {
+ QImage image(xSize, ySize, QImage::Format_ARGB32_Premultiplied);
+ QColor color;
+ int x;
+ int y;
+ for (y = 0; y < ySize; ++y)
+ {
+ unsigned int* p = reinterpret_cast<unsigned int*>(image.scanLine(y));
+ for(x = 0; x < xSize; ++x)
+ {
+ color.setHsv(360*x/xSize, 256*( ySize - 1 - y )/ySize, val);
+ *p = color.rgb();
+ ++p;
+ }
+ }
+ pmx = QPixmap::fromImage(ProofImage(&image, m_doc));
+ }
repaint();
}
Modified: trunk/Scribus/scribus/ui/colorchart.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20152&path=/trunk/Scribus/scribus/ui/colorchart.h
==============================================================================
--- trunk/Scribus/scribus/ui/colorchart.h (original)
+++ trunk/Scribus/scribus/ui/colorchart.h Sun Jun 7 09:26:51 2015
@@ -54,6 +54,7 @@
int Xp;
int Yp;
bool doDrawMark;
+ bool isLabMode;
QPixmap pmx;
protected:
More information about the scribus-commit
mailing list