r14467 by jghali - refactor ScImage::LoadImage() method : - move color management related parameters to CMSettings argument - allow to load images using arbitrary rgb/cmyk output profile - change method name to match other case of other ScImage methods
scribus-commit
scribus-commit at lists.scribus.net
Mon Jan 4 23:41:14 CET 2010
Revision: 14467
Author: jghali
Date: 2010-01-04T09:49:29.955278Z
Commit message: refactor ScImage::LoadImage() method :
- move color management related parameters to CMSettings argument
- allow to load images using arbitrary rgb/cmyk output profile
- change method name to match other case of other ScImage methods
Changeset:
M /trunk/Scribus/scribus/pageitem.cpp
M /trunk/Scribus/scribus/ui/annot.cpp
M /trunk/Scribus/scribus/ui/preview.cpp
M /trunk/Scribus/scribus/plugins/picbrowser/imagedialog.cpp
M /trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp
M /trunk/Scribus/scribus/scpreview.cpp
M /trunk/Scribus/scribus/pdflib_core.cpp
M /trunk/Scribus/scribus/scimage.cpp
M /trunk/Scribus/scribus/pslib.cpp
M /trunk/Scribus/scribus/scpainterex_ps2.cpp
M /trunk/Scribus/scribus/ui/effectsdialog.cpp
M /trunk/Scribus/scribus/ui/customfdialog.cpp
M /trunk/Scribus/scribus/scimage.h
M /trunk/Scribus/scribus/ui/picsearch.cpp
M /trunk/Scribus/scribus/cmsettings.cpp
M /trunk/Scribus/scribus/plugins/picbrowser/loadimage.cpp
M /trunk/Scribus/scribus/scpageoutput.cpp
M /trunk/Scribus/scribus/scpainterexbase.h
M /trunk/Scribus/scribus/scimgdataloader_ps.cpp
M /trunk/Scribus/scribus/cmsettings.h
Diffs:
Index: scribus/pdflib_core.cpp
===================================================================
--- scribus/pdflib_core.cpp (revision 14466)
+++ scribus/pdflib_core.cpp (revision 14467)
@@ -516,7 +516,7 @@
tmpFile = QDir::convertSeparators(ScPaths::getTempFileDir() + "sc.jpg");
if ((gray) && (!precal))
image.convertToGray();
- if (image.Convert2JPG(tmpFile, quality, cmyk, gray))
+ if (image.convert2JPG(tmpFile, quality, cmyk, gray))
jpgFileName = tmpFile;
}
if (jpgFileName.isEmpty())
@@ -7640,7 +7640,8 @@
if (!ite->Pfile2.isEmpty())
{
CMSettings cms(ite->doc(), "", Intent_Perceptual);
- img.LoadPicture(ite->Pfile2, 1, cms, false, false, ScImage::RGBData, 72);
+ cms.allowColorManagement(false);
+ img.loadPicture(ite->Pfile2, 1, cms, ScImage::RGBData, 72);
QByteArray im;
img3.getAlpha(ite->Pfile2, 1, im, true, false);
IconOb += !im.isEmpty() ? 3 : 2;
@@ -7651,7 +7652,8 @@
if (!ite->Pfile3.isEmpty())
{
CMSettings cms(ite->doc(), "", Intent_Perceptual);
- img2.LoadPicture(ite->Pfile3, 1, cms, false, false, ScImage::RGBData, 72);
+ cms.allowColorManagement(false);
+ img2.loadPicture(ite->Pfile3, 1, cms, ScImage::RGBData, 72);
QByteArray im;
img3.getAlpha(ite->Pfile3, 1, im, true, false);
IconOb += !im.isEmpty() ? 3 : 2;
@@ -8543,18 +8545,19 @@
if (ext == "pdf")
{
CMSettings cms(c->doc(), Profil, Intent);
+ cms.setUseEmbeddedProfile(Embedded);
if (Options.UseRGB)
- imageLoaded = img.LoadPicture(fn, c->pixm.imgInfo.actualPageNumber, cms, Embedded, true, ScImage::RGBData, afl);
+ imageLoaded = img.loadPicture(fn, c->pixm.imgInfo.actualPageNumber, cms, ScImage::RGBData, afl);
else
{
if ((doc.HasCMS) && (Options.UseProfiles2))
- imageLoaded = img.LoadPicture(fn, c->pixm.imgInfo.actualPageNumber, cms, Embedded, true, ScImage::RGBData, afl);
+ imageLoaded = img.loadPicture(fn, c->pixm.imgInfo.actualPageNumber, cms, ScImage::RGBData, afl);
else
{
if (Options.isGrayscale)
- imageLoaded = img.LoadPicture(fn, c->pixm.imgInfo.actualPageNumber, cms, Embedded, true, ScImage::RGBData, afl);
+ imageLoaded = img.loadPicture(fn, c->pixm.imgInfo.actualPageNumber, cms, ScImage::RGBData, afl);
else
- imageLoaded = img.LoadPicture(fn, c->pixm.imgInfo.actualPageNumber, cms, Embedded, true, ScImage::CMYKData, afl);
+ imageLoaded = img.loadPicture(fn, c->pixm.imgInfo.actualPageNumber, cms, ScImage::CMYKData, afl);
}
}
}
@@ -8587,18 +8590,19 @@
if (found)
{
CMSettings cms(c->doc(), Profil, Intent);
+ cms.setUseEmbeddedProfile(Embedded);
if (Options.UseRGB)
- imageLoaded = img.LoadPicture(fn, c->pixm.imgInfo.actualPageNumber, cms, Embedded, true, ScImage::RGBData, afl);
+ imageLoaded = img.loadPicture(fn, c->pixm.imgInfo.actualPageNumber, cms, ScImage::RGBData, afl);
else
{
if ((doc.HasCMS) && (Options.UseProfiles2))
- imageLoaded = img.LoadPicture(fn, c->pixm.imgInfo.actualPageNumber, cms, Embedded, true, ScImage::RGBData, afl);
+ imageLoaded = img.loadPicture(fn, c->pixm.imgInfo.actualPageNumber, cms, ScImage::RGBData, afl);
else
{
if (Options.isGrayscale)
- imageLoaded = img.LoadPicture(fn, c->pixm.imgInfo.actualPageNumber, cms, Embedded, true, ScImage::RGBData, afl);
+ imageLoaded = img.loadPicture(fn, c->pixm.imgInfo.actualPageNumber, cms, ScImage::RGBData, afl);
else
- imageLoaded = img.LoadPicture(fn, c->pixm.imgInfo.actualPageNumber, cms, Embedded, true, ScImage::CMYKData, afl);
+ imageLoaded = img.loadPicture(fn, c->pixm.imgInfo.actualPageNumber, cms, ScImage::CMYKData, afl);
}
}
}
@@ -8625,18 +8629,19 @@
img.imgInfo.RequestProps = c->pixm.imgInfo.RequestProps;
img.imgInfo.isRequest = c->pixm.imgInfo.isRequest;
CMSettings cms(c->doc(), Profil, Intent);
+ cms.setUseEmbeddedProfile(Embedded);
if (Options.UseRGB)
- imageLoaded = img.LoadPicture(fn, c->pixm.imgInfo.actualPageNumber, cms, Embedded, true, ScImage::RGBData, 72, &realCMYK);
+ imageLoaded = img.loadPicture(fn, c->pixm.imgInfo.actualPageNumber, cms, ScImage::RGBData, 72, &realCMYK);
else
{
if ((doc.HasCMS) && (Options.UseProfiles2))
- imageLoaded = img.LoadPicture(fn, c->pixm.imgInfo.actualPageNumber, cms, Embedded, true, ScImage::RawData, 72, &realCMYK);
+ imageLoaded = img.loadPicture(fn, c->pixm.imgInfo.actualPageNumber, cms, ScImage::RawData, 72, &realCMYK);
else
{
if (Options.isGrayscale)
- imageLoaded = img.LoadPicture(fn, c->pixm.imgInfo.actualPageNumber, cms, Embedded, true, ScImage::RGBData, 72, &realCMYK);
+ imageLoaded = img.loadPicture(fn, c->pixm.imgInfo.actualPageNumber, cms, ScImage::RGBData, 72, &realCMYK);
else
- imageLoaded = img.LoadPicture(fn, c->pixm.imgInfo.actualPageNumber, cms, Embedded, true, ScImage::CMYKData, 72, &realCMYK);
+ imageLoaded = img.loadPicture(fn, c->pixm.imgInfo.actualPageNumber, cms, ScImage::CMYKData, 72, &realCMYK);
}
}
if (!imageLoaded)
Index: scribus/scpainterex_ps2.cpp
===================================================================
--- scribus/scpainterex_ps2.cpp (revision 14466)
+++ scribus/scpainterex_ps2.cpp (revision 14467)
@@ -540,7 +540,7 @@
void ScPainterEx_Ps2::drawImage( ScImage *image, ScPainterExBase::ImageMode mode )
{
- bool rgbMode = (mode == ScPainterExBase::rgbImages || mode == ScPainterExBase::rgbProofImages);
+ bool rgbMode = (mode == ScPainterExBase::rgbImages);
bool rgbPicture = rgbMode || (mode == ScPainterExBase::rawImages && image->imgInfo.colorspace == ColorSpaceRGB);
bool cmykPicture = (mode == ScPainterExBase::cmykImages || (mode == ScPainterExBase::rawImages && image->imgInfo.colorspace == ColorSpaceCMYK));
Index: scribus/scimage.h
===================================================================
--- scribus/scimage.h (revision 14466)
+++ scribus/scimage.h (revision 14467)
@@ -44,8 +44,8 @@
{
CMYKData = 0,
RGBData = 1,
- RGBProof = 2,
- RawData = 3,
+ RawData = 2,
+ OutputProfile = 3,
Thumbnail = 4,
};
@@ -88,7 +88,7 @@
bool writePSImageToFilter(ScStreamFilter* filter, const QByteArray& mask, int pl);
bool getAlpha(QString fn, int page, QByteArray& alpha, bool PDF, bool pdf14, int gsRes = 72, int scaleXSize = 0, int scaleYSize = 0);
- bool Convert2JPG(QString fn, int Quality, bool isCMYK, bool isGray);
+ bool convert2JPG(QString fn, int Quality, bool isCMYK, bool isGray);
// Image effects
void applyEffect(const ScImageEffectList& effectsList, ColorList& colors, bool cmyk);
@@ -105,7 +105,7 @@
// Load an image into this ScImage instance
// TODO: document params, split into smaller functions
- bool LoadPicture(const QString & fn, int page, const CMSettings& cmSettings, bool useEmbedded, bool useProf, RequestType requestType, int gsRes, bool *realCMYK = 0, bool showMsg = false);
+ bool loadPicture(const QString & fn, int page, const CMSettings& cmSettings, RequestType requestType, int gsRes, bool *realCMYK = 0, bool showMsg = false);
ImageInfoRecord imgInfo;
Index: scribus/scimgdataloader_ps.cpp
===================================================================
--- scribus/scimgdataloader_ps.cpp (revision 14466)
+++ scribus/scimgdataloader_ps.cpp (revision 14467)
@@ -180,8 +180,9 @@
imgc.resize(0);
ScImage thum;
CMSettings cms(0, "", Intent_Perceptual);
+ cms.allowColorManagement(false);
bool mode = true;
- if (thum.LoadPicture(tmpFile, 1, cms, false, false, ScImage::RGBData, 72, &mode))
+ if (thum.loadPicture(tmpFile, 1, cms, ScImage::RGBData, 72, &mode))
{
m_imageInfoRecord.exifDataValid = true;
m_imageInfoRecord.exifInfo.thumbnail = thum.qImage().copy();
Index: scribus/cmsettings.cpp
===================================================================
--- scribus/cmsettings.cpp (revision 14466)
+++ scribus/cmsettings.cpp (revision 14467)
@@ -29,6 +29,9 @@
CMSettings::CMSettings(ScribusDoc* doc, const QString& profileName, eRenderIntent intent) :
m_Doc(doc),
+m_colorManagementAllowed(true),
+m_softProofingAllowed(false),
+m_useEmbeddedProfile(false),
m_ProfileName(profileName),
m_Intent(intent)
{
@@ -41,7 +44,7 @@
bool CMSettings::useColorManagement() const
{
if (m_Doc)
- return m_Doc->HasCMS;
+ return (m_Doc->HasCMS && m_colorManagementAllowed);
return false;
}
@@ -111,14 +114,14 @@
bool CMSettings::doSoftProofing() const
{
if (m_Doc)
- return m_Doc->CMSSettings.SoftProofOn;
+ return (m_Doc->CMSSettings.SoftProofOn && m_softProofingAllowed);
return false;
}
bool CMSettings::doGamutCheck() const
{
if (m_Doc)
- return m_Doc->CMSSettings.GamutCheck;
+ return (m_Doc->CMSSettings.GamutCheck && m_softProofingAllowed);
return false;
}
@@ -136,6 +139,11 @@
return ScColorProfile();
}
+ScColorProfile CMSettings::outputProfile() const
+{
+ return m_outputProfile;
+}
+
ScColorTransform CMSettings::rgbColorDisplayTransform() const // stdTransRGBMonG
{
if (m_Doc)
Index: scribus/scpageoutput.cpp
===================================================================
--- scribus/scpageoutput.cpp (revision 14466)
+++ scribus/scpageoutput.cpp (revision 14467)
@@ -76,8 +76,6 @@
value = ScImage::CMYKData;
else if ( mode == ScPainterExBase::rgbImages )
value = ScImage::RGBData;
- else if ( mode == ScPainterExBase::rgbProofImages )
- value = ScImage::RGBProof;
else if ( mode == ScPainterExBase::rawImages )
value = ScImage::RawData;
return value;
@@ -903,13 +901,15 @@
QFileInfo fInfo(item->Pfile);
QString ext = fInfo.suffix();
CMSettings cmsSettings(item->doc(), item->IProfile, item->IRender);
+ cmsSettings.allowColorManagement(m_useProfiles);
+ cmsSettings.setUseEmbeddedProfile(item->UseEmbedded);
scImg.imgInfo.valid = false;
scImg.imgInfo.clipPath = "";
scImg.imgInfo.PDSpathData.clear();
scImg.imgInfo.layerInfo.clear();
scImg.imgInfo.RequestProps = item->pixm.imgInfo.RequestProps;
scImg.imgInfo.isRequest = item->pixm.imgInfo.isRequest;
- scImg.LoadPicture(item->Pfile, item->pixm.imgInfo.actualPageNumber, cmsSettings, item->UseEmbedded, m_useProfiles, translateImageModeToRequest(imageMode), m_imageRes, &dummy);
+ scImg.loadPicture(item->Pfile, item->pixm.imgInfo.actualPageNumber, cmsSettings, translateImageModeToRequest(imageMode), m_imageRes, &dummy);
if( extensionIndicatesEPSorPS(ext) || extensionIndicatesPDF(ext) )
{
imScaleX *= (72.0 / (double) m_imageRes);
Index: scribus/pageitem.cpp
===================================================================
--- scribus/pageitem.cpp (revision 14466)
+++ scribus/pageitem.cpp (revision 14467)
@@ -5286,7 +5286,9 @@
gsRes=PrefsManager::instance()->gsResolution();
bool dummy;
CMSettings cms(m_Doc, IProfile, IRender);
- if (!pixm.LoadPicture(filename, pixm.imgInfo.actualPageNumber, cms, UseEmbedded, true, ScImage::RGBProof, gsRes, &dummy, showMsg))
+ cms.setUseEmbeddedProfile(UseEmbedded);
+ cms.allowSoftProofing(true);
+ if (!pixm.loadPicture(filename, pixm.imgInfo.actualPageNumber, cms, ScImage::RGBData, gsRes, &dummy, showMsg))
{
Pfile = fi.absoluteFilePath();
PictureIsAvailable = false;
Index: scribus/scimage.cpp
===================================================================
--- scribus/scimage.cpp (revision 14466)
+++ scribus/scimage.cpp (revision 14467)
@@ -1195,7 +1195,7 @@
QImage::operator=(tmp);
}
-bool ScImage::Convert2JPG(QString fn, int Quality, bool isCMYK, bool isGray)
+bool ScImage::convert2JPG(QString fn, int Quality, bool isCMYK, bool isGray)
{
struct jpeg_compress_struct cinfo;
struct my_error_mgr jerr;
@@ -1788,7 +1788,6 @@
if (!fi.exists())
return false;
alpha.resize(0);
- QString tmp, BBox, tmp2;
QString ext = fi.suffix().toLower();
QList<QByteArray> fmtList = QImageReader::supportedImageFormats();
QStringList fmtImg;
@@ -1960,16 +1959,14 @@
}
}
-bool ScImage::LoadPicture(const QString & fn, int page, const CMSettings& cmSettings,
- bool useEmbedded, bool useProf, RequestType requestType,
- int gsRes, bool *realCMYK, bool showMsg)
+bool ScImage::loadPicture(const QString & fn, int page, const CMSettings& cmSettings,
+ RequestType requestType, int gsRes, bool *realCMYK, bool showMsg)
{
- // requestType - 0: CMYK, 1: RGB, 2: RGB Proof 3 : RawData, 4: Thumbnail
+ // requestType - 0: CMYK, 1: RGB, 3 : RawData, 4: Thumbnail
// gsRes - is the resolution that ghostscript will render at
bool isCMYK = false;
bool ret = false;
- bool inputProfisEmbedded = false;
- bool stdProof = false;
+ bool inputProfIsEmbedded = false;
if (realCMYK != 0)
*realCMYK = false;
bool bilevel = false;
@@ -1982,8 +1979,6 @@
if (!fi.exists())
return ret;
QString ext = fi.suffix().toLower();
- QString tmp, dummy, cmd1, cmd2, BBox, tmp2;
- QChar tc;
QString profileName = "";
bool hasEmbeddedProfile = false;
QList<QByteArray> fmtList = QImageReader::supportedImageFormats();
@@ -1996,6 +1991,19 @@
}
// bool found = false;
+ // Do some basic checks when requestType is OutputProfile
+ if (requestType == OutputProfile)
+ {
+ if (!cmSettings.useColorManagement())
+ return false;
+ ScColorProfile prof = cmSettings.outputProfile();
+ if (prof.isNull())
+ return false;
+ icColorSpaceSignature cspace = prof.colorSpace();
+ if (cspace != icSigRgbData && cspace != icSigCmykData)
+ return false;
+ }
+
if (ext.isEmpty())
ext = getImageType(fn);
@@ -2076,12 +2084,12 @@
}
QByteArray embeddedProfile = pDataLoader->embeddedProfile();
- if (cmSettings.useColorManagement() && useProf)
+ if (cmSettings.useColorManagement())
{
- if ((embeddedProfile.size() > 0 ) && (useEmbedded))
+ if ((embeddedProfile.size() > 0 ) && (cmSettings.useEmbeddedProfile()))
{
inputProf = cmSettings.doc()->colorEngine.openProfileFromMem(embeddedProfile);
- inputProfisEmbedded = true;
+ inputProfIsEmbedded = true;
}
else
{
@@ -2093,7 +2101,7 @@
if (ScCore->InputProfilesCMYK.contains(cmSettings.profileName()) && (cmSettings.profileName() != cmSettings.doc()->CMSSettings.DefaultImageCMYKProfile))
{
imgInfo.profileName = cmSettings.profileName();
- inputProfisEmbedded = true;
+ inputProfIsEmbedded = true;
profilePath = ScCore->InputProfilesCMYK[imgInfo.profileName];
inputProf = cmSettings.doc()->colorEngine.openProfileFromFile(profilePath);
}
@@ -2101,7 +2109,7 @@
{
inputProf = cmSettings.doc()->DocInputImageCMYKProf;
imgInfo.profileName = cmSettings.doc()->CMSSettings.DefaultImageCMYKProfile;
- inputProfisEmbedded = false;
+ inputProfIsEmbedded = false;
}
}
else
@@ -2110,32 +2118,32 @@
{
imgInfo.profileName = cmSettings.profileName();
profilePath = ScCore->InputProfiles[imgInfo.profileName];
- inputProfisEmbedded = true;
+ inputProfIsEmbedded = true;
inputProf = cmSettings.doc()->colorEngine.openProfileFromFile(profilePath);
}
else
{
inputProf = cmSettings.doc()->DocInputImageRGBProf;
imgInfo.profileName = cmSettings.doc()->CMSSettings.DefaultImageRGBProfile;
- inputProfisEmbedded = false;
+ inputProfIsEmbedded = false;
}
}
}
}
- else if ((useProf && embeddedProfile.size() > 0) && (useEmbedded))
+ else if ((cmSettings.useColorManagement() && embeddedProfile.size() > 0) && (cmSettings.useEmbeddedProfile()))
{
inputProf = cmSettings.doc()->colorEngine.openProfileFromMem(embeddedProfile);
- inputProfisEmbedded = true;
+ inputProfIsEmbedded = true;
}
- else if (useProf && isCMYK)
+ else if (cmSettings.useColorManagement() && isCMYK)
inputProf = ScCore->defaultCMYKProfile;
- else if (useProf && bilevel && (reqType == CMYKData))
+ else if (cmSettings.useColorManagement() && bilevel && (reqType == CMYKData))
inputProf = NULL; // Workaround to map directly gray to K channel
- else if (useProf)
+ else if (cmSettings.useColorManagement())
inputProf = ScCore->defaultRGBProfile;
ScColorProfile screenProf = cmSettings.monitorProfile() ? cmSettings.monitorProfile() : ScCore->defaultRGBProfile;
ScColorProfile printerProf = cmSettings.printerProfile() ? cmSettings.printerProfile() : ScCore->defaultCMYKProfile;
- if (useProf && inputProf && screenProf && printerProf)
+ if (cmSettings.useColorManagement() && inputProf && screenProf && printerProf)
{
ScColorMngtEngine engine(cmSettings.doc() ? cmSettings.doc()->colorEngine : ScCore->defaultEngine);
bool isPsdTiff = (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext));
@@ -2180,7 +2188,22 @@
break;
case Thumbnail:
case RGBData: // RGB
- if (isCMYK)
+ if (cmSettings.useColorManagement() && cmSettings.doSoftProofing())
+ {
+ if ((imgInfo.profileName == cmSettings.defaultImageRGBProfile()) || (imgInfo.profileName == cmSettings.defaultImageCMYKProfile()))
+ {
+ if (isCMYK)
+ xform = cmSettings.cmykImageProofingTransform();
+ else
+ xform = cmSettings.rgbImageProofingTransform();
+ xform.changeBufferFormat(inputProfFormat, Format_BGRA_8);
+ }
+ else
+ xform = engine.createProofingTransform(inputProf, inputProfFormat,
+ screenProf, Format_BGRA_8, printerProf,
+ cmSettings.intent(), Intent_Relative_Colorimetric, cmsFlags | cmsProofFlags);
+ }
+ else if (cmSettings.softProofingAllowed() || isCMYK)
xform = engine.createTransform(inputProf, inputProfFormat, screenProf, Format_BGRA_8, cmSettings.intent(), cmsFlags);
else
{
@@ -2196,30 +2219,8 @@
// imgInfo = pDataLoader->imageInfoRecord();
}
}
+ outputProfColorSpace = icSigRgbData;
break;
- case RGBProof: // RGB Proof
- {
- if (cmSettings.useColorManagement() && cmSettings.doSoftProofing())
- {
- if ((imgInfo.profileName == cmSettings.defaultImageRGBProfile()) || (imgInfo.profileName == cmSettings.defaultImageCMYKProfile()))
- {
- if (isCMYK)
- xform = cmSettings.cmykImageProofingTransform();
- else
- xform = cmSettings.rgbImageProofingTransform();
- xform.changeBufferFormat(inputProfFormat, Format_BGRA_8);
- stdProof = true;
- }
- else
- xform = engine.createProofingTransform(inputProf, inputProfFormat,
- screenProf, Format_BGRA_8, printerProf,
- cmSettings.intent(), Intent_Relative_Colorimetric, cmsFlags | cmsProofFlags);
- }
- else
- xform = engine.createTransform(inputProf, inputProfFormat, screenProf,
- Format_BGRA_8, cmSettings.intent(), cmsFlags);
- }
- break;
case RawData: // no Conversion just raw Data
xform = 0;
if (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext) || pDataLoader->useRawImage())
@@ -2234,6 +2235,18 @@
// imgInfo = pDataLoader->imageInfoRecord();
}
break;
+ case OutputProfile: // CMYK
+ ScColorProfile outputProfile = cmSettings.outputProfile();
+ outputProfColorSpace = static_cast<int>(outputProfile.colorSpace());
+ if ( outputProfColorSpace == icSigRgbData )
+ outputProfFormat = Format_BGRA_8;
+ else if ( outputProfColorSpace == icSigCmykData )
+ outputProfFormat = Format_YMCK_8;
+ xform = engine.createTransform(inputProf, inputProfFormat, outputProfile, outputProfFormat, cmSettings.imageRenderingIntent(), cmsFlags);
+ isCMYK = (outputProfColorSpace == icSigCmykData);
+ if (realCMYK)
+ *realCMYK = isCMYK;
+ break;
}
if (xform)
{
@@ -2254,7 +2267,7 @@
uchar* ptr = scanLine(i);
if (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext) || pDataLoader->useRawImage())
ptr2 = pDataLoader->r_image.scanLine(i);
- if ( inputProfFormat == Format_GRAY_8 && (reqType != CMYKData) )
+ if ( inputProfFormat == Format_GRAY_8 && (outputProfColorSpace != icSigCmykData) )
{
unsigned char* ucs = ptr2 ? (ptr2 + 1) : (ptr + 1);
unsigned char* uc = new unsigned char[width()];
@@ -2266,7 +2279,7 @@
xform.apply(uc, ptr, width());
delete[] uc;
}
- else if ( inputProfFormat == Format_GRAY_8 && (reqType == CMYKData) )
+ else if ( inputProfFormat == Format_GRAY_8 && (outputProfColorSpace == icSigCmykData) )
{
unsigned char value;
unsigned char* ucs = ptr2 ? ptr2 : ptr;
@@ -2294,7 +2307,7 @@
{
QRgb alphaFF = qRgba(0,0,0,255);
QRgb *p;
- if (isCMYK && reqType != CMYKData && !bilevel)
+ if (isCMYK && outputProfColorSpace != icSigCmykData && !bilevel)
{
p = (QRgb *) ptr;
for (int j = 0; j < width(); j++, p++)
@@ -2304,7 +2317,7 @@
else
{
// This might fix Bug #6328, please test.
- if (reqType != CMYKData && bilevel)
+ if (outputProfColorSpace != icSigCmykData && bilevel)
{
QRgb alphaFF;
QRgb *p;
@@ -2316,7 +2329,7 @@
ptr2 += 4;
}
}
- if (reqType != CMYKData && !bilevel)
+ if (outputProfColorSpace != icSigCmykData && !bilevel)
{
if (pDataLoader->r_image.channels() == 5)
{
@@ -2397,7 +2410,6 @@
}
break;
case RGBData:
- case RGBProof:
case Thumbnail:
if (isCMYK)
{
@@ -2446,17 +2458,17 @@
}
break;
case RawData:
- if (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext) || pDataLoader->useRawImage())
- {
- QImage::operator=(pDataLoader->r_image.convertToQImage(true, true));
- profileName = imgInfo.profileName;
- hasEmbeddedProfile = imgInfo.isEmbedded;
- imgInfo = pDataLoader->imageInfoRecord();
- imgInfo.profileName = profileName;
- imgInfo.isEmbedded = hasEmbeddedProfile;
- // JG : this line overwrite image profile info and should not be needed here!!!!
- // imgInfo = pDataLoader->imageInfoRecord();
- }
+ if (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext) || pDataLoader->useRawImage())
+ {
+ QImage::operator=(pDataLoader->r_image.convertToQImage(true, true));
+ profileName = imgInfo.profileName;
+ hasEmbeddedProfile = imgInfo.isEmbedded;
+ imgInfo = pDataLoader->imageInfoRecord();
+ imgInfo.profileName = profileName;
+ imgInfo.isEmbedded = hasEmbeddedProfile;
+ // JG : this line overwrite image profile info and should not be needed here!!!!
+ // imgInfo = pDataLoader->imageInfoRecord();
+ }
break;
}
}
@@ -2464,7 +2476,7 @@
// setAlphaBuffer(false);
setDotsPerMeterX (qMax(2834, (int) (imgInfo.xres / 0.0254)));
setDotsPerMeterY (qMax(2834, (int) (imgInfo.yres / 0.0254)));
- if (imgInfo.isEmbedded && useEmbedded)
+ if (imgInfo.isEmbedded && cmSettings.useEmbeddedProfile())
imgInfo.isEmbedded = true;
else
imgInfo.isEmbedded = false;
Index: scribus/ui/customfdialog.cpp
===================================================================
--- scribus/ui/customfdialog.cpp (revision 14466)
+++ scribus/ui/customfdialog.cpp (revision 14467)
@@ -147,7 +147,8 @@
ScImage im;
//No doc to send data anyway, so no doc to get into scimage.
CMSettings cms(0, "", Intent_Perceptual);
- if (im.LoadPicture(name, 1, cms, false, false, ScImage::Thumbnail, 72, &mode))
+ cms.allowColorManagement(false);
+ if (im.loadPicture(name, 1, cms, ScImage::Thumbnail, 72, &mode))
{
int ix,iy;
if ((im.imgInfo.exifDataValid) && (!im.imgInfo.exifInfo.thumbnail.isNull()))
Index: scribus/ui/preview.cpp
===================================================================
--- scribus/ui/preview.cpp (revision 14466)
+++ scribus/ui/preview.cpp (revision 14467)
@@ -934,12 +934,13 @@
}
}
CMSettings cms(doc, "", Intent_Perceptual);
+ cms.allowColorManagement(false);
if (flagsVisible["Cyan"]->isChecked())
{
if (GsMinor < 54)
- loaderror = im.LoadPicture(ScPaths::getTempFileDir()+"/sc.tif.Cyan.tif", 1, cms, false, false, ScImage::RGBData, 72, &mode);
+ loaderror = im.loadPicture(ScPaths::getTempFileDir()+"/sc.tif.Cyan.tif", 1, cms, ScImage::RGBData, 72, &mode);
else
- loaderror = im.LoadPicture(ScPaths::getTempFileDir()+"/sc.Cyan.tif", 1, cms, false, false, ScImage::RGBData, 72, &mode);
+ loaderror = im.loadPicture(ScPaths::getTempFileDir()+"/sc.Cyan.tif", 1, cms, ScImage::RGBData, 72, &mode);
if (!loaderror)
{
imageLoadError(Bild, Seite);
@@ -953,9 +954,9 @@
if (flagsVisible["Magenta"]->isChecked())
{
if (GsMinor < 54)
- loaderror = im.LoadPicture(ScPaths::getTempFileDir()+"/sc.tif.Magenta.tif", 1, cms, false, false, ScImage::RGBData, 72, &mode);
+ loaderror = im.loadPicture(ScPaths::getTempFileDir()+"/sc.tif.Magenta.tif", 1, cms, ScImage::RGBData, 72, &mode);
else
- loaderror = im.LoadPicture(ScPaths::getTempFileDir()+"/sc.Magenta.tif", 1, cms, false, false, ScImage::RGBData, 72, &mode);
+ loaderror = im.loadPicture(ScPaths::getTempFileDir()+"/sc.Magenta.tif", 1, cms, ScImage::RGBData, 72, &mode);
if (!loaderror)
{
imageLoadError(Bild, Seite);
@@ -969,9 +970,9 @@
if (flagsVisible["Yellow"]->isChecked())
{
if (GsMinor < 54)
- loaderror = im.LoadPicture(ScPaths::getTempFileDir()+"/sc.tif.Yellow.tif", 1, cms, false, false, ScImage::RGBData, 72, &mode);
+ loaderror = im.loadPicture(ScPaths::getTempFileDir()+"/sc.tif.Yellow.tif", 1, cms, ScImage::RGBData, 72, &mode);
else
- loaderror = im.LoadPicture(ScPaths::getTempFileDir()+"/sc.Yellow.tif", 1, cms, false, false, ScImage::RGBData, 72, &mode);
+ loaderror = im.loadPicture(ScPaths::getTempFileDir()+"/sc.Yellow.tif", 1, cms, ScImage::RGBData, 72, &mode);
if (!loaderror)
{
imageLoadError(Bild, Seite);
@@ -995,7 +996,7 @@
fnam = QString(ScPaths::getTempFileDir()+"/sc.tif.s%1.tif").arg(sepit.value());
else
fnam = QString(ScPaths::getTempFileDir()+"/sc.s%1.tif").arg(sepit.value());
- if (!im.LoadPicture(fnam, 1, cms, false, false, ScImage::RGBData, 72, &mode))
+ if (!im.loadPicture(fnam, 1, cms, ScImage::RGBData, 72, &mode))
{
imageLoadError(Bild, Seite);
return Bild;
@@ -1010,10 +1011,11 @@
if (flagsVisible["Black"]->isChecked())
{
CMSettings cms(doc, "", Intent_Perceptual);
+ cms.allowColorManagement(false);
if (GsMinor < 54)
- loaderror = im.LoadPicture(ScPaths::getTempFileDir()+"/sc.tif.Black.tif", 1, cms, false, false, ScImage::RGBData, 72, &mode);
+ loaderror = im.loadPicture(ScPaths::getTempFileDir()+"/sc.tif.Black.tif", 1, cms, ScImage::RGBData, 72, &mode);
else
- loaderror = im.LoadPicture(ScPaths::getTempFileDir()+"/sc.Black.tif", 1, cms, false, false, ScImage::RGBData, 72, &mode);
+ loaderror = im.loadPicture(ScPaths::getTempFileDir()+"/sc.Black.tif", 1, cms, ScImage::RGBData, 72, &mode);
if (!loaderror)
{
imageLoadError(Bild, Seite);
Index: scribus/ui/effectsdialog.cpp
===================================================================
--- scribus/ui/effectsdialog.cpp (revision 14466)
+++ scribus/ui/effectsdialog.cpp (revision 14467)
@@ -50,7 +50,8 @@
currentOptions = 0;
bool mode = false;
CMSettings cms(docc, "", Intent_Perceptual);
- image.LoadPicture(currItem->Pfile, currItem->pixm.imgInfo.actualPageNumber, cms, false, false, ScImage::RGBData, 72, &mode);
+ cms.allowColorManagement(false);
+ image.loadPicture(currItem->Pfile, currItem->pixm.imgInfo.actualPageNumber, cms, ScImage::RGBData, 72, &mode);
int ix = image.width();
int iy = image.height();
imageScale = 1.0;
Index: scribus/ui/annot.cpp
===================================================================
--- scribus/ui/annot.cpp (revision 14466)
+++ scribus/ui/annot.cpp (revision 14467)
@@ -386,23 +386,24 @@
QPixmap pmI1;
ScImage im;
CMSettings cms(view->Doc, "", Intent_Perceptual);
+ cms.allowColorManagement(false);
if (!item->Pfile.isEmpty())
{
- im.LoadPicture(item->Pfile, 1, cms, false, false, ScImage::RGBData, 72);
+ im.loadPicture(item->Pfile, 1, cms, ScImage::RGBData, 72);
pmI1=QPixmap::fromImage(im.qImage());
NiconPrev->setPixmap(pmI1);
IconNR->setEnabled(true);
}
if (!item->Pfile2.isEmpty())
{
- im.LoadPicture(item->Pfile2, 1, cms, false, false, ScImage::RGBData, 72);
+ im.loadPicture(item->Pfile2, 1, cms, ScImage::RGBData, 72);
pmI1=QPixmap::fromImage(im.qImage());
PiconPrev->setPixmap(pmI1);
IconPR->setEnabled(true);
}
if (!item->Pfile3.isEmpty())
{
- im.LoadPicture(item->Pfile3, 1, cms, false, false, ScImage::RGBData, 72);
+ im.loadPicture(item->Pfile3, 1, cms, ScImage::RGBData, 72);
pmI1=QPixmap::fromImage(im.qImage());
RiconPrev->setPixmap(pmI1);
IconRR->setEnabled(true);
@@ -1310,7 +1311,8 @@
dirs->set("icon", fileName.left(fileName.lastIndexOf("/")));
QPixmap pmI1;
CMSettings cms(view->Doc, "", Intent_Perceptual);
- item->pixm.LoadPicture(fileName, 1, cms, false, false, ScImage::RGBData, 72);
+ cms.allowColorManagement(false);
+ item->pixm.loadPicture(fileName, 1, cms, ScImage::RGBData, 72);
pmI1=QPixmap::fromImage(item->pixm.qImage());
NiconPrev->setPixmap(pmI1);
item->Pfile = fileName;
@@ -1342,7 +1344,8 @@
QPixmap pmI1;
ScImage im;
CMSettings cms(view->Doc, "", Intent_Perceptual);
- im.LoadPicture(fileName, 1, cms, false, false, ScImage::RGBData, 72);
+ cms.allowColorManagement(false);
+ im.loadPicture(fileName, 1, cms, ScImage::RGBData, 72);
pmI1=QPixmap::fromImage(im.qImage());
PiconPrev->setPixmap(pmI1);
item->Pfile2 = fileName;
@@ -1366,7 +1369,8 @@
QPixmap pmI1;
ScImage im;
CMSettings cms(view->Doc, "", Intent_Perceptual);
- im.LoadPicture(fileName, 1, cms, false, false, ScImage::RGBData, 72);
+ cms.allowColorManagement(false);
+ im.loadPicture(fileName, 1, cms, ScImage::RGBData, 72);
pmI1=QPixmap::fromImage(im.qImage());
RiconPrev->setPixmap(pmI1);
item->Pfile3 = fileName;
Index: scribus/ui/picsearch.cpp
===================================================================
--- scribus/ui/picsearch.cpp (revision 14466)
+++ scribus/ui/picsearch.cpp (revision 14467)
@@ -72,7 +72,8 @@
ScImage im;
//No doc to send data anyway, so no doc to get into scimage.
CMSettings cms(0, "", Intent_Perceptual);
- if (im.LoadPicture(currentImage, 1, cms, false, false, ScImage::Thumbnail, 72, &mode))
+ cms.allowColorManagement(false);
+ if (im.loadPicture(currentImage, 1, cms, ScImage::Thumbnail, 72, &mode))
{
int ix,iy;
if ((im.imgInfo.exifDataValid) && (!im.imgInfo.exifInfo.thumbnail.isNull()))
Index: scribus/plugins/picbrowser/imagedialog.cpp
===================================================================
--- scribus/plugins/picbrowser/imagedialog.cpp (revision 14466)
+++ scribus/plugins/picbrowser/imagedialog.cpp (revision 14467)
@@ -21,9 +21,11 @@
bool mode=false;
//no document needs to be assigned to this
CMSettings cms ( doc, "", Intent_Perceptual );
+ cms.setUseEmbeddedProfile(true);
+ cms.allowSoftProofing(true);
//load image
- if ( image.LoadPicture ( imageFile, 1, cms, true, true, ScImage::RGBProof, 72 , &mode ) )
+ if ( image.loadPicture ( imageFile, 1, cms, ScImage::RGBData, 72 , &mode ) )
{
pView->setImage(QPixmap::fromImage ( image.qImage() ));
Index: scribus/plugins/picbrowser/loadimage.cpp
===================================================================
--- scribus/plugins/picbrowser/loadimage.cpp (revision 14466)
+++ scribus/plugins/picbrowser/loadimage.cpp (revision 14467)
@@ -73,11 +73,13 @@
bool mode=false;
//no document needs to be assigned to this
CMSettings cms ( 0, "", Intent_Perceptual);
+ cms.allowColorManagement(false);
+ cms.setUseEmbeddedProfile(true);
ImageInformation *imgInfo = new ImageInformation;
//load previewimage
- if ( image.LoadPicture ( path, 1, cms, true, false, ScImage::Thumbnail, 72, &mode ) )
+ if ( image.loadPicture ( path, 1, cms, ScImage::Thumbnail, 72, &mode ) )
{
int ix,iy;
if ( ( image.imgInfo.exifDataValid ) && ( !image.imgInfo.exifInfo.thumbnail.isNull() ) )
Index: scribus/plugins/svgexplugin/svgexplugin.cpp
===================================================================
--- scribus/plugins/svgexplugin/svgexplugin.cpp (revision 14466)
+++ scribus/plugins/svgexplugin/svgexplugin.cpp (revision 14467)
@@ -535,7 +535,9 @@
ob3.setAttribute("clip-path", "url(#Clip"+IToStr(ClipCount)+")");
ScImage img;
CMSettings cms(m_Doc, Item->IProfile, Item->IRender);
- img.LoadPicture(Item->Pfile, Item->pixm.imgInfo.actualPageNumber, cms, Item->UseEmbedded, true, ScImage::RGBProof, 72);
+ cms.setUseEmbeddedProfile(Item->UseEmbedded);
+ cms.allowSoftProofing(true);
+ img.loadPicture(Item->Pfile, Item->pixm.imgInfo.actualPageNumber, cms, ScImage::RGBData, 72);
img.applyEffect(Item->effectsInUse, m_Doc->PageColors, true);
if (Options.inlineImages)
{
Index: scribus/scpainterexbase.h
===================================================================
--- scribus/scpainterexbase.h (revision 14466)
+++ scribus/scpainterexbase.h (revision 14467)
@@ -56,7 +56,7 @@
virtual ~ScPainterExBase() {};
enum FillMode { None, Solid, Gradient, Pattern };
enum ColorMode { rgbMode = 1, cmykMode = 2 };
- enum ImageMode { cmykImages, rgbImages, rgbProofImages, rawImages };
+ enum ImageMode { cmykImages, rgbImages, rawImages };
enum Capabilities{ basic = 0, transparencies = 1, patterns = 2 };
virtual Capabilities capabilities() { return basic; }
Index: scribus/scpreview.cpp
===================================================================
--- scribus/scpreview.cpp (revision 14466)
+++ scribus/scpreview.cpp (revision 14467)
@@ -612,7 +612,8 @@
}
ScImage pixm;
CMSettings cms(0, "", Intent_Perceptual);
- pixm.LoadPicture(OB.Pfile, 1, cms, false, false, ScImage::RGBData, 72); //FIXME: OB doesnt know about pagenr
+ cms.allowColorManagement(false);
+ pixm.loadPicture(OB.Pfile, 1, cms, ScImage::RGBData, 72); //FIXME: OB doesnt know about pagenr
pS->scale(OB.LocalScX, OB.LocalScY);
pS->translate(static_cast<int>(OB.LocalX), static_cast<int>(OB.LocalY));
QImage img(pixm.qImage());
@@ -655,7 +656,8 @@
}
ScImage pixm;
CMSettings cms(0, "", Intent_Perceptual);
- pixm.LoadPicture(fileName, 1, cms, false, false, ScImage::RGBData, 72); //FIXME: OB doesnt know about pagenr
+ cms.allowColorManagement(false);
+ pixm.loadPicture(fileName, 1, cms, ScImage::RGBData, 72); //FIXME: OB doesnt know about pagenr
pS->scale(OB.LocalScX, OB.LocalScY);
pS->translate(static_cast<int>(OB.LocalX), static_cast<int>(OB.LocalY));
QImage img(pixm.qImage());
Index: scribus/pslib.cpp
===================================================================
--- scribus/pslib.cpp (revision 14466)
+++ scribus/pslib.cpp (revision 14467)
@@ -1447,7 +1447,9 @@
image.imgInfo.RequestProps = c->pixm.imgInfo.RequestProps;
image.imgInfo.isRequest = c->pixm.imgInfo.isRequest;
CMSettings cms(c->doc(), Prof, c->IRender);
- if (!image.LoadPicture(fn, c->pixm.imgInfo.actualPageNumber, cms, UseEmbedded, UseProf, ScImage::CMYKData, 300, &dummy))
+ cms.allowColorManagement(UseProf);
+ cms.setUseEmbeddedProfile(UseEmbedded);
+ if (!image.loadPicture(fn, c->pixm.imgInfo.actualPageNumber, cms, ScImage::CMYKData, 300, &dummy))
{
PS_Error_ImageLoadFailure(fn);
return false;
@@ -1537,13 +1539,15 @@
image.imgInfo.RequestProps = c->pixm.imgInfo.RequestProps;
image.imgInfo.isRequest = c->pixm.imgInfo.isRequest;
CMSettings cms(c->doc(), Prof, c->IRender);
+ cms.allowColorManagement(UseProf);
+ cms.setUseEmbeddedProfile(UseEmbedded);
int resolution = 300;
if (c->asLatexFrame())
resolution = c->asLatexFrame()->realDpi();
else if (c->pixm.imgInfo.type == ImageType7)
resolution = 72;
// int resolution = (c->pixm.imgInfo.type == ImageType7) ? 72 : 300;
- if ( !image.LoadPicture(fn, c->pixm.imgInfo.actualPageNumber, cms, UseEmbedded, UseProf, ScImage::CMYKData, resolution, &dummy) )
+ if ( !image.loadPicture(fn, c->pixm.imgInfo.actualPageNumber, cms, ScImage::CMYKData, resolution, &dummy) )
{
PS_Error_ImageLoadFailure(fn);
return false;
Index: scribus/cmsettings.h
===================================================================
--- scribus/cmsettings.h (revision 14466)
+++ scribus/cmsettings.h (revision 14467)
@@ -42,12 +42,20 @@
ScribusDoc* doc() const {return m_Doc;}
QString profileName() const {return m_ProfileName;}
- QString outputProfile() const { return m_outputProfile; }
eRenderIntent intent() const { return m_Intent; }
- bool useOutputProfile() const { return !m_outputProfile.isEmpty(); }
- void setOutputProfile(const QString& prof) { m_outputProfile = prof; }
+ bool colorManagementAllowed() const { return m_colorManagementAllowed; }
+ void allowColorManagement(bool allowed) { m_colorManagementAllowed = allowed; }
+ bool softProofingAllowed() const { return m_softProofingAllowed; }
+ void allowSoftProofing(bool allowed) { m_softProofingAllowed = allowed; }
+
+ bool useEmbeddedProfile() const { return m_useEmbeddedProfile; }
+ void setUseEmbeddedProfile(bool useEmbedded) { m_useEmbeddedProfile = useEmbedded; }
+
+ bool useOutputProfile() const { return !m_outputProfile.isNull(); }
+ void setOutputProfile(const ScColorProfile& prof) { m_outputProfile = prof; }
+
bool useColorManagement() const;
QString defaultMonitorProfile() const;
@@ -66,6 +74,7 @@
ScColorProfile monitorProfile() const;
ScColorProfile printerProfile() const;
+ ScColorProfile outputProfile() const;
ScColorTransform rgbColorDisplayTransform() const; // stdTransRGBMonG
ScColorTransform rgbColorProofingTransform() const; // stdProofG
@@ -81,11 +90,13 @@
ScColorTransform cmykGamutCheckTransform() const; //stdProofCMYKGCG
protected:
- ScribusDoc* m_Doc;
- QString m_ProfileName;
- QString m_outputProfile;
- eRenderIntent m_Intent;
-
+ ScribusDoc* m_Doc;
+ bool m_colorManagementAllowed;
+ bool m_softProofingAllowed;
+ bool m_useEmbeddedProfile;
+ QString m_ProfileName;
+ eRenderIntent m_Intent;
+ ScColorProfile m_outputProfile;
};
#endif
More information about the scribus-commit
mailing list