Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 14490 → Rev 14491

/trunk/Scribus/scribus/colormngt/sccolorprofiledata.h
File deleted
/trunk/Scribus/scribus/colormngt/sccolormngtimplelem.h
File deleted
\ No newline at end of file
/trunk/Scribus/scribus/colormngt/sccolorprofile.cpp
File deleted
\ No newline at end of file
/trunk/Scribus/scribus/colormngt/sccolormngtengine.h
File deleted
/trunk/Scribus/scribus/colormngt/sclcmscolormngtengineimpl.h
File deleted
/trunk/Scribus/scribus/colormngt/sclcmscolorprofileimpl.cpp
File deleted
\ No newline at end of file
/trunk/Scribus/scribus/colormngt/sccolormngtstructs.h
File deleted
/trunk/Scribus/scribus/colormngt/sccolorprofile.h
File deleted
/trunk/Scribus/scribus/colormngt/sccolortransformpool.cpp
File deleted
\ No newline at end of file
/trunk/Scribus/scribus/colormngt/sclcmscolorprofileimpl.h
File deleted
/trunk/Scribus/scribus/colormngt/CMakeLists.txt
File deleted
/trunk/Scribus/scribus/colormngt/sccolortransformpool.h
File deleted
/trunk/Scribus/scribus/colormngt/sccolortransformdata.h
File deleted
/trunk/Scribus/scribus/colormngt/sccolortransform.cpp
File deleted
\ No newline at end of file
/trunk/Scribus/scribus/colormngt/sclcmscolortransformimpl.cpp
File deleted
/trunk/Scribus/scribus/colormngt/sccolormngtelem.h
File deleted
/trunk/Scribus/scribus/colormngt/sccolortransform.h
File deleted
/trunk/Scribus/scribus/colormngt/sclcmscolortransformimpl.h
File deleted
/trunk/Scribus/scribus/colormngt/sccolormngtenginefactory.cpp
File deleted
\ No newline at end of file
/trunk/Scribus/scribus/colormngt/sccolorprofilecache.cpp
File deleted
\ No newline at end of file
/trunk/Scribus/scribus/colormngt/sccolormngtenginefactory.h
File deleted
/trunk/Scribus/scribus/colormngt/sccolorprofilecache.h
File deleted
/trunk/Scribus/scribus/colormngt/sccolormngtimplelem.cpp
File deleted
\ No newline at end of file
/trunk/Scribus/scribus/colormngt/sccolormngtenginedata.h
File deleted
/trunk/Scribus/scribus/colormngt/sccolormngtengine.cpp
File deleted
\ No newline at end of file
/trunk/Scribus/scribus/colormngt/sclcmscolormngtengineimpl.cpp
File deleted
/trunk/Scribus/scribus/colormngt/sccolormngtstructs.cpp
File deleted
/trunk/Scribus/scribus/scpainterex_ps2.cpp
38,7 → 38,7
using namespace std;
#include <cmath>
#include "colormngt/sccolormngtengine.h"
#include "colormgmt/sccolormgmtengine.h"
#include "sccolorengine.h"
#include "util.h"
 
/trunk/Scribus/scribus/scimgdataloader_ps.cpp
12,7 → 12,7
#include <QRegExp>
 
#include "cmsettings.h"
#include "colormngt/sccolormngtengine.h"
#include "colormgmt/sccolormgmtengine.h"
#include "scclocale.h"
#include "scpaths.h"
#include "scribuscore.h"
82,7 → 82,7
}
if (tmp.startsWith("%%EndICCProfile"))
{
ScColorMngtEngine engine(ScCore->defaultEngine);
ScColorMgmtEngine engine(ScCore->defaultEngine);
ScColorProfile prof = engine.openProfileFromMem(psdata);
if (prof)
{
427,7 → 427,7
}
if (tmp.startsWith("%%EndICCProfile"))
{
ScColorMngtEngine engine(ScCore->defaultEngine);
ScColorMgmtEngine engine(ScCore->defaultEngine);
ScColorProfile prof = engine.openProfileFromMem(psdata);
if (prof)
{
/trunk/Scribus/scribus/pslib.h
35,7 → 35,7
 
#include "scribusapi.h"
#include "scribusstructs.h"
#include "colormngt/sccolormngtengine.h"
#include "colormgmt/sccolormgmtengine.h"
 
#ifdef NLS_PROTO
class ScText;
/trunk/Scribus/scribus/scribuscore.h
27,7 → 27,7
#include "scribus.h"
#include "scribusapi.h"
 
#include "colormngt/sccolormngtengine.h"
#include "colormgmt/sccolormgmtengine.h"
 
class QWidget;
class FileWatcher;
113,7 → 113,7
ProfilesL PrinterProfiles;
ProfilesL PDFXProfiles;
 
ScColorMngtEngine defaultEngine;
ScColorMgmtEngine defaultEngine;
ScColorProfile monitorProfile;
ScColorProfile defaultRGBProfile;
ScColorProfile defaultCMYKProfile;
/trunk/Scribus/scribus/scribuscore.cpp
37,11 → 37,11
#include "util.h"
#include "util_icon.h"
#include "util_ghostscript.h"
#include "colormngt/sccolormngtenginefactory.h"
#include "colormgmt/sccolormgmtenginefactory.h"
 
extern ScribusQApp* ScQApp;
 
ScribusCore::ScribusCore() : QObject(), defaultEngine(colorMngtEngineFactory.createDefaultEngine())
ScribusCore::ScribusCore() : QObject(), defaultEngine(colorMgmtEngineFactory.createDefaultEngine())
{
m_ScribusInitialized=false;
m_SplashScreen=0;
50,7 → 50,7
// m_PaletteParent=0;
m_currScMW=0;
 
ScColorMngtStrategy strategy;
ScColorMgmtStrategy strategy;
strategy.useBlackPointCompensation = true;
strategy.useBlackPreservation = false;
defaultEngine.setStrategy(strategy);
477,12 → 477,9
MonitorProfiles.insert(defaultRGBString, defaultRGBProfile.profilePath());
 
// Open monitor profile as defined by user preferences
if (prefsManager->appPrefs.colorPrefs.DCMSset.CMSinUse)
{
QString displayProfile = prefsManager->appPrefs.colorPrefs.DCMSset.DefaultMonitorProfile;
if (MonitorProfiles.contains(displayProfile))
monitorProfile = defaultEngine.openProfileFromFile( MonitorProfiles[displayProfile] );
}
QString displayProfile = prefsManager->appPrefs.colorPrefs.DCMSset.DefaultMonitorProfile;
if (MonitorProfiles.contains(displayProfile))
monitorProfile = defaultEngine.openProfileFromFile( MonitorProfiles[displayProfile] );
if (monitorProfile.isNull())
{
prefsManager->appPrefs.colorPrefs.DCMSset.DefaultMonitorProfile = defaultRGBString;
/trunk/Scribus/scribus/scpainterex_ps2.h
41,7 → 41,7
 
#include "scribusapi.h"
#include "scconfig.h"
#include "colormngt/sccolormngtengine.h"
#include "colormgmt/sccolormgmtengine.h"
#include "fpoint.h"
#include "fpointarray.h"
#include "vgradient.h"
/trunk/Scribus/scribus/scribusdoc.cpp
63,7 → 63,7
#include "resourcecollection.h"
#include "sccolorengine.h"
#include "ui/scmessagebox.h"
#include "colormngt/sccolormngtenginefactory.h"
#include "colormgmt/sccolormgmtenginefactory.h"
#include "scpainter.h"
#include "scraction.h"
#include "scribus.h"
688,8 → 688,8
HasCMS = false;
ScColorProfile inputProf;
 
colorEngine = colorMngtEngineFactory.createDefaultEngine();
ScColorMngtStrategy colorStrategy;
colorEngine = colorMgmtEngineFactory.createDefaultEngine();
ScColorMgmtStrategy colorStrategy;
colorStrategy.useBlackPointCompensation = CMSSettings.BlackPoint;
colorStrategy.useBlackPreservation = false;
colorEngine.setStrategy(colorStrategy);
/trunk/Scribus/scribus/sampleitem.cpp
136,7 → 136,7
bgShade = c;
}
 
void SampleItem::setBgColorMngt(bool enable)
void SampleItem::setBgColorMgmt(bool enable)
{
m_Doc->PageColors["__whiteforpreviewbg__"].setSpotColor(!enable);
}
/trunk/Scribus/scribus/sccolorengine.cpp
24,7 → 24,7
#include "sccolorengine.h"
#include "scribuscore.h"
#include "scribusdoc.h"
#include "colormngt/sccolormngtengine.h"
#include "colormgmt/sccolormgmtengine.h"
 
QColor ScColorEngine::getRGBColor(const ScColor& color, const ScribusDoc* doc)
{
/trunk/Scribus/scribus/scimgdataloader_tiff.cpp
10,7 → 10,7
#include <QList>
 
#include "scconfig.h"
#include "colormngt/sccolormngtengine.h"
#include "colormgmt/sccolormgmtengine.h"
#include "scimgdataloader_tiff.h"
#include "scribuscore.h"
#include "util_color.h"
38,7 → 38,7
 
void ScImgDataLoader_TIFF::loadEmbeddedProfile(const QString& fn, int /*page*/)
{
ScColorMngtEngine engine(ScCore->defaultEngine);
ScColorMgmtEngine engine(ScCore->defaultEngine);
m_embeddedProfile.resize(0);
m_profileComponents = 0;
if ( !QFile::exists(fn) )
592,7 → 592,7
 
bool ScImgDataLoader_TIFF::loadPicture(const QString& fn, int page, int res, bool thumbnail)
{
ScColorMngtEngine engine(ScCore->defaultEngine);
ScColorMgmtEngine engine(ScCore->defaultEngine);
bool bilevel = false;
bool failedPS = false;
bool foundPS = false;
/trunk/Scribus/scribus/scdocoutput_ps2.cpp
80,7 → 80,7
 
eColorFormat outputDataTypeColors = Format_Undefined;
eColorFormat outputDataTypeImages = Format_Undefined;
ScColorMngtEngine engine(m_doc->colorEngine);
ScColorMgmtEngine engine(m_doc->colorEngine);
m_options.hProfile = engine.openProfileFromFile(m_options.outputProfile);
if (static_cast<int>(m_options.hProfile.colorSpace()) == icSigRgbData)
{
/trunk/Scribus/scribus/scimgdataloader_psd.cpp
5,7 → 5,7
for which a new license (GPL+exception) is in place.
*/
#include "scconfig.h"
#include "colormngt/sccolormngtengine.h"
#include "colormgmt/sccolormgmtengine.h"
#include "scimgdataloader_psd.h"
#include "util_color.h"
#include "sccolorengine.h"
47,7 → 47,7
m_embeddedProfile.resize(0);
m_profileComponents = 0;
ScColorProfile prof;
ScColorMngtEngine engine(ScCore->defaultEngine);
ScColorMgmtEngine engine(ScCore->defaultEngine);
QFileInfo fi = QFileInfo(fn);
if (!fi.exists())
return;
133,7 → 133,7
 
bool ScImgDataLoader_PSD::loadPicture(const QString& fn, int /*page*/, int res, bool thumbnail)
{
ScColorMngtEngine engine(ScCore->defaultEngine);
ScColorMgmtEngine engine(ScCore->defaultEngine);
bool isCMYK = false;
float xres = 72.0, yres = 72.0;
if (!QFile::exists(fn))
839,7 → 839,7
RawImage r2_image;
RawImage mask;
bool createOk = false;
ScColorMngtEngine engine(ScCore->defaultEngine);
ScColorMgmtEngine engine(ScCore->defaultEngine);
if (header.color_mode == CM_CMYK)
{
createOk = r2_image.create(layerInfo[layer].width, layerInfo[layer].height, qMax(channel_num, (uint)5));
1333,7 → 1333,7
 
bool ScImgDataLoader_PSD::loadLayer( QDataStream & s, const PSDHeader & header )
{
ScColorMngtEngine engine(ScCore->defaultEngine);
ScColorMgmtEngine engine(ScCore->defaultEngine);
// Find out if the data is compressed.
// Known values:
// 0: no compression
/trunk/Scribus/scribus/pageitem.h
38,7 → 38,7
 
#include "scribusapi.h"
#include "annotation.h"
#include "colormngt/sccolormngtstructs.h"
#include "colormgmt/sccolormgmtstructs.h"
#include "desaxe/saxio.h"
#include "observable.h"
#include "pagestructs.h"
/trunk/Scribus/scribus/scribusstructs.h
25,7 → 25,7
#include <vector>
 
#include "scribusapi.h"
#include "colormngt/sccolormngtstructs.h"
#include "colormgmt/sccolormgmtstructs.h"
#include "scimagestructs.h"
#include "sctextstruct.h"
#include "scfonts.h"
/trunk/Scribus/scribus/scribusdoc.h
38,7 → 38,7
 
#include "gtgettext.h" //CB For the ImportSetup struct and itemadduserframe
#include "scribusapi.h"
#include "colormngt/sccolormngtengine.h"
#include "colormgmt/sccolormgmtengine.h"
#include "documentinformation.h"
#include "observable.h"
#include "page.h"
1035,7 → 1035,7
int GroupCounter;
CMSData CMSSettings;
 
ScColorMngtEngine colorEngine;
ScColorMgmtEngine colorEngine;
ScColorProfile DocInputImageRGBProf;
ScColorProfile DocInputImageCMYKProf;
ScColorProfile DocInputRGBProf;
/trunk/Scribus/scribus/scimage.cpp
2145,7 → 2145,7
ScColorProfile printerProf = cmSettings.printerProfile() ? cmSettings.printerProfile() : ScCore->defaultCMYKProfile;
if (cmSettings.useColorManagement() && inputProf && screenProf && printerProf)
{
ScColorMngtEngine engine(cmSettings.doc() ? cmSettings.doc()->colorEngine : ScCore->defaultEngine);
ScColorMgmtEngine engine(cmSettings.doc() ? cmSettings.doc()->colorEngine : ScCore->defaultEngine);
bool isPsdTiff = (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext));
eColorFormat inputProfFormat = Format_BGRA_8;
eColorFormat outputProfFormat = Format_YMCK_8;
/trunk/Scribus/scribus/scimgdataloader_jpeg.cpp
9,7 → 9,7
#include <QObject>
#include <setjmp.h>
#include "scconfig.h"
#include "colormngt/sccolormngtengine.h"
#include "colormgmt/sccolormgmtengine.h"
#include "scimgdataloader_jpeg.h"
#include "scribuscore.h"
#include "exif.h"
/trunk/Scribus/scribus/ui/preview.cpp
1067,7 → 1067,7
{
QRgb alphaFF = qRgba(0,0,0,255);
QRgb alphaOO = qRgba(255,255,255,0);
ScColorMngtEngine engine = doc->colorEngine;
ScColorMgmtEngine engine = doc->colorEngine;
ScColorTransform transCMYK = engine.createTransform(doc->DocPrinterProf, Format_YMCK_8, doc->DocDisplayProf, Format_BGRA_8, Intent_Relative_Colorimetric, 0);
for( int yi=0; yi < h2; ++yi )
{
1129,7 → 1129,7
{
QRgb alphaFF = qRgba(0,0,0,255);
QRgb alphaOO = qRgba(255,255,255,0);
ScColorMngtEngine engine = doc->colorEngine;
ScColorMgmtEngine engine = doc->colorEngine;
ScColorTransform transCMYK = engine.createTransform(doc->DocPrinterProf, Format_YMCK_8, doc->DocDisplayProf, Format_BGRA_8, Intent_Relative_Colorimetric, 0);
for (int y=0; y < h2; ++y )
{
/trunk/Scribus/scribus/sampleitem.h
51,7 → 51,7
void setBgShade(int c);
/*! \brief Set color management for backgroud color of the pixmap.
\param enable if color management should be enabled */
void setBgColorMngt(bool enable);
void setBgColorMgmt(bool enable);
/*! \brief Set Text color of the pixmap.
\param c a QColor */
void setTxColor(QColor c);
/trunk/Scribus/scribus/colormgmt/sccolortransformdata.h
0,0 → 1,35
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
#ifndef SCCOLORTRANSFORMDATA_H
#define SCCOLORTRANSFORMDATA_H
 
#include <QByteArray>
#include <QString>
 
#include "icc34.h" //part of lcms1
#include "sccolormgmtelem.h"
#include "sccolormgmtstructs.h"
 
class ScColorTransformData : public ScColorMgmtElem
{
protected:
ScColorTransformInfo m_transformInfo;
 
public:
inline const ScColorTransformInfo& transformInfo() const { return m_transformInfo; }
inline void setTransformInfo(const ScColorTransformInfo& info) { m_transformInfo = info; }
virtual bool isNull() const = 0;
 
virtual bool apply(void* input, void* output, uint numElem) = 0;
virtual bool apply(QByteArray& input, QByteArray& output, uint numElem) = 0;
 
virtual void changeBufferFormat(eColorFormat input, eColorFormat output) = 0;
};
 
#endif
/trunk/Scribus/scribus/colormgmt/sccolortransformpool.h
0,0 → 1,35
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
#ifndef SCCOLORTRANSFORMPOOL_H
#define SCCOLORTRANSFORMPOOL_H
 
#include <QList>
#include <QWeakPointer>
#include "sccolormgmtstructs.h"
#include "sccolortransform.h"
 
class ScColorTransformPool
{
friend class ScColorMgmtEngineData;
 
public:
ScColorTransformPool (int engineID);
 
void clear(void);
void addTransform(const ScColorTransform& transform, bool force = false);
void removeTransform(const ScColorTransform& transform);
void removeTransform(const ScColorTransformInfo& info);
 
ScColorTransform findTransform(const ScColorTransformInfo& info) const;
 
protected:
int m_engineID;
QList< QWeakPointer<ScColorTransformData> > m_pool;
};
 
#endif
/trunk/Scribus/scribus/colormgmt/sccolormgmtelem.h
0,0 → 1,20
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
 
#ifndef SCCOLORMGMTELEM_H
#define SCCOLORMGMTELEM_H
 
class ScColorMgmtEngine;
 
class ScColorMgmtElem
{
public:
virtual ScColorMgmtEngine& engine() = 0;
virtual const ScColorMgmtEngine& engine() const = 0;
};
 
#endif
/trunk/Scribus/scribus/colormgmt/sclcmscolortransformimpl.cpp
0,0 → 1,65
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
 
#include "sclcmscolortransformimpl.h"
#include "sclcmscolormgmtengineimpl.h"
 
ScLcmsColorTransformImpl::ScLcmsColorTransformImpl(ScColorMgmtEngine& engine, cmsHTRANSFORM lcmsTransform)
: ScColorTransformImplBase(engine), m_transformHandle(lcmsTransform)
{
 
}
 
ScLcmsColorTransformImpl::~ScLcmsColorTransformImpl()
{
deleteTransform();
}
 
bool ScLcmsColorTransformImpl::isNull() const
{
return (m_transformHandle == NULL);
}
 
bool ScLcmsColorTransformImpl::apply(void* input, void* output, uint numElem)
{
if (m_transformHandle)
{
cmsDoTransform(m_transformHandle, input, output, numElem);
return true;
}
return false;
}
 
bool ScLcmsColorTransformImpl::apply(QByteArray& input, QByteArray& output, uint numElem)
{
if (m_transformHandle)
{
cmsDoTransform(m_transformHandle, input.data(), output.data(), numElem);
return true;
}
return false;
}
 
void ScLcmsColorTransformImpl::changeBufferFormat(eColorFormat input, eColorFormat output)
{
if (m_transformHandle)
{
DWORD lcmsInput = ScLcmsColorMgmtEngineImpl::translateFormatToLcmsFormat(input);
DWORD lcmsOutput = ScLcmsColorMgmtEngineImpl::translateFormatToLcmsFormat(output);
cmsChangeBuffersFormat(m_transformHandle, lcmsInput, lcmsOutput);
}
}
 
void ScLcmsColorTransformImpl::deleteTransform(void)
{
if (m_transformHandle)
{
cmsDeleteTransform(m_transformHandle);
m_transformHandle = NULL;
}
}
 
/trunk/Scribus/scribus/colormgmt/sccolortransform.h
0,0 → 1,47
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
#ifndef SCCOLORTRANSFORM_H
#define SCCOLORTRANSFORM_H
 
#include <QSharedPointer>
#include <QWeakPointer>
#include "scribusapi.h"
#include "sccolortransformdata.h"
 
class SCRIBUS_API ScColorTransform
{
friend class ScColorTransformPool;
public:
ScColorTransform();
ScColorTransform(ScColorTransformData* data);
ScColorTransform(const QSharedPointer<ScColorTransformData>& data);
ScColorMgmtEngine& engine() { return m_data->engine(); }
const ScColorMgmtEngine& engine() const { return m_data->engine(); }
 
inline bool isNull() const { return (m_data.isNull() || m_data->isNull()); }
inline operator bool () const { return !isNull(); }
 
const ScColorTransformInfo& transformInfo() const { return m_data->transformInfo(); }
bool apply(void* input, void* output, uint numElem);
bool apply(QByteArray& input, QByteArray& output, uint numElem);
 
// FIXME get rif of this API as soon as possible (cf scimage)
void changeBufferFormat(eColorFormat input, eColorFormat output);
 
bool operator==(const ScColorTransform& other) const;
 
protected:
QSharedPointer<ScColorTransformData> m_data;
 
QWeakPointer<ScColorTransformData> weakRef() const { return m_data.toWeakRef(); }
QSharedPointer<ScColorTransformData> strongRef() const { return m_data; }
};
 
#endif
/trunk/Scribus/scribus/colormgmt/sclcmscolortransformimpl.h
0,0 → 1,36
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
 
#ifndef SCLCMSCOLORTRANSFORMIMPL_H
#define SCLCMSCOLORTRANSFORMIMPL_H
 
#include "lcms.h"
#include "sccolormgmtimplelem.h"
#include "sccolortransformdata.h"
 
class ScLcmsColorTransformImpl : public ScColorTransformImplBase
{
friend class ScLcmsColorMgmtEngineImpl;
 
public:
ScLcmsColorTransformImpl(ScColorMgmtEngine& engine, cmsHTRANSFORM lcmsTransform);
virtual ~ScLcmsColorTransformImpl();
 
virtual bool isNull() const;
 
virtual bool apply(void* input, void* output, uint numElem);
virtual bool apply(QByteArray& input, QByteArray& output, uint numElem);
 
virtual void changeBufferFormat(eColorFormat input, eColorFormat output);
 
protected:
cmsHTRANSFORM m_transformHandle;
 
void deleteTransform(void);
};
 
#endif
/trunk/Scribus/scribus/colormgmt/sccolormgmtenginefactory.cpp
0,0 → 1,23
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
 
#include "sccolormgmtenginefactory.h"
#include "sclcmscolormgmtengineimpl.h"
 
ScColorMgmtEngineFactory colorMgmtEngineFactory;
 
ScColorMgmtEngine ScColorMgmtEngineFactory::createEngine(int engineID)
{
// for now just return default engine
return createDefaultEngine();
}
 
ScColorMgmtEngine ScColorMgmtEngineFactory::createDefaultEngine()
{
ScColorMgmtEngine lcmsEngine(new ScLcmsColorMgmtEngineImpl());
return lcmsEngine;
}
/trunk/Scribus/scribus/colormgmt/sccolormgmtenginefactory.h
0,0 → 1,22
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
 
#ifndef SCCOLORMGMTENGINEFACTORY_H
#define SCCOLORMGMTENGINEFACTORY_H
 
#include "sccolormgmtengine.h"
 
class ScColorMgmtEngineFactory
{
public:
ScColorMgmtEngine createEngine(int engineID);
ScColorMgmtEngine createDefaultEngine();
};
 
extern ScColorMgmtEngineFactory colorMgmtEngineFactory;
 
#endif
/trunk/Scribus/scribus/colormgmt/sccolormgmtenginedata.h
0,0 → 1,65
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
#ifndef SCCOLORMGMTENGINEDATA_H
#define SCCOLORMGMTENGINEDATA_H
 
#include <QByteArray>
#include <QString>
 
#include "sccolormgmtstructs.h"
#include "sccolorprofile.h"
#include "sccolortransform.h"
#include "sccolortransformpool.h"
 
class ScColorMgmtEngine;
 
class ScColorMgmtEngineData
{
protected:
int m_engineID;
QString m_description;
ScColorMgmtStrategy m_strategy;
public:
 
ScColorMgmtEngineData(const QString& desc, int uniqueID) : m_engineID(uniqueID),
m_description(desc)
{}
// Getters
int engineID() const { return m_engineID; }
const QString& description() const { return m_description; }
const ScColorMgmtStrategy& strategy() const { return m_strategy; }
// Setter, only for color management strategy, and purely virtual ;)
virtual void setStrategy(const ScColorMgmtStrategy& strategy) = 0;
 
// function for getting available profile in a directory
virtual QList<ScColorProfileInfo> getAvailableProfileInfo(const QString& directory, bool recursive) = 0;
// functions for opening icc profiles
virtual ScColorProfile openProfileFromFile(ScColorMgmtEngine& engine, const QString& filePath) = 0;
virtual ScColorProfile openProfileFromMem (ScColorMgmtEngine& engine, const QByteArray& array) = 0;
// functions for creating profiles
virtual ScColorProfile createProfile_sRGB(ScColorMgmtEngine& engine) = 0;
virtual ScColorProfile createProfile_Lab (ScColorMgmtEngine& engine) = 0;
// functions for creating transforms
virtual ScColorTransform createTransform(ScColorMgmtEngine& colorManagementEngine,
const ScColorProfile& inputProfile , eColorFormat inputFormat,
const ScColorProfile& outputProfile, eColorFormat outputFormat,
eRenderIntent renderIntent, long transformFlags) = 0;
virtual ScColorTransform createProofingTransform(ScColorMgmtEngine& colorManagementEngine,
const ScColorProfile& inputProfile , eColorFormat inputFormat,
const ScColorProfile& outputProfile, eColorFormat outputFormat,
const ScColorProfile& proofing, eRenderIntent renderIntent,
eRenderIntent proofingIntent, long transformFlags) = 0;
};
 
#endif
/trunk/Scribus/scribus/colormgmt/sccolormgmtimplelem.cpp
0,0 → 1,40
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
 
#include "sccolormgmtimplelem.h"
 
ScColorProfileImplBase::ScColorProfileImplBase(const ScColorMgmtEngine& engine)
: m_engine(engine)
{
 
}
 
ScColorMgmtEngine& ScColorProfileImplBase::engine()
{
return m_engine;
}
 
const ScColorMgmtEngine& ScColorProfileImplBase::engine() const
{
return m_engine;
}
 
ScColorTransformImplBase::ScColorTransformImplBase(const ScColorMgmtEngine& engine)
: m_engine(engine)
{
 
}
 
ScColorMgmtEngine& ScColorTransformImplBase::engine()
{
return m_engine;
}
 
const ScColorMgmtEngine& ScColorTransformImplBase::engine() const
{
return m_engine;
}
/trunk/Scribus/scribus/colormgmt/sccolormgmtengine.cpp
0,0 → 1,85
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
 
#include <cassert>
#include "sccolormgmtengine.h"
 
ScColorMgmtEngine::ScColorMgmtEngine(ScColorMgmtEngineData* data) : m_data(data)
{
assert(data != NULL);
}
 
int ScColorMgmtEngine::engineID() const
{
return m_data->engineID();
}
 
const QString& ScColorMgmtEngine::description() const
{
return m_data->description();
}
 
const ScColorMgmtStrategy& ScColorMgmtEngine::strategy() const
{
return m_data->strategy();
}
 
void ScColorMgmtEngine::setStrategy(const ScColorMgmtStrategy& strategy)
{
m_data->setStrategy(strategy);
}
 
QList<ScColorProfileInfo> ScColorMgmtEngine::getAvailableProfileInfo(const QString& directory, bool recursive)
{
return m_data->getAvailableProfileInfo(directory, recursive);
}
 
ScColorProfile ScColorMgmtEngine::openProfileFromFile(const QString& filePath)
{
return m_data->openProfileFromFile(*this, filePath);
}
 
ScColorProfile ScColorMgmtEngine::openProfileFromMem( const QByteArray& array)
{
return m_data->openProfileFromMem(*this, array);
}
 
ScColorProfile ScColorMgmtEngine::createProfile_sRGB()
{
return m_data->createProfile_sRGB(*this);
}
 
ScColorProfile ScColorMgmtEngine::createProfile_Lab()
{
return m_data->createProfile_Lab(*this);
}
 
ScColorTransform ScColorMgmtEngine::createTransform(const ScColorProfile& inputProfile , eColorFormat inputFormat,
const ScColorProfile& outputProfile, eColorFormat outputFormat,
eRenderIntent renderIntent, long transformFlags)
{
return m_data->createTransform(*this, inputProfile, inputFormat, outputProfile, outputFormat, renderIntent, transformFlags);
}
 
ScColorTransform ScColorMgmtEngine::createProofingTransform(const ScColorProfile& inputProfile, eColorFormat inputFormat,
const ScColorProfile& outputProfile, eColorFormat outputFormat,
const ScColorProfile& proofingProfile, eRenderIntent renderIntent,
eRenderIntent proofingIntent, long transformFlags)
{
return m_data->createProofingTransform(*this, inputProfile, inputFormat, outputProfile, outputFormat,
proofingProfile, renderIntent, proofingIntent, transformFlags);
}
 
bool ScColorMgmtEngine::operator==(const ScColorMgmtEngine& other) const
{
return m_data == other.m_data;
}
 
bool ScColorMgmtEngine::operator!=(const ScColorMgmtEngine& other) const
{
return m_data != other.m_data;
}
/trunk/Scribus/scribus/colormgmt/sclcmscolormgmtengineimpl.cpp
0,0 → 1,558
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
 
#include <iostream>
#include <string>
#include <QDir>
#include <QFile>
 
#include "sclcmscolormgmtengineimpl.h"
#include "sclcmscolorprofileimpl.h"
#include "sclcmscolortransformimpl.h"
 
#ifndef cmsFLAGS_PRESERVEBLACK
#define cmsFLAGS_PRESERVEBLACK 0x8000
#endif
 
QSharedPointer<ScColorProfileCache> ScLcmsColorMgmtEngineImpl::m_profileCache;
QSharedPointer<ScColorTransformPool> ScLcmsColorMgmtEngineImpl::m_transformPool;
 
ScLcmsColorMgmtEngineImpl::ScLcmsColorMgmtEngineImpl()
: ScColorMgmtEngineData("Littlecms v1", 0)
{
if (!m_profileCache)
m_profileCache = QSharedPointer<ScColorProfileCache>(new ScColorProfileCache());
if (!m_transformPool)
m_transformPool = QSharedPointer<ScColorTransformPool>(new ScColorTransformPool(0));
cmsSetAlarmCodes(0, 255, 0);
}
 
void ScLcmsColorMgmtEngineImpl::setStrategy(const ScColorMgmtStrategy& strategy)
{
m_strategy = strategy;
}
 
QList<ScColorProfileInfo> ScLcmsColorMgmtEngineImpl::getAvailableProfileInfo(const QString& directory, bool recursive)
{
QList<ScColorProfileInfo> profileInfos;
 
QDir d(directory, "*", QDir::Name, QDir::Files | QDir::Readable | QDir::Dirs | QDir::NoSymLinks);
if ((!d.exists()) || (d.count() == 0))
return profileInfos;
 
QString nam = "";
cmsHPROFILE hIn = NULL;
 
for (uint dc = 0; dc < d.count(); ++dc)
{
QString file = d[dc];
if (file == "." || file == "..")
continue;
QFileInfo fi(directory + "/" + file);
if (fi.isDir() && !recursive)
continue;
else if (fi.isDir() && !file.startsWith('.'))
{
QList<ScColorProfileInfo> profileInfos2 = getAvailableProfileInfo(fi.filePath()+"/", true);
profileInfos.append(profileInfos2);
continue;
}
 
ScColorProfileInfo profileInfo;
profileInfo.file = fi.filePath();
 
QFile f(fi.filePath());
QByteArray bb(40, ' ');
if (!f.open(QIODevice::ReadOnly)) {
profileInfo.debug = QString("couldn't open %1 as color profile").arg(fi.filePath());
profileInfos.append(profileInfo);
continue;
}
int len = f.read(bb.data(), 40);
f.close();
if (len == 40 && bb[36] == 'a' && bb[37] == 'c' && bb[38] == 's' && bb[39] == 'p')
{
const QByteArray profilePath( QString(directory + "/" + file).toLocal8Bit() );
cmsSetErrorHandler(&cmsErrorHandler);
try
{
hIn = cmsOpenProfileFromFile(profilePath.data(), "r");
if (hIn == NULL)
continue;
const char* profileDescriptor = cmsTakeProductDesc(hIn);
profileInfo.description = QString(profileDescriptor);
if (profileInfo.description.isEmpty())
{
cmsCloseProfile(hIn);
profileInfo.debug = QString("Color profile %1 is broken : no valid description").arg(fi.filePath());
profileInfos.append(profileInfo);
continue;
}
profileInfo.colorSpace = cmsGetColorSpace(hIn);
profileInfo.deviceClass = cmsGetDeviceClass(hIn);
profileInfos.append(profileInfo);
cmsCloseProfile(hIn);
hIn = NULL;
}
catch (lcmsException&)
{
// Profile is broken
if (hIn)
{
cmsCloseProfile(hIn);
hIn = NULL;
}
profileInfo.debug = QString("Color profile %1 is broken").arg(fi.filePath());
profileInfos.append(profileInfo);
}
cmsSetErrorHandler(NULL);
}
}
cmsSetErrorHandler(NULL);
 
return profileInfos;
}
 
ScColorProfile ScLcmsColorMgmtEngineImpl::openProfileFromFile(ScColorMgmtEngine& engine, const QString& filePath)
{
// Search profile in profile cache first
ScColorProfile profile = m_profileCache->profile(filePath);
if (!profile.isNull())
return profile;
cmsHPROFILE lcmsProf = NULL;
cmsSetErrorHandler(&cmsErrorHandler);
try
{
QFile file(filePath);
if (file.open(QFile::ReadOnly))
{
// We do not use lcms cmsOpenProfileFromFile() to avoid limitations
// of I/O on 8bit filenames on Windows
QByteArray data = file.readAll();
if (!data.isEmpty())
{
lcmsProf = cmsOpenProfileFromMem(data.data(), data.size());
if (lcmsProf)
{
ScLcmsColorProfileImpl* profData = new ScLcmsColorProfileImpl(engine, lcmsProf);
profData->m_profileData = data;
profData->m_profilePath = filePath;
profile = ScColorProfile(dynamic_cast<ScColorProfileData*>(profData));
m_profileCache->addProfile(profile);
}
if (profile.isNull() && lcmsProf)
{
cmsCloseProfile(lcmsProf);
lcmsProf = NULL;
}
}
file.close();
}
}
catch (lcmsException& e)
{
std::cerr << e.what() << std::endl;
if (profile.isNull() && lcmsProf)
cmsCloseProfile(lcmsProf);
profile = ScColorProfile();
}
cmsSetErrorHandler(NULL);
return profile;
}
 
ScColorProfile ScLcmsColorMgmtEngineImpl::openProfileFromMem(ScColorMgmtEngine& engine, const QByteArray& data)
{
ScColorProfile profile;
cmsHPROFILE lcmsProf = NULL;
cmsSetErrorHandler(&cmsErrorHandler);
try
{
lcmsProf = cmsOpenProfileFromMem((LPVOID) data.data(), data.size());
if (lcmsProf)
{
ScLcmsColorProfileImpl* profData = new ScLcmsColorProfileImpl(engine, lcmsProf);
QString desc = profData->productDescription();
if (!desc.isEmpty())
profData->m_profilePath = QString("memprofile://%1").arg(desc);
profData->m_profileData = data;
profile = ScColorProfile(dynamic_cast<ScColorProfileData*>(profData));
}
if (profile.isNull() && lcmsProf)
{
cmsCloseProfile(lcmsProf);
lcmsProf = NULL;
}
}
catch (lcmsException& e)
{
std::cerr << e.what() << std::endl;
if (profile.isNull() && lcmsProf)
cmsCloseProfile(lcmsProf);
profile = ScColorProfile();
}
cmsSetErrorHandler(NULL);
return profile;
}
 
ScColorProfile ScLcmsColorMgmtEngineImpl::createProfile_sRGB(ScColorMgmtEngine& engine)
{
QString internalProfilePath("memprofile://Internal sRGB profile");
ScColorProfile profile = m_profileCache->profile(internalProfilePath);
if (!profile.isNull())
return profile;
 
cmsHPROFILE lcmsProf = NULL;
cmsSetErrorHandler(&cmsErrorHandler);
try
{
lcmsProf = cmsCreate_sRGBProfile();
if (lcmsProf)
{
ScLcmsColorProfileImpl* profData = new ScLcmsColorProfileImpl(engine, lcmsProf);
profData->m_profilePath = internalProfilePath;
profile = ScColorProfile(dynamic_cast<ScColorProfileData*>(profData));
m_profileCache->addProfile(profile);
}
if (profile.isNull() && lcmsProf)
{
cmsCloseProfile(lcmsProf);
lcmsProf = NULL;
}
}
catch (lcmsException& e)
{
std::cerr << e.what() << std::endl;
if (profile.isNull() && lcmsProf)
cmsCloseProfile(lcmsProf);
profile = ScColorProfile();
}
cmsSetErrorHandler(NULL);
return profile;
}
 
ScColorProfile ScLcmsColorMgmtEngineImpl::createProfile_Lab(ScColorMgmtEngine& engine)
{
QString internalProfilePath("memprofile://Internal Lab profile");
ScColorProfile profile = m_profileCache->profile(internalProfilePath);
if (!profile.isNull())
return profile;
 
cmsHPROFILE lcmsProf = NULL;
cmsSetErrorHandler(&cmsErrorHandler);
try
{
lcmsProf = cmsCreateLabProfile(NULL);
if (lcmsProf)
{
ScLcmsColorProfileImpl* profData = new ScLcmsColorProfileImpl(engine, lcmsProf);
profData->m_profilePath = internalProfilePath;
profile = ScColorProfile(dynamic_cast<ScColorProfileData*>(profData));
m_profileCache->addProfile(profile);
}
if (profile.isNull() && lcmsProf)
{
cmsCloseProfile(lcmsProf);
lcmsProf = NULL;
}
}
catch (lcmsException& e)
{
std::cerr << e.what() << std::endl;
if (profile.isNull() && lcmsProf)
cmsCloseProfile(lcmsProf);
profile = ScColorProfile();
}
cmsSetErrorHandler(NULL);
return profile;
}
 
ScColorTransform ScLcmsColorMgmtEngineImpl::createTransform(ScColorMgmtEngine& engine,
const ScColorProfile& inputProfile , eColorFormat inputFormat,
const ScColorProfile& outputProfile, eColorFormat outputFormat,
eRenderIntent renderIntent, long transformFlags)
{
ScColorTransform transform(NULL);
if (inputProfile.isNull() || outputProfile.isNull())
return transform;
int inputProfEngineID = inputProfile.engine().engineID();
int outputProfEngineID = outputProfile.engine().engineID();
if ((engine.engineID() != m_engineID) || (inputProfEngineID != m_engineID) || (outputProfEngineID != m_engineID))
return transform;
const ScLcmsColorProfileImpl* lcmsInputProf = dynamic_cast<const ScLcmsColorProfileImpl*>(inputProfile.data());
const ScLcmsColorProfileImpl* lcmsOutputProf = dynamic_cast<const ScLcmsColorProfileImpl*>(outputProfile.data());
if (!lcmsInputProf || !lcmsOutputProf)
return transform;
 
transformFlags &= (~Ctf_Softproofing);
transformFlags &= (~Ctf_GamutCheck);
long strategyFlags = 0;
if (m_strategy.useBlackPointCompensation)
strategyFlags |= Ctf_BlackPointCompensation;
if (m_strategy.useBlackPreservation)
strategyFlags |= Ctf_BlackPreservation;
 
ScColorTransformInfo transInfo;
transInfo.inputProfile = inputProfile.productDescription();
transInfo.outputProfile = outputProfile.productDescription();
transInfo.proofingProfile = QString();
transInfo.inputFormat = inputFormat;
transInfo.outputFormat = outputFormat;
transInfo.renderIntent = renderIntent;
transInfo.proofingIntent = (eRenderIntent) 0;
transInfo.flags = transformFlags | strategyFlags;
 
bool nullTransform = false;
if (transInfo.inputProfile == transInfo.outputProfile)
{
// This is a null transform
transInfo.inputProfile = QString();
transInfo.outputProfile = QString();
transInfo.proofingProfile = QString();
transInfo.renderIntent = (eRenderIntent) 0;
transInfo.proofingIntent = (eRenderIntent) 0;
transInfo.flags = 0;
nullTransform = true;
}
 
transform = m_transformPool->findTransform(transInfo);
if (transform.isNull())
{
DWORD lcmsFlags = translateFlagsToLcmsFlags(transformFlags | strategyFlags);
DWORD lcmsInputFmt = translateFormatToLcmsFormat(inputFormat);
DWORD lcmsOutputFmt = translateFormatToLcmsFormat(outputFormat);
int lcmsIntent = translateIntentToLcmsIntent(renderIntent);
if (nullTransform)
lcmsFlags |= cmsFLAGS_NULLTRANSFORM;
cmsHTRANSFORM hTransform = NULL;
cmsSetErrorHandler(&cmsErrorHandler);
try
{
hTransform = cmsCreateTransform(lcmsInputProf->m_profileHandle , lcmsInputFmt,
lcmsOutputProf->m_profileHandle, lcmsOutputFmt,
lcmsIntent, lcmsFlags | cmsFLAGS_LOWRESPRECALC);
if (hTransform)
{
ScLcmsColorTransformImpl* newTrans = new ScLcmsColorTransformImpl(engine, hTransform);
newTrans->setTransformInfo(transInfo);
transform = ScColorTransform(dynamic_cast<ScColorTransformData*>(newTrans));
m_transformPool->addTransform(transform, true);
}
}
catch (lcmsException& e)
{
std::cerr << e.what() << std::endl;
if (transform.isNull() && hTransform)
cmsDeleteTransform(hTransform);
transform = ScColorTransform();
}
cmsSetErrorHandler(NULL);
}
return transform;
}
 
ScColorTransform ScLcmsColorMgmtEngineImpl::createProofingTransform(ScColorMgmtEngine& engine,
const ScColorProfile& inputProfile , eColorFormat inputFormat,
const ScColorProfile& outputProfile, eColorFormat outputFormat,
const ScColorProfile& proofProfile , eRenderIntent renderIntent,
eRenderIntent proofingIntent, long transformFlags)
{
ScColorTransform transform(NULL);
if (inputProfile.isNull() || outputProfile.isNull())
return transform;
int inputProfEngineID = inputProfile.engine().engineID();
int outputProfEngineID = outputProfile.engine().engineID();
int proofProfEngineID = proofProfile.engine().engineID();
if ((engine.engineID() != m_engineID) || (inputProfEngineID != m_engineID) ||
(outputProfEngineID != m_engineID) || (proofProfEngineID != m_engineID))
return transform;
const ScLcmsColorProfileImpl* lcmsInputProf = dynamic_cast<const ScLcmsColorProfileImpl*>(inputProfile.data());
const ScLcmsColorProfileImpl* lcmsOutputProf = dynamic_cast<const ScLcmsColorProfileImpl*>(outputProfile.data());
const ScLcmsColorProfileImpl* lcmsProofingProf = dynamic_cast<const ScLcmsColorProfileImpl*>(proofProfile.data());
if (!lcmsInputProf || !lcmsOutputProf || !lcmsProofingProf)
return transform;
 
long strategyFlags = 0;
if (m_strategy.useBlackPointCompensation)
strategyFlags |= Ctf_BlackPointCompensation;
if (m_strategy.useBlackPreservation)
strategyFlags |= Ctf_BlackPreservation;
 
ScColorTransformInfo transInfo;
transInfo.inputProfile = inputProfile.productDescription();
transInfo.outputProfile = outputProfile.productDescription();
transInfo.proofingProfile = proofProfile.productDescription();
transInfo.inputFormat = inputFormat;
transInfo.outputFormat = outputFormat;
transInfo.renderIntent = renderIntent;
transInfo.proofingIntent = proofingIntent;
transInfo.flags = transformFlags | strategyFlags;
 
DWORD lcmsFlags = translateFlagsToLcmsFlags(transformFlags | strategyFlags);
DWORD lcmsInputFmt = translateFormatToLcmsFormat(inputFormat);
DWORD lcmsOutputFmt = translateFormatToLcmsFormat(outputFormat);
int lcmsIntent = translateIntentToLcmsIntent(renderIntent);
int lcmsPrfIntent = translateIntentToLcmsIntent(proofingIntent);
 
if (transInfo.inputProfile != transInfo.proofingProfile)
{
if (transInfo.proofingProfile == transInfo.outputProfile)
{
transInfo.proofingIntent = Intent_Relative_Colorimetric;
lcmsPrfIntent = translateIntentToLcmsIntent(Intent_Relative_Colorimetric);
}
transform = m_transformPool->findTransform(transInfo);
if (transform.isNull())
{
cmsSetErrorHandler(&cmsErrorHandler);
cmsHTRANSFORM hTransform = NULL;
try
{
hTransform = cmsCreateProofingTransform(lcmsInputProf->m_profileHandle , lcmsInputFmt,
lcmsOutputProf->m_profileHandle, lcmsOutputFmt,
lcmsProofingProf->m_profileHandle, lcmsIntent,
lcmsPrfIntent, lcmsFlags | cmsFLAGS_SOFTPROOFING);
if (hTransform)
{
ScLcmsColorTransformImpl* newTrans = new ScLcmsColorTransformImpl(engine, hTransform);
newTrans->setTransformInfo(transInfo);
transform = ScColorTransform(dynamic_cast<ScColorTransformData*>(newTrans));
m_transformPool->addTransform(transform, true);
}
}
catch (lcmsException& e)
{
std::cerr << e.what() << std::endl;
if (transform.isNull() && hTransform)
cmsDeleteTransform(hTransform);
transform = ScColorTransform();
}
cmsSetErrorHandler(NULL);
}
}
else
{
transformFlags &= (~Ctf_Softproofing);
transformFlags &= (~Ctf_GamutCheck);
lcmsFlags = translateFlagsToLcmsFlags(transformFlags | strategyFlags);
transInfo.flags = transformFlags | strategyFlags;
transInfo.renderIntent = proofingIntent;
transInfo.proofingIntent = (eRenderIntent) 0;
if (transInfo.inputProfile == transInfo.outputProfile)
{
lcmsFlags |= cmsFLAGS_NULLTRANSFORM;
transInfo.inputProfile = QString();
transInfo.outputProfile = QString();
transInfo.proofingProfile = QString();
transInfo.renderIntent = (eRenderIntent) 0;
transInfo.proofingIntent = (eRenderIntent) 0;
transInfo.flags = 0;
}
transform = m_transformPool->findTransform(transInfo);
if (transform.isNull())
{
cmsSetErrorHandler(&cmsErrorHandler);
cmsHTRANSFORM hTransform = NULL;
try
{
hTransform = cmsCreateTransform(lcmsInputProf->m_profileHandle , lcmsInputFmt,
lcmsOutputProf->m_profileHandle, lcmsOutputFmt,
lcmsPrfIntent, lcmsFlags | cmsFLAGS_LOWRESPRECALC);
if (hTransform)
{
ScLcmsColorTransformImpl* newTrans = new ScLcmsColorTransformImpl(engine, hTransform);
newTrans->setTransformInfo(transInfo);
transform = ScColorTransform(dynamic_cast<ScColorTransformData*>(newTrans));
m_transformPool->addTransform(transform, true);
}
}
catch (lcmsException& e)
{
std::cerr << e.what() << std::endl;
if (transform.isNull() && hTransform)
cmsDeleteTransform(hTransform);
transform = ScColorTransform();
}
cmsSetErrorHandler(NULL);
}
}
return transform;
}
 
DWORD ScLcmsColorMgmtEngineImpl::translateFlagsToLcmsFlags(long flags)
{
DWORD lFlags = 0;
if (flags & Ctf_BlackPointCompensation)
lFlags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
if (flags & Ctf_BlackPreservation)
lFlags |= cmsFLAGS_PRESERVEBLACK;
if (flags & Ctf_Softproofing)
lFlags |= cmsFLAGS_SOFTPROOFING;
if (flags & Ctf_GamutCheck)
lFlags |= cmsFLAGS_GAMUTCHECK;
return lFlags;
}
 
DWORD ScLcmsColorMgmtEngineImpl::translateFormatToLcmsFormat(eColorFormat format)
{
DWORD lFormat = 0;
if (format == Format_RGB_8)
lFormat = TYPE_RGB_8;
if (format == Format_RGB_16)
lFormat = TYPE_RGB_16;
if (format == Format_RGBA_8)
lFormat = TYPE_RGBA_8;
if (format == Format_RGBA_16)
lFormat = TYPE_RGBA_16;
if (format == Format_ARGB_8)
lFormat = TYPE_ARGB_8;
if (format == Format_ARGB_16)
lFormat = TYPE_ARGB_16;
if (format == Format_BGRA_8)
lFormat = TYPE_BGRA_8;
if (format == Format_BGRA_16)
lFormat = TYPE_BGRA_16;
if (format == Format_CMYK_8)
lFormat = TYPE_CMYK_8;
if (format == Format_CMYK_16)
lFormat = TYPE_CMYK_16;
if (format == Format_CMYKA_8)
lFormat = (COLORSPACE_SH(PT_CMYK)|EXTRA_SH(1)|CHANNELS_SH(4)|BYTES_SH(1));
if (format == Format_CMYKA_16)
lFormat = (COLORSPACE_SH(PT_CMYK)|EXTRA_SH(1)|CHANNELS_SH(4)|BYTES_SH(2));
if (format == Format_YMCK_8)
lFormat = (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1)|DOSWAP_SH(1)|SWAPFIRST_SH(1));
if (format == Format_YMCK_16)
lFormat = (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|DOSWAP_SH(1)|SWAPFIRST_SH(1));
if (format == Format_GRAY_8)
lFormat = TYPE_GRAY_8;
if (format == Format_GRAY_16)
lFormat = TYPE_GRAY_16;
if (format == Format_LabA_8)
lFormat = COLORSPACE_SH(PT_Lab)|CHANNELS_SH(3)|BYTES_SH(1)|EXTRA_SH(1);
return lFormat;
}
 
int ScLcmsColorMgmtEngineImpl::translateIntentToLcmsIntent(eRenderIntent intent, eRenderIntent defIntent)
{
int lIntent = defIntent;
if (intent == Intent_Perceptual)
lIntent = INTENT_PERCEPTUAL;
if (intent == Intent_Relative_Colorimetric)
lIntent = INTENT_RELATIVE_COLORIMETRIC;
if (intent == Intent_Saturation)
lIntent = INTENT_SATURATION;
if (intent == Intent_Absolute_Colorimetric)
lIntent = INTENT_ABSOLUTE_COLORIMETRIC;
return lIntent;
}
 
int ScLcmsColorMgmtEngineImpl::cmsErrorHandler(int /*ErrorCode*/, const char *ErrorText)
{
std::string msg = std::string("Littlecms : ") + ErrorText;
throw lcmsException(msg.c_str());
return 1;
}
/trunk/Scribus/scribus/colormgmt/sccolormgmtstructs.cpp
0,0 → 1,20
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
 
#include "sccolormgmtstructs.h"
 
bool operator==(const ScColorTransformInfo& v1, const ScColorTransformInfo& v2)
{
return ((v1.inputProfile == v2.inputProfile) &&
(v1.outputProfile == v2.outputProfile) &&
(v1.proofingProfile == v2.proofingProfile) &&
(v1.inputFormat == v2.inputFormat) &&
(v1.outputFormat == v2.outputFormat) &&
(v1.renderIntent == v2.renderIntent) &&
(v1.proofingIntent == v2.proofingIntent) &&
(v1.flags == v2.flags));
}
/trunk/Scribus/scribus/colormgmt/sccolormgmtimplelem.h
0,0 → 1,38
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
 
#ifndef SCCOLORMGMTIMPLELEM_H
#define SCCOLORMGMTIMPLELEM_H
 
#include "sccolormgmtelem.h"
#include "sccolormgmtengine.h"
 
class ScColorProfileImplBase : public ScColorProfileData
{
protected:
ScColorMgmtEngine m_engine;
 
public:
ScColorProfileImplBase(const ScColorMgmtEngine& engine);
 
virtual ScColorMgmtEngine& engine();
virtual const ScColorMgmtEngine& engine() const;
};
 
class ScColorTransformImplBase : public ScColorTransformData
{
protected:
ScColorMgmtEngine m_engine;
 
public:
ScColorTransformImplBase(const ScColorMgmtEngine& engine);
 
virtual ScColorMgmtEngine& engine();
virtual const ScColorMgmtEngine& engine() const;
};
 
#endif
/trunk/Scribus/scribus/colormgmt/sccolorprofiledata.h
0,0 → 1,33
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
#ifndef SCCOLORPROFILEDATA_H
#define SCCOLORPROFILEDATA_H
 
#include <QByteArray>
#include <QString>
 
#include "icc34.h" //part of lcms1
#include "sccolormgmtelem.h"
 
class ScColorProfileData : public ScColorMgmtElem
{
protected:
QString m_profilePath;
QString m_profileData;
 
public:
 
QString path() const { return m_profilePath; }
 
virtual bool isNull() const = 0;
virtual icColorSpaceSignature colorSpace() const = 0;
virtual icProfileClassSignature deviceClass() const = 0;
virtual QString productDescription() const = 0;
};
 
#endif
/trunk/Scribus/scribus/colormgmt/sccolormgmtengine.h
0,0 → 1,57
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
#ifndef SCCOLORMGMTENGINE_H
#define SCCOLORMGMTENGINE_H
 
#include <QList>
#include <QSharedPointer>
#include "scribusapi.h"
#include "sccolormgmtenginedata.h"
 
class SCRIBUS_API ScColorMgmtEngine
{
public:
ScColorMgmtEngine(ScColorMgmtEngineData*);
// Getters
int engineID() const;
const QString& description() const;
const ScColorMgmtStrategy& strategy() const;
// Setters, only for color management strategy, and purely virtual ;)
void setStrategy(const ScColorMgmtStrategy& strategy);
 
// function for getting available profile in a directory
QList<ScColorProfileInfo> getAvailableProfileInfo(const QString& directory, bool recursive);
// functions for opening icc profiles
ScColorProfile openProfileFromFile(const QString& filePath);
ScColorProfile openProfileFromMem( const QByteArray& array);
// functions for creating profiles
ScColorProfile createProfile_sRGB();
ScColorProfile createProfile_Lab();
// functions for creating transforms
ScColorTransform createTransform(const ScColorProfile& inputProfile , eColorFormat inputFormat,
const ScColorProfile& outputProfile, eColorFormat outputFormat,
eRenderIntent renderIntent, long transformFlags);
ScColorTransform createProofingTransform(const ScColorProfile& inputProfile , eColorFormat inputFormat,
const ScColorProfile& outputProfile, eColorFormat outputFormat,
const ScColorProfile& proofingProfile, eRenderIntent renderIntent,
eRenderIntent proofingIntent, long transformFlags);
// color engine equality operator function
bool operator==(const ScColorMgmtEngine& other) const;
bool operator!=(const ScColorMgmtEngine& other) const;
protected:
QSharedPointer<ScColorMgmtEngineData> m_data;
};
 
#endif
/trunk/Scribus/scribus/colormgmt/sclcmscolormgmtengineimpl.h
0,0 → 1,76
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
 
#ifndef SCLCMSCOLORMGMTENGINEIMPL_H
#define SCLCMSCOLORMGMTENGINEIMPL_H
 
#include <stdexcept>
 
#include "lcms.h"
#include "sccolormgmtenginedata.h"
#include "sccolorprofilecache.h"
 
class ScLcmsColorMgmtEngineImpl : public ScColorMgmtEngineData
{
friend class ScLcmsColorTransformImpl;
 
public:
ScLcmsColorMgmtEngineImpl();
 
// Setter, only for color management strategy
virtual void setStrategy(const ScColorMgmtStrategy& strategy);
 
// function for getting available profile in a directory
virtual QList<ScColorProfileInfo> getAvailableProfileInfo(const QString& directory, bool recursive);
// functions for opening icc profiles
virtual ScColorProfile openProfileFromFile(ScColorMgmtEngine& engine, const QString& filePath);
virtual ScColorProfile openProfileFromMem (ScColorMgmtEngine& engine, const QByteArray& array);
// functions for creating profiles
virtual ScColorProfile createProfile_sRGB(ScColorMgmtEngine& engine);
virtual ScColorProfile createProfile_Lab (ScColorMgmtEngine& engine);
// functions for creating transforms
virtual ScColorTransform createTransform(ScColorMgmtEngine& colorManagementEngine,
const ScColorProfile& inputProfile , eColorFormat inputFormat,
const ScColorProfile& outputProfile, eColorFormat outputFormat,
eRenderIntent renderIntent, long transformFlags);
virtual ScColorTransform createProofingTransform(ScColorMgmtEngine& colorManagementEngine,
const ScColorProfile& inputProfile , eColorFormat inputFormat,
const ScColorProfile& outputProfile, eColorFormat outputFormat,
const ScColorProfile& proofing, eRenderIntent renderIntent,
eRenderIntent proofingIntent, long transformFlags);
 
protected:
 
// Color profile cache
static QSharedPointer<ScColorProfileCache> m_profileCache;
 
// Color transform cache
static QSharedPointer<ScColorTransformPool> m_transformPool;
 
static DWORD translateFlagsToLcmsFlags(long flags);
static DWORD translateFormatToLcmsFormat(eColorFormat format);
static int translateIntentToLcmsIntent(eRenderIntent intent, eRenderIntent defaut = Intent_Relative_Colorimetric);
 
// Exception class thrown by cmsErrorHandler
class lcmsException : public std::runtime_error
{
public :
lcmsException(const char* msg) : std::runtime_error(msg) {}
};
 
/*!
\brief Simple error handler for use in conjunction with littlecms
\param ErrorCode error code issued by little cms
\param ErrorText error message corresponding to the error code
*/
static int cmsErrorHandler(int ErrorCode, const char *ErrorText);
};
 
#endif
/trunk/Scribus/scribus/colormgmt/sccolormgmtstructs.h
0,0 → 1,89
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
#ifndef SCCOLORMGMTSTRUCTS_H
#define SCCOLORMGMTSTRUCTS_H
 
#include "icc34.h" //part of lcms1
#include <QString>
 
typedef enum
{
Format_Undefined,
Format_RGB_8,
Format_RGB_16,
Format_RGBA_8,
Format_RGBA_16,
Format_ARGB_8,
Format_ARGB_16,
Format_BGRA_8,
Format_BGRA_16,
Format_CMYK_8,
Format_CMYK_16,
Format_CMYKA_8,
Format_CMYKA_16,
Format_YMCK_8,
Format_YMCK_16,
Format_GRAY_8,
Format_GRAY_16,
Format_LabA_8
} eColorFormat;
 
typedef enum
{
Ctf_BlackPointCompensation = 1,
Ctf_BlackPreservation = 2,
Ctf_Softproofing = 4,
Ctf_GamutCheck = 8
} eColorTransformFlags;
 
typedef enum
{
Intent_Perceptual = 0,
Intent_Relative_Colorimetric = 1,
Intent_Saturation = 2,
Intent_Absolute_Colorimetric = 3,
Intent_Max = 4
} eRenderIntent;
 
class ScColorMgmtStrategy
{
public:
bool useBlackPointCompensation;
bool useBlackPreservation;
ScColorMgmtStrategy ()
{
useBlackPointCompensation = true;
useBlackPreservation = false;
}
};
 
typedef struct
{
QString file;
QString description;
icColorSpaceSignature colorSpace;
icProfileClassSignature deviceClass;
QString debug;
} ScColorProfileInfo;
 
typedef struct
{
QString inputProfile;
QString outputProfile;
QString proofingProfile;
eColorFormat inputFormat;
eColorFormat outputFormat;
eRenderIntent renderIntent;
eRenderIntent proofingIntent;
long flags;
} ScColorTransformInfo;
 
bool operator==(const ScColorTransformInfo& v1, const ScColorTransformInfo& v2);
 
#endif
/trunk/Scribus/scribus/colormgmt/sclcmscolorprofileimpl.cpp
0,0 → 1,61
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
 
#include "sclcmscolorprofileimpl.h"
 
ScLcmsColorProfileImpl::ScLcmsColorProfileImpl(ScColorMgmtEngine& engine, cmsHPROFILE lcmsProfile)
: ScColorProfileImplBase(engine), m_profileHandle(lcmsProfile)
{
 
}
 
ScLcmsColorProfileImpl::~ScLcmsColorProfileImpl()
{
closeProfile();
}
 
bool ScLcmsColorProfileImpl::isNull() const
{
return (m_profileHandle == NULL);
}
 
icColorSpaceSignature ScLcmsColorProfileImpl::colorSpace() const
{
if (m_profileHandle)
return cmsGetColorSpace(m_profileHandle);
return ((icColorSpaceSignature) 0);
}
 
icProfileClassSignature ScLcmsColorProfileImpl::deviceClass() const
{
if (m_profileHandle)
return cmsGetDeviceClass(m_profileHandle);
return ((icProfileClassSignature) 0);
}
 
QString ScLcmsColorProfileImpl::productDescription() const
{
if (m_productDescription.isEmpty())
{
if (m_profileHandle)
{
const char* desc = cmsTakeProductDesc(m_profileHandle);
m_productDescription = QString(desc);
return m_productDescription;
}
}
return m_productDescription;
}
 
void ScLcmsColorProfileImpl::closeProfile(void)
{
if (m_profileHandle)
{
cmsCloseProfile(m_profileHandle);
m_profileHandle = NULL;
}
}
/trunk/Scribus/scribus/colormgmt/sccolortransformpool.cpp
0,0 → 1,75
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
 
#include <QSharedPointer>
#include "sccolormgmtengine.h"
#include "sccolormgmtstructs.h"
#include "sccolortransformpool.h"
 
ScColorTransformPool::ScColorTransformPool(int engineID) : m_engineID(engineID)
{
 
}
 
void ScColorTransformPool::clear(void)
{
m_pool.clear();
}
 
void ScColorTransformPool::addTransform(const ScColorTransform& transform, bool force)
{
// Check engine ID. If different, transform was created by another engine
// and we MUST NOT add it to the transform pool
if (m_engineID != transform.engine().engineID())
return;
ScColorTransform trans;
if (!force)
trans = findTransform(transform.transformInfo());
if (trans.isNull())
m_pool.append(transform.weakRef());
}
 
void ScColorTransformPool::removeTransform(const ScColorTransform& transform)
{
if (m_engineID != transform.engine().engineID())
return;
m_pool.removeOne(transform.strongRef());
}
 
void ScColorTransformPool::removeTransform(const ScColorTransformInfo& info)
{
QList< QWeakPointer<ScColorTransformData> >::Iterator it = m_pool.begin();
while (it != m_pool.end())
{
QSharedPointer<ScColorTransformData> ref = it->toStrongRef();
if ((info == ref->transformInfo()) || ref.isNull())
{
it = m_pool.erase(it);
continue;
}
++it;
}
}
 
ScColorTransform ScColorTransformPool::findTransform(const ScColorTransformInfo& info) const
{
ScColorTransform transform(NULL);
QList< QWeakPointer<ScColorTransformData> >::ConstIterator it = m_pool.begin();
for ( ; it != m_pool.end(); ++it)
{
QSharedPointer<ScColorTransformData> ref = it->toStrongRef();
if (!ref.isNull())
{
if (info == ref->transformInfo())
{
transform = ScColorTransform(ref);
break;
}
}
}
return transform;
}
/trunk/Scribus/scribus/colormgmt/sccolorprofile.h
0,0 → 1,48
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
#ifndef SCCOLORPROFILE_H
#define SCCOLORPROFILE_H
 
#include <QSharedPointer>
#include <QWeakPointer>
#include "scribusapi.h"
#include "sccolorprofiledata.h"
 
class SCRIBUS_API ScColorProfile
{
friend class ScColorProfileCache;
 
public:
ScColorProfile();
ScColorProfile(ScColorProfileData*);
ScColorProfile(const QSharedPointer<ScColorProfileData>&);
ScColorMgmtEngine& engine() { return m_data->engine(); }
const ScColorMgmtEngine& engine() const { return m_data->engine(); }
inline bool isNull() const { return (m_data.isNull() || m_data->isNull()); }
inline operator bool () const { return !isNull(); }
 
QString profilePath() const;
QString productDescription() const;
icColorSpaceSignature colorSpace() const;
icProfileClassSignature deviceClass() const;
const ScColorProfileData* data() const { return m_data.data(); }
 
bool operator==(const ScColorProfile& prof) const;
protected:
QSharedPointer<ScColorProfileData> m_data;
 
QWeakPointer<ScColorProfileData> weakRef() const { return m_data.toWeakRef(); }
QSharedPointer<ScColorProfileData> strongRef() const { return m_data; }
};
 
#endif
/trunk/Scribus/scribus/colormgmt/sclcmscolorprofileimpl.h
0,0 → 1,38
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
 
#ifndef SCLCMSCOLORPROFILEIMPL_H
#define SCLCMSCOLORPROFILEIMPL_H
 
#include <QString>
 
#include "lcms.h"
#include "sccolormgmtimplelem.h"
#include "sccolorprofiledata.h"
 
class ScLcmsColorProfileImpl : public ScColorProfileImplBase
{
friend class ScLcmsColorMgmtEngineImpl;
 
public:
ScLcmsColorProfileImpl(ScColorMgmtEngine& engine, cmsHPROFILE lcmsProfile);
virtual ~ScLcmsColorProfileImpl();
 
virtual bool isNull() const;
 
virtual icColorSpaceSignature colorSpace() const;
virtual icProfileClassSignature deviceClass() const;
virtual QString productDescription() const;
 
protected:
cmsHPROFILE m_profileHandle;
mutable QString m_productDescription;
 
void closeProfile(void);
};
 
#endif
/trunk/Scribus/scribus/colormgmt/CMakeLists.txt
0,0 → 1,27
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/scribus
${LCMS_INCLUDE_DIR}
)
 
SET(SCRIBUS_COLORMGMT_LIB_SOURCES
sccolormgmtengine.cpp
sccolormgmtenginefactory.cpp
sccolormgmtimplelem.cpp
sccolormgmtstructs.cpp
sccolorprofile.cpp
sccolorprofilecache.cpp
sccolortransform.cpp
sccolortransformpool.cpp
sclcmscolormgmtengineimpl.cpp
sclcmscolorprofileimpl.cpp
sclcmscolortransformimpl.cpp
)
SET(SCRIBUS_COLORMGMT_LIB "scribus_colormgmt_lib")
ADD_LIBRARY(${SCRIBUS_COLORMGMT_LIB} STATIC ${SCRIBUS_COLORMGMT_LIB_SOURCES})
# This is a convenience library that for linkage purposes is part of Scribus's
# main API.
SET_TARGET_PROPERTIES(${SCRIBUS_COLORMGMT_LIB}
PROPERTIES
COMPILE_FLAGS -DCOMPILE_SCRIBUS_MAIN_APP
)
/trunk/Scribus/scribus/colormgmt/sccolortransform.cpp
0,0 → 1,40
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
 
#include "sccolortransform.h"
 
ScColorTransform::ScColorTransform() : m_data(NULL)
{
}
 
ScColorTransform::ScColorTransform(ScColorTransformData* data) : m_data(data)
{
}
 
ScColorTransform::ScColorTransform(const QSharedPointer<ScColorTransformData>& data) : m_data(data)
{
}
 
bool ScColorTransform::apply(void* input, void* output, uint numElem)
{
return m_data->apply(input, output, numElem);
}
 
bool ScColorTransform::apply(QByteArray& input, QByteArray& output, uint numElem)
{
return m_data->apply(input, output, numElem);
}
 
void ScColorTransform::changeBufferFormat(eColorFormat input, eColorFormat output)
{
return m_data->changeBufferFormat(input, output);
}
 
bool ScColorTransform::operator==(const ScColorTransform& other) const
{
return m_data == other.m_data;
}
/trunk/Scribus/scribus/colormgmt/sccolorprofilecache.cpp
0,0 → 1,41
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
#include "sccolorprofilecache.h"
 
void ScColorProfileCache::addProfile(const ScColorProfile& profile)
{
QString path = profile.profilePath();
if (!path.isEmpty())
{
if (!m_profileMap.contains(path))
m_profileMap.insert(path, profile.weakRef());
}
}
 
void ScColorProfileCache::removeProfile(const QString& profilePath)
{
m_profileMap.remove(profilePath);
}
 
void ScColorProfileCache::removeProfile(const ScColorProfile& profile)
{
m_profileMap.remove(profile.profilePath());
}
bool ScColorProfileCache::contains(const QString& profilePath)
{
return m_profileMap.contains(profilePath);
}
 
ScColorProfile ScColorProfileCache::profile(const QString& profilePath)
{
ScColorProfile profile;
QMap<QString, QWeakPointer<ScColorProfileData> >::iterator iter = m_profileMap.find(profilePath);
if (iter != m_profileMap.end())
profile = ScColorProfile(iter.value());
return profile;
}
/trunk/Scribus/scribus/colormgmt/sccolorprofilecache.h
0,0 → 1,30
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
 
#ifndef SCCOLORPROFILECACHE_H
#define SCCOLORPROFILECACHE_H
 
#include <QMap>
#include <QString>
#include <QWeakPointer>
#include "sccolorprofile.h"
 
class ScColorProfileCache
{
public:
void addProfile(const ScColorProfile& profile);
void removeProfile(const QString& profilePath);
void removeProfile(const ScColorProfile& profile);
bool contains(const QString& profilePath);
ScColorProfile profile(const QString& profilePath);
 
protected:
QMap<QString, QWeakPointer<ScColorProfileData> > m_profileMap;
};
 
#endif
/trunk/Scribus/scribus/colormgmt/sccolorprofile.cpp
0,0 → 1,53
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
 
#include "sccolorprofile.h"
 
ScColorProfile::ScColorProfile() : m_data(NULL)
{
}
 
ScColorProfile::ScColorProfile(ScColorProfileData* data) : m_data(data)
{
}
 
ScColorProfile::ScColorProfile(const QSharedPointer<ScColorProfileData>& data) : m_data(data)
{
}
 
icColorSpaceSignature ScColorProfile::colorSpace() const
{
if (m_data)
return m_data->colorSpace();
return ((icColorSpaceSignature) 0);
}
 
icProfileClassSignature ScColorProfile::deviceClass() const
{
if (m_data)
return m_data->deviceClass();
return ((icProfileClassSignature) 0);
}
 
QString ScColorProfile::profilePath() const
{
if (m_data)
return m_data->path();
return QString();
}
 
QString ScColorProfile::productDescription() const
{
if (m_data)
return m_data->productDescription();
return QString();
}
 
bool ScColorProfile::operator==(const ScColorProfile& other) const
{
return m_data == other.m_data;
}
/trunk/Scribus/scribus/plugins/scriptplugin/objpdffile.cpp
5,7 → 5,7
for which a new license (GPL+exception) is in place.
*/
#include "objpdffile.h"
#include "colormngt/sccolormngtengine.h"
#include "colormgmt/sccolormgmtengine.h"
#include "cmdutil.h"
#include "prefsmanager.h"
#include "scribusdoc.h"
/trunk/Scribus/scribus/cmsettings.h
32,7 → 32,7
#include <QString>
class ScribusDoc;
 
#include "colormngt/sccolormngtengine.h"
#include "colormgmt/sccolormgmtengine.h"
 
class SCRIBUS_API CMSettings
{
/trunk/Scribus/scribus/CMakeLists.txt
4,7 → 4,7
 
ADD_SUBDIRECTORY(dtd)
ADD_SUBDIRECTORY(manpages)
ADD_SUBDIRECTORY(colormngt)
ADD_SUBDIRECTORY(colormgmt)
ADD_SUBDIRECTORY(desaxe)
ADD_SUBDIRECTORY(fonts)
ADD_SUBDIRECTORY(styles)
817,7 → 817,7
)
 
LINK_DIRECTORIES(
${CMAKE_CURRENT_BINARY_DIR}/colormngt
${CMAKE_CURRENT_BINARY_DIR}/colormgmt
${CMAKE_CURRENT_BINARY_DIR}/desaxe
${CMAKE_CURRENT_BINARY_DIR}/fonts
${CMAKE_CURRENT_BINARY_DIR}/styles
829,7 → 829,7
LINK_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR}/prc )
ENDIF (HAVE_OSG)
 
SET(SCRIBUS_COLORMNGT_LIB "scribus_colormngt_lib")
SET(SCRIBUS_COLORMGMT_LIB "scribus_colormgmt_lib")
SET(SCRIBUS_TEXT_LIB "scribus_text_lib")
SET(SCRIBUS_STYLES_LIB "scribus_styles_lib")
SET(SCRIBUS_FONTS_LIB "scribus_fonts_lib")
884,7 → 884,7
${SCRIBUS_UI_SOURCES}
${SCRIBUS_TEXT_SOURCES}
${SCRIBUS_STYLES_SOURCES}
${SCRIBUS_COLORMNGT_SOURCES}
${SCRIBUS_COLORMGMT_SOURCES}
${SCRIBUS_FONTS_SOURCES}
${SCRIBUS_DESAXE_SOURCES}
${SCRIBUS_WIN32_ONLY_SOURCES}
899,7 → 899,7
${SCRIBUS_UI_SOURCES}
${SCRIBUS_TEXT_SOURCES}
${SCRIBUS_STYLES_SOURCES}
${SCRIBUS_COLORMNGT_SOURCES}
${SCRIBUS_COLORMGMT_SOURCES}
${SCRIBUS_FONTS_SOURCES}
${SCRIBUS_DESAXE_SOURCES}
${SCRIBUS_WIN32_ONLY_SOURCES}
967,7 → 967,7
ENDIF(APPLE)
 
TARGET_LINK_LIBRARIES(${EXE_NAME}
${SCRIBUS_COLORMNGT_LIB}
${SCRIBUS_COLORMGMT_LIB}
${SCRIBUS_DESAXE_LIB}
${SCRIBUS_TEXT_LIB}
${SCRIBUS_STYLES_LIB}
/trunk/Scribus/win32/vc8/Scribus.vcproj
43,7 → 43,7
Optimization="0"
InlineFunctionExpansion="0"
EnableIntrinsicFunctions="false"
AdditionalIncludeDirectories="..\vc8;..\..\scribus;..\..\scribus\colormngt;..\..\scribus\fonts;..\..\scribus\text;..\..\scribus\styles;..\..\scribus\simpletreemodel;..\..\scribus\ui;&quot;$(QT4_DIR)\include\QtCore&quot;;&quot;$(QT4_DIR)\include\QtGui&quot;;&quot;$(QT4_DIR)\include\QtNetwork&quot;;&quot;$(QT4_DIR)\include\QtWebKit&quot;;&quot;$(QT4_DIR)\include\QtXml&quot;;&quot;$(QT4_DIR)\include&quot;;&quot;$(QT4_DIR)\src\3rdparty\zlib&quot;;&quot;$(LCMS_DIR)\include&quot;;&quot;$(CAIRO_DIR)\include&quot;;&quot;$(FREETYPE_DIR)\include&quot;;&quot;$(LIBJPEG_DIR)\include&quot;;&quot;$(LIBTIFF_DIR)\include&quot;;&quot;$(PODOFO_DIR)\include&quot;"
AdditionalIncludeDirectories="..\vc8;..\..\scribus;..\..\scribus\colormgmt;..\..\scribus\fonts;..\..\scribus\text;..\..\scribus\styles;..\..\scribus\simpletreemodel;..\..\scribus\ui;&quot;$(QT4_DIR)\include\QtCore&quot;;&quot;$(QT4_DIR)\include\QtGui&quot;;&quot;$(QT4_DIR)\include\QtNetwork&quot;;&quot;$(QT4_DIR)\include\QtWebKit&quot;;&quot;$(QT4_DIR)\include\QtXml&quot;;&quot;$(QT4_DIR)\include&quot;;&quot;$(QT4_DIR)\src\3rdparty\zlib&quot;;&quot;$(LCMS_DIR)\include&quot;;&quot;$(CAIRO_DIR)\include&quot;;&quot;$(FREETYPE_DIR)\include&quot;;&quot;$(LIBJPEG_DIR)\include&quot;;&quot;$(LIBTIFF_DIR)\include&quot;;&quot;$(PODOFO_DIR)\include&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;QT_LARGEFILE_SUPPORT;QT_EDITION=QT_EDITION_DESKTOP;QT_DLL;QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT;HAVE_CAIRO;HAVE_CONFIG_H;AVOID_WIN32_FILEIO;COMPILE_SCRIBUS_MAIN_APP;DOCDIR=\&quot;doc/\&quot;;ICONDIR=\&quot;icons/\&quot;;SAMPLESDIR=\&quot;samples/\&quot;;SCRIPTSDIR=\&quot;scripts/\&quot;;SHAREDIR=\&quot;share/\&quot;;TEMPLATEDIR=\&quot;templates/\&quot;;LIBDIR=\&quot;libs/\&quot;;PLUGINDIR=\&quot;plugins\&quot;"
IgnoreStandardIncludePath="false"
MinimalRebuild="true"
136,7 → 136,7
Optimization="2"
InlineFunctionExpansion="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="..\vc8;..\..\scribus;..\..\scribus\colormngt;..\..\scribus\fonts;..\..\scribus\text;..\..\scribus\styles;..\..\scribus\simpletreemodel;..\..\scribus\ui;&quot;$(QT4_DIR)\include\QtCore&quot;;&quot;$(QT4_DIR)\include\QtGui&quot;;&quot;$(QT4_DIR)\include\QtNetwork&quot;;&quot;$(QT4_DIR)\include\QtWebKit&quot;;&quot;$(QT4_DIR)\include\QtXml&quot;;&quot;$(QT4_DIR)\include&quot;;&quot;$(QT4_DIR)\src\3rdparty\zlib&quot;;&quot;$(LCMS_DIR)\include&quot;;&quot;$(CAIRO_DIR)\include&quot;;&quot;$(FREETYPE_DIR)\include&quot;;&quot;$(LIBJPEG_DIR)\include&quot;;&quot;$(LIBTIFF_DIR)\include&quot;;&quot;$(PODOFO_DIR)\include&quot;"
AdditionalIncludeDirectories="..\vc8;..\..\scribus;..\..\scribus\colormgmt;..\..\scribus\fonts;..\..\scribus\text;..\..\scribus\styles;..\..\scribus\simpletreemodel;..\..\scribus\ui;&quot;$(QT4_DIR)\include\QtCore&quot;;&quot;$(QT4_DIR)\include\QtGui&quot;;&quot;$(QT4_DIR)\include\QtNetwork&quot;;&quot;$(QT4_DIR)\include\QtWebKit&quot;;&quot;$(QT4_DIR)\include\QtXml&quot;;&quot;$(QT4_DIR)\include&quot;;&quot;$(QT4_DIR)\src\3rdparty\zlib&quot;;&quot;$(LCMS_DIR)\include&quot;;&quot;$(CAIRO_DIR)\include&quot;;&quot;$(FREETYPE_DIR)\include&quot;;&quot;$(LIBJPEG_DIR)\include&quot;;&quot;$(LIBTIFF_DIR)\include&quot;;&quot;$(PODOFO_DIR)\include&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;QT_LARGEFILE_SUPPORT;QT_EDITION=QT_EDITION_DESKTOP;QT_DLL;QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT;;HAVE_CAIRO;HAVE_CONFIG_H;AVOID_WIN32_FILEIO;COMPILE_SCRIBUS_MAIN_APP;DOCDIR=\&quot;doc/\&quot;;ICONDIR=\&quot;icons/\&quot;;SAMPLESDIR=\&quot;samples/\&quot;;SCRIPTSDIR=\&quot;scripts/\&quot;;SHAREDIR=\&quot;share/\&quot;;TEMPLATEDIR=\&quot;templates/\&quot;;LIBDIR=\&quot;libs/\&quot;;PLUGINDIR=\&quot;plugins\&quot;"
StringPooling="true"
RuntimeLibrary="2"
227,7 → 227,7
Optimization="0"
InlineFunctionExpansion="0"
EnableIntrinsicFunctions="false"
AdditionalIncludeDirectories="..\vc8;..\..\scribus;..\..\scribus\colormngt;..\..\scribus\fonts;..\..\scribus\text;..\..\scribus\styles;..\..\scribus\simpletreemodel;..\..\scribus\ui;&quot;$(QT4_DIR)\include\QtCore&quot;;&quot;$(QT4_DIR)\include\QtGui&quot;;&quot;$(QT4_DIR)\include\QtNetwork&quot;;&quot;$(QT4_DIR)\include\QtWebKit&quot;;&quot;$(QT4_DIR)\include\QtXml&quot;;&quot;$(QT4_DIR)\include&quot;;&quot;$(QT4_DIR)\src\3rdparty\zlib&quot;;&quot;$(LCMS_DIR)\include&quot;;&quot;$(CAIRO_DIR)\include&quot;;&quot;$(FREETYPE_DIR)\include&quot;;&quot;$(LIBJPEG_DIR)\include&quot;;&quot;$(LIBTIFF_DIR)\include&quot;;&quot;$(PODOFO_DIR)\include&quot;"
AdditionalIncludeDirectories="..\vc8;..\..\scribus;..\..\scribus\colormgmt;..\..\scribus\fonts;..\..\scribus\text;..\..\scribus\styles;..\..\scribus\simpletreemodel;..\..\scribus\ui;&quot;$(QT4_DIR)\include\QtCore&quot;;&quot;$(QT4_DIR)\include\QtGui&quot;;&quot;$(QT4_DIR)\include\QtNetwork&quot;;&quot;$(QT4_DIR)\include\QtWebKit&quot;;&quot;$(QT4_DIR)\include\QtXml&quot;;&quot;$(QT4_DIR)\include&quot;;&quot;$(QT4_DIR)\src\3rdparty\zlib&quot;;&quot;$(LCMS_DIR)\include&quot;;&quot;$(CAIRO_DIR)\include&quot;;&quot;$(FREETYPE_DIR)\include&quot;;&quot;$(LIBJPEG_DIR)\include&quot;;&quot;$(LIBTIFF_DIR)\include&quot;;&quot;$(PODOFO_DIR)\include&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;QT_LARGEFILE_SUPPORT;QT_EDITION=QT_EDITION_DESKTOP;QT_DLL;QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT;HAVE_CONFIG_H;AVOID_WIN32_FILEIO;COMPILE_SCRIBUS_MAIN_APP;DOCDIR=\&quot;doc/\&quot;;ICONDIR=\&quot;icons/\&quot;;SAMPLESDIR=\&quot;samples/\&quot;;SCRIPTSDIR=\&quot;scripts/\&quot;;SHAREDIR=\&quot;share/\&quot;;TEMPLATEDIR=\&quot;templates/\&quot;;LIBDIR=\&quot;libs/\&quot;;PLUGINDIR=\&quot;plugins\&quot;"
IgnoreStandardIncludePath="false"
MinimalRebuild="true"
320,7 → 320,7
Optimization="2"
InlineFunctionExpansion="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="..\vc8;..\..\scribus;..\..\scribus\colormngt;..\..\scribus\fonts;..\..\scribus\text;..\..\scribus\styles;..\..\scribus\simpletreemodel;..\..\scribus\ui;&quot;$(QT4_DIR)\include\QtCore&quot;;&quot;$(QT4_DIR)\include\QtGui&quot;;&quot;$(QT4_DIR)\include\QtNetwork&quot;;&quot;$(QT4_DIR)\include\QtWebKit&quot;;&quot;$(QT4_DIR)\include\QtXml&quot;;&quot;$(QT4_DIR)\include&quot;;&quot;$(QT4_DIR)\src\3rdparty\zlib&quot;;&quot;$(LCMS_DIR)\include&quot;;&quot;$(CAIRO_DIR)\include&quot;;&quot;$(FREETYPE_DIR)\include&quot;;&quot;$(LIBJPEG_DIR)\include&quot;;&quot;$(LIBTIFF_DIR)\include&quot;;&quot;$(PODOFO_DIR)\include&quot;"
AdditionalIncludeDirectories="..\vc8;..\..\scribus;..\..\scribus\colormgmt;..\..\scribus\fonts;..\..\scribus\text;..\..\scribus\styles;..\..\scribus\simpletreemodel;..\..\scribus\ui;&quot;$(QT4_DIR)\include\QtCore&quot;;&quot;$(QT4_DIR)\include\QtGui&quot;;&quot;$(QT4_DIR)\include\QtNetwork&quot;;&quot;$(QT4_DIR)\include\QtWebKit&quot;;&quot;$(QT4_DIR)\include\QtXml&quot;;&quot;$(QT4_DIR)\include&quot;;&quot;$(QT4_DIR)\src\3rdparty\zlib&quot;;&quot;$(LCMS_DIR)\include&quot;;&quot;$(CAIRO_DIR)\include&quot;;&quot;$(FREETYPE_DIR)\include&quot;;&quot;$(LIBJPEG_DIR)\include&quot;;&quot;$(LIBTIFF_DIR)\include&quot;;&quot;$(PODOFO_DIR)\include&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;QT_LARGEFILE_SUPPORT;QT_EDITION=QT_EDITION_DESKTOP;QT_DLL;QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT;HAVE_CONFIG_H;AVOID_WIN32_FILEIO;COMPILE_SCRIBUS_MAIN_APP;DOCDIR=\&quot;doc/\&quot;;ICONDIR=\&quot;icons/\&quot;;SAMPLESDIR=\&quot;samples/\&quot;;SCRIPTSDIR=\&quot;scripts/\&quot;;SHAREDIR=\&quot;share/\&quot;;TEMPLATEDIR=\&quot;templates/\&quot;;LIBDIR=\&quot;libs/\&quot;;PLUGINDIR=\&quot;plugins\&quot;"
StringPooling="true"
RuntimeLibrary="2"
20508,107 → 20508,107
Name="colorMgmt"
>
<File
RelativePath="..\..\scribus\colormngt\sccolormngtelem.h"
RelativePath="..\..\scribus\colormgmt\sccolormgmtelem.h"
>
</File>
<File
RelativePath="..\..\scribus\colormngt\sccolormngtengine.cpp"
RelativePath="..\..\scribus\colormgmt\sccolormgmtengine.cpp"
>
</File>
<File
RelativePath="..\..\scribus\colormngt\sccolormngtengine.h"
RelativePath="..\..\scribus\colormgmt\sccolormgmtengine.h"
>
</File>
<File
RelativePath="..\..\scribus\colormngt\sccolormngtenginedata.h"
RelativePath="..\..\scribus\colormgmt\sccolormgmtenginedata.h"
>
</File>
<File
RelativePath="..\..\scribus\colormngt\sccolormngtenginefactory.cpp"
RelativePath="..\..\scribus\colormgmt\sccolormgmtenginefactory.cpp"
>
</File>
<File
RelativePath="..\..\scribus\colormngt\sccolormngtenginefactory.h"
RelativePath="..\..\scribus\colormgmt\sccolormgmtenginefactory.h"
>
</File>
<File
RelativePath="..\..\scribus\colormngt\sccolormngtimplelem.cpp"
RelativePath="..\..\scribus\colormgmt\sccolormgmtimplelem.cpp"
>
</File>
<File
RelativePath="..\..\scribus\colormngt\sccolormngtimplelem.h"
RelativePath="..\..\scribus\colormgmt\sccolormgmtimplelem.h"
>
</File>
<File
RelativePath="..\..\scribus\colormngt\sccolormngtstructs.cpp"
RelativePath="..\..\scribus\colormgmt\sccolormgmtstructs.cpp"
>
</File>
<File
RelativePath="..\..\scribus\colormngt\sccolormngtstructs.h"
RelativePath="..\..\scribus\colormgmt\sccolormgmtstructs.h"
>
</File>
<File
RelativePath="..\..\scribus\colormngt\sccolorprofile.cpp"
RelativePath="..\..\scribus\colormgmt\sccolorprofile.cpp"
>
</File>
<File
RelativePath="..\..\scribus\colormngt\sccolorprofile.h"
RelativePath="..\..\scribus\colormgmt\sccolorprofile.h"
>
</File>
<File
RelativePath="..\..\scribus\colormngt\sccolorprofilecache.cpp"
RelativePath="..\..\scribus\colormgmt\sccolorprofilecache.cpp"
>
</File>
<File
RelativePath="..\..\scribus\colormngt\sccolorprofilecache.h"
RelativePath="..\..\scribus\colormgmt\sccolorprofilecache.h"
>
</File>
<File
RelativePath="..\..\scribus\colormngt\sccolorprofiledata.h"
RelativePath="..\..\scribus\colormgmt\sccolorprofiledata.h"
>
</File>
<File
RelativePath="..\..\scribus\colormngt\sccolortransform.cpp"
RelativePath="..\..\scribus\colormgmt\sccolortransform.cpp"
>
</File>
<File
RelativePath="..\..\scribus\colormngt\sccolortransform.h"
RelativePath="..\..\scribus\colormgmt\sccolortransform.h"
>
</File>
<File
RelativePath="..\..\scribus\colormngt\sccolortransformdata.h"
RelativePath="..\..\scribus\colormgmt\sccolortransformdata.h"
>
</File>
<File
RelativePath="..\..\scribus\colormngt\sccolortransformpool.cpp"
RelativePath="..\..\scribus\colormgmt\sccolortransformpool.cpp"
>
</File>
<File
RelativePath="..\..\scribus\colormngt\sccolortransformpool.h"
RelativePath="..\..\scribus\colormgmt\sccolortransformpool.h"
>
</File>
<File
RelativePath="..\..\scribus\colormngt\sclcmscolormngtengineimpl.cpp"
RelativePath="..\..\scribus\colormgmt\sclcmscolormgmtengineimpl.cpp"
>
</File>
<File
RelativePath="..\..\scribus\colormngt\sclcmscolormngtengineimpl.h"
RelativePath="..\..\scribus\colormgmt\sclcmscolormgmtengineimpl.h"
>
</File>
<File
RelativePath="..\..\scribus\colormngt\sclcmscolorprofileimpl.cpp"
RelativePath="..\..\scribus\colormgmt\sclcmscolorprofileimpl.cpp"
>
</File>
<File
RelativePath="..\..\scribus\colormngt\sclcmscolorprofileimpl.h"
RelativePath="..\..\scribus\colormgmt\sclcmscolorprofileimpl.h"
>
</File>
<File
RelativePath="..\..\scribus\colormngt\sclcmscolortransformimpl.cpp"
RelativePath="..\..\scribus\colormgmt\sclcmscolortransformimpl.cpp"
>
</File>
<File
RelativePath="..\..\scribus\colormngt\sclcmscolortransformimpl.h"
RelativePath="..\..\scribus\colormgmt\sclcmscolortransformimpl.h"
>
</File>
</Filter>