r15706 by jghali - #9438 : crash when loading image

scribus-commit scribus-commit at lists.scribus.net
Sun Oct 31 11:44:16 CET 2010


Author: jghali
Date: Sun Oct 31 10:44:16 2010
New Revision: 15706

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=15706
Log:
#9438 : crash when loading image
Provide better protection against lcms errors by backporting a simplified form of 1.5.0svn color management code

Added:
    branches/Version135/Scribus/scribus/colormgmt/
    branches/Version135/Scribus/scribus/colormgmt/sccolormgmtengine.cpp
    branches/Version135/Scribus/scribus/colormgmt/sccolormgmtengine.h
    branches/Version135/Scribus/scribus/colormgmt/sccolormgmtenginedata.h
    branches/Version135/Scribus/scribus/colormgmt/sccolormgmtstructs.cpp
    branches/Version135/Scribus/scribus/colormgmt/sccolormgmtstructs.h
    branches/Version135/Scribus/scribus/colormgmt/sccolorprofile.cpp
    branches/Version135/Scribus/scribus/colormgmt/sccolorprofile.h
    branches/Version135/Scribus/scribus/colormgmt/sccolorprofilecache.cpp
    branches/Version135/Scribus/scribus/colormgmt/sccolorprofilecache.h
    branches/Version135/Scribus/scribus/colormgmt/sccolorprofiledata.cpp
    branches/Version135/Scribus/scribus/colormgmt/sccolorprofiledata.h
    branches/Version135/Scribus/scribus/colormgmt/sccolortransform.cpp
    branches/Version135/Scribus/scribus/colormgmt/sccolortransform.h
    branches/Version135/Scribus/scribus/colormgmt/sccolortransformdata.h
    branches/Version135/Scribus/scribus/colormgmt/sccolortransformpool.cpp
    branches/Version135/Scribus/scribus/colormgmt/sccolortransformpool.h
    branches/Version135/Scribus/scribus/colormgmt/sclcmscolormgmtengineimpl.cpp
    branches/Version135/Scribus/scribus/colormgmt/sclcmscolormgmtengineimpl.h
    branches/Version135/Scribus/scribus/colormgmt/sclcmscolorprofileimpl.cpp
    branches/Version135/Scribus/scribus/colormgmt/sclcmscolorprofileimpl.h
    branches/Version135/Scribus/scribus/colormgmt/sclcmscolortransformimpl.cpp
    branches/Version135/Scribus/scribus/colormgmt/sclcmscolortransformimpl.h
Modified:
    branches/Version135/Scribus/scribus/CMakeLists.txt
    branches/Version135/Scribus/scribus/annot.cpp
    branches/Version135/Scribus/scribus/canvas.cpp
    branches/Version135/Scribus/scribus/canvasgesture_resize.cpp
    branches/Version135/Scribus/scribus/cmsettings.cpp
    branches/Version135/Scribus/scribus/cmsettings.h
    branches/Version135/Scribus/scribus/cmsprefs.cpp
    branches/Version135/Scribus/scribus/customfdialog.cpp
    branches/Version135/Scribus/scribus/effectsdialog.cpp
    branches/Version135/Scribus/scribus/hruler.cpp
    branches/Version135/Scribus/scribus/main_win32.cpp
    branches/Version135/Scribus/scribus/pageitem.cpp
    branches/Version135/Scribus/scribus/pageitem.h
    branches/Version135/Scribus/scribus/pageitem_desaxe.cpp
    branches/Version135/Scribus/scribus/pageitem_pathtext.cpp
    branches/Version135/Scribus/scribus/pageitem_polyline.cpp
    branches/Version135/Scribus/scribus/pageitem_textframe.cpp
    branches/Version135/Scribus/scribus/pdflib_core.cpp
    branches/Version135/Scribus/scribus/pdflib_core.h
    branches/Version135/Scribus/scribus/pdfopts.cpp
    branches/Version135/Scribus/scribus/picsearch.cpp
    branches/Version135/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
    branches/Version135/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
    branches/Version135/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format_save.cpp
    branches/Version135/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
    branches/Version135/Scribus/scribus/plugins/import/ai/importai.cpp
    branches/Version135/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp
    branches/Version135/Scribus/scribus/plugins/import/ps/importps.cpp
    branches/Version135/Scribus/scribus/plugins/import/svg/svgplugin.cpp
    branches/Version135/Scribus/scribus/plugins/import/xfig/importxfig.cpp
    branches/Version135/Scribus/scribus/plugins/scriptplugin/objpdffile.cpp
    branches/Version135/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp
    branches/Version135/Scribus/scribus/plugins/tools/2geomtools/meshdistortion/meshdistortion.cpp
    branches/Version135/Scribus/scribus/plugins/tools/2geomtools/meshdistortion/meshdistortiondialog.cpp
    branches/Version135/Scribus/scribus/plugins/tools/2geomtools/pathalongpath/pathalongpath.h
    branches/Version135/Scribus/scribus/plugins/tools/lenseffects/lensdialog.cpp
    branches/Version135/Scribus/scribus/plugins/tools/pathstroker/pathstroker.cpp
    branches/Version135/Scribus/scribus/plugins/tools/transform/transformdialog.cpp
    branches/Version135/Scribus/scribus/prefsmanager.cpp
    branches/Version135/Scribus/scribus/preview.cpp
    branches/Version135/Scribus/scribus/propertiespalette.cpp
    branches/Version135/Scribus/scribus/pslib.cpp
    branches/Version135/Scribus/scribus/pslib.h
    branches/Version135/Scribus/scribus/sccolorengine.cpp
    branches/Version135/Scribus/scribus/scdocoutput_ps2.cpp
    branches/Version135/Scribus/scribus/scdocoutput_ps2.h
    branches/Version135/Scribus/scribus/scimage.cpp
    branches/Version135/Scribus/scribus/scimgdataloader_jpeg.cpp
    branches/Version135/Scribus/scribus/scimgdataloader_ps.cpp
    branches/Version135/Scribus/scribus/scimgdataloader_psd.cpp
    branches/Version135/Scribus/scribus/scimgdataloader_tiff.cpp
    branches/Version135/Scribus/scribus/scpainterex_ps2.cpp
    branches/Version135/Scribus/scribus/scpainterex_ps2.h
    branches/Version135/Scribus/scribus/scpreview.cpp
    branches/Version135/Scribus/scribus/scribus.cpp
    branches/Version135/Scribus/scribus/scribusXml.cpp
    branches/Version135/Scribus/scribus/scribuscore.cpp
    branches/Version135/Scribus/scribus/scribuscore.h
    branches/Version135/Scribus/scribus/scribusdoc.cpp
    branches/Version135/Scribus/scribus/scribusdoc.h
    branches/Version135/Scribus/scribus/scribusstructs.h
    branches/Version135/Scribus/scribus/scribusview.cpp
    branches/Version135/Scribus/scribus/util.cpp
    branches/Version135/Scribus/scribus/util_color.cpp
    branches/Version135/Scribus/scribus/util_ghostscript.cpp
    branches/Version135/Scribus/scribus/vruler.cpp
    branches/Version135/Scribus/win32/vc8/Scribus-1.3.x.vcproj

Modified: branches/Version135/Scribus/scribus/CMakeLists.txt
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/CMakeLists.txt
==============================================================================
--- branches/Version135/Scribus/scribus/CMakeLists.txt (original)
+++ branches/Version135/Scribus/scribus/CMakeLists.txt Sun Oct 31 10:44:16 2010
@@ -5,6 +5,7 @@
 ADD_SUBDIRECTORY(doc)
 ADD_SUBDIRECTORY(dtd)
 ADD_SUBDIRECTORY(manpages)
+ADD_SUBDIRECTORY(colormgmt)
 ADD_SUBDIRECTORY(profiles)
 ADD_SUBDIRECTORY(styles)
 ADD_SUBDIRECTORY(text)
@@ -655,12 +656,14 @@
 	)
 
 LINK_DIRECTORIES(
+  ${CMAKE_CURRENT_BINARY_DIR}/colormgmt
   ${CMAKE_CURRENT_BINARY_DIR}/desaxe
   ${CMAKE_CURRENT_BINARY_DIR}/text
   ${CMAKE_CURRENT_BINARY_DIR}/styles
   ${CMAKE_CURRENT_BINARY_DIR}/fonts
 )
 
+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")
@@ -701,6 +704,7 @@
   ${SCRIBUS_UI_SOURCES}
   ${SCRIBUS_TEXT_SOURCES}
   ${SCRIBUS_STYLES_SOURCES}
+  ${SCRIBUS_COLORMGMT_SOURCES}
   ${SCRIBUS_FONTS_SOURCES}
   ${SCRIBUS_DESAXE_SOURCES}
   ${SCRIBUS_WIN32_ONLY_SOURCES}
@@ -783,6 +787,7 @@
 ENDIF(APPLE)
 
 TARGET_LINK_LIBRARIES(${EXE_NAME}
+  ${SCRIBUS_COLORMGMT_LIB}
   ${SCRIBUS_DESAXE_LIB}
   ${SCRIBUS_TEXT_LIB}
   ${SCRIBUS_STYLES_LIB}

Modified: branches/Version135/Scribus/scribus/annot.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/annot.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/annot.cpp (original)
+++ branches/Version135/Scribus/scribus/annot.cpp Sun Oct 31 10:44:16 2010
@@ -385,7 +385,7 @@
 	{
 		QPixmap pmI1;
 		ScImage im;
-		CMSettings cms(view->Doc, "", 0);
+		CMSettings cms(view->Doc, "", Intent_Perceptual);
 		if (!item->Pfile.isEmpty())
 		{
 			im.LoadPicture(item->Pfile, 1, cms, false, false, ScImage::RGBData, 72);
@@ -1309,7 +1309,7 @@
 	{
 		dirs->set("icon", fileName.left(fileName.lastIndexOf("/")));
 		QPixmap pmI1;
-		CMSettings cms(view->Doc, "", 0);
+		CMSettings cms(view->Doc, "", Intent_Perceptual);
 		item->pixm.LoadPicture(fileName, 1, cms, false, false, ScImage::RGBData, 72);
 		pmI1=QPixmap::fromImage(item->pixm.qImage());
 		NiconPrev->setPixmap(pmI1);
@@ -1341,7 +1341,7 @@
 		dirs->set("icon", fileName.left(fileName.lastIndexOf("/")));
 		QPixmap pmI1;
 		ScImage im;
-		CMSettings cms(view->Doc, "",0 );
+		CMSettings cms(view->Doc, "", Intent_Perceptual);
 		im.LoadPicture(fileName, 1, cms, false, false, ScImage::RGBData, 72);
 		pmI1=QPixmap::fromImage(im.qImage());
 		PiconPrev->setPixmap(pmI1);
@@ -1365,7 +1365,7 @@
 		dirs->set("icon", fileName.left(fileName.lastIndexOf("/")));
 		QPixmap pmI1;
 		ScImage im;
-		CMSettings cms(view->Doc, "", 0);
+		CMSettings cms(view->Doc, "", Intent_Perceptual);
 		im.LoadPicture(fileName, 1, cms, false, false, ScImage::RGBData, 72);
 		pmI1=QPixmap::fromImage(im.qImage());
 		RiconPrev->setPixmap(pmI1);

Modified: branches/Version135/Scribus/scribus/canvas.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/canvas.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/canvas.cpp (original)
+++ branches/Version135/Scribus/scribus/canvas.cpp Sun Oct 31 10:44:16 2010
@@ -13,6 +13,10 @@
 *                                                                         *
 ***************************************************************************/
 
+#if defined(_MSC_VER)
+#define _USE_MATH_DEFINES
+#endif
+#include <cmath>
 
 // #include <QDebug>
 #include <QToolTip>

Modified: branches/Version135/Scribus/scribus/canvasgesture_resize.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/canvasgesture_resize.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/canvasgesture_resize.cpp (original)
+++ branches/Version135/Scribus/scribus/canvasgesture_resize.cpp Sun Oct 31 10:44:16 2010
@@ -12,6 +12,11 @@
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/
+
+#if defined(_MSC_VER)
+#define _USE_MATH_DEFINES
+#endif
+#include <cmath>
 
 #include "canvasgesture_resize.h"
 

Modified: branches/Version135/Scribus/scribus/cmsettings.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/cmsettings.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/cmsettings.cpp (original)
+++ branches/Version135/Scribus/scribus/cmsettings.cpp Sun Oct 31 10:44:16 2010
@@ -27,7 +27,7 @@
 #include "cmsettings.h"
 #include "scribusdoc.h"
 
-CMSettings::CMSettings(ScribusDoc* doc, const QString& profileName, int intent) :
+CMSettings::CMSettings(ScribusDoc* doc, const QString& profileName, eRenderIntent intent) :
 m_Doc(doc),
 m_ProfileName(profileName), 
 m_Intent(intent)
@@ -87,18 +87,18 @@
 	return QString();
 }
 
-int CMSettings::colorRenderingIntent() const
+eRenderIntent CMSettings::colorRenderingIntent() const
 {
 	if (m_Doc)
 		return m_Doc->IntentColors;
-	return 1; // Use relative colorimetric by default
-}
-
-int CMSettings::imageRenderingIntent() const
+	return Intent_Relative_Colorimetric; // Use relative colorimetric by default
+}
+
+eRenderIntent CMSettings::imageRenderingIntent() const
 {
 	if (m_Doc)
 		return m_Doc->IntentImages;
-	return 0; // Use perceptual by default
+	return Intent_Perceptual; // Use perceptual by default
 }
 
 bool CMSettings::useBlackPoint() const
@@ -122,91 +122,91 @@
 	return false;
 }
 
-cmsHPROFILE CMSettings::monitorProfile() const
+ScColorProfile CMSettings::monitorProfile() const
 {
 	if (m_Doc)
 		return m_Doc->DocOutputProf;
 	return NULL;
 }
 
-cmsHPROFILE CMSettings::printerProfile() const
+ScColorProfile CMSettings::printerProfile() const
 {
 	if (m_Doc)
 		return m_Doc->DocPrinterProf;
 	return NULL;
 }
 
-cmsHTRANSFORM CMSettings::rgbColorDisplayTransform() const  // stdTransRGBMonG
+ScColorTransform CMSettings::rgbColorDisplayTransform() const  // stdTransRGBMonG
 {
 	if (m_Doc)
 		return m_Doc->stdTransRGBMon;
 	return NULL;
 }
 
-cmsHTRANSFORM CMSettings::rgbColorProofingTransform() const  // stdProofG
+ScColorTransform CMSettings::rgbColorProofingTransform() const  // stdProofG
 {
 	if (m_Doc)
 		return m_Doc->stdProof;
 	return NULL;
 }
 
-cmsHTRANSFORM CMSettings::rgbImageDisplayTransform() const   // stdTransImgG
+ScColorTransform CMSettings::rgbImageDisplayTransform() const   // stdTransImgG
 {
 	if (m_Doc)
 		return m_Doc->stdTransImg;
 	return NULL;
 }
 
-cmsHTRANSFORM CMSettings::rgbImageProofingTransform() const  // stdProofImgG
+ScColorTransform CMSettings::rgbImageProofingTransform() const  // stdProofImgG
 {
 	if (m_Doc)
 		return m_Doc->stdProofImg;
 	return NULL;
 }
 
-cmsHTRANSFORM CMSettings::rgbToCymkColorTransform() const // stdTransCMYKG
+ScColorTransform CMSettings::rgbToCymkColorTransform() const // stdTransCMYKG
 {
 	if (m_Doc)
 		return m_Doc->stdTransCMYK;
 	return NULL;
 }
 
-cmsHTRANSFORM CMSettings::rgbGamutCheckTransform() const // stdProofGCG
+ScColorTransform CMSettings::rgbGamutCheckTransform() const // stdProofGCG
 {
 	if (m_Doc)
 		return m_Doc->stdProofGC;
 	return NULL;
 }
 
-cmsHTRANSFORM CMSettings::cmykColorDisplayTransform() const // stdTransCMYKMonG
+ScColorTransform CMSettings::cmykColorDisplayTransform() const // stdTransCMYKMonG
 {
 	if (m_Doc)
 		return m_Doc->stdTransCMYKMon;
 	return NULL;
 }
 
-cmsHTRANSFORM CMSettings::cmykColorProofingTransform() const // stdProofCMYKG
+ScColorTransform CMSettings::cmykColorProofingTransform() const // stdProofCMYKG
 {
 	if (m_Doc)
 		return m_Doc->stdProofCMYK;
 	return NULL;
 }
 
-cmsHTRANSFORM CMSettings::cmykImageProofingTransform() const // stdProofImgCMYK
+ScColorTransform CMSettings::cmykImageProofingTransform() const // stdProofImgCMYK
 {
 	if (m_Doc)
 		return m_Doc->stdProofImgCMYK;
 	return NULL;
 }
 
-cmsHTRANSFORM CMSettings::cmykToRgbColorTransform() const  // stdTransRGBG
+ScColorTransform CMSettings::cmykToRgbColorTransform() const  // stdTransRGBG
 {
 	if (m_Doc)
 		return m_Doc->stdTransRGB;
 	return NULL;
 }
 
-cmsHTRANSFORM CMSettings::cmykGamutCheckTransform() const //stdProofCMYKGCG
+ScColorTransform CMSettings::cmykGamutCheckTransform() const //stdProofCMYKGCG
 {
 	if (m_Doc)
 		return m_Doc->stdProofCMYKGC;

Modified: branches/Version135/Scribus/scribus/cmsettings.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/cmsettings.h
==============================================================================
--- branches/Version135/Scribus/scribus/cmsettings.h (original)
+++ branches/Version135/Scribus/scribus/cmsettings.h Sun Oct 31 10:44:16 2010
@@ -30,20 +30,21 @@
 #include "scconfig.h"
 #include "scribusapi.h"
 #include <QString>
+
+#include "colormgmt/sccolorprofile.h"
+#include "colormgmt/sccolortransform.h"
 class ScribusDoc;
-
-#include CMS_INC
 
 class SCRIBUS_API CMSettings
 {
 public:
-	CMSettings(ScribusDoc* doc, const QString& profileName, int intent);
+	CMSettings(ScribusDoc* doc, const QString& profileName, eRenderIntent intent);
 	~CMSettings();
 	
 	ScribusDoc* doc() const {return m_Doc;}
 	QString profileName() const {return m_ProfileName;}
 	QString outputProfile() const { return m_outputProfile; }
-	int intent() const {return m_Intent;}
+	eRenderIntent intent() const {return m_Intent;}
 
 	bool useOutputProfile() const { return !m_outputProfile.isEmpty(); }
 	void setOutputProfile(const QString& prof) { m_outputProfile = prof; }
@@ -57,34 +58,34 @@
 	QString defaultSolidColorRGBProfile() const;
 	QString defaultSolidColorCMYKProfile() const;
 
-	int colorRenderingIntent() const;
-	int imageRenderingIntent() const;
+	eRenderIntent colorRenderingIntent() const;
+	eRenderIntent imageRenderingIntent() const;
 
 	bool useBlackPoint() const;
 	bool doSoftProofing() const;
 	bool doGamutCheck() const;
 
-	cmsHPROFILE monitorProfile() const;
-	cmsHPROFILE printerProfile() const;
+	ScColorProfile monitorProfile() const;
+	ScColorProfile printerProfile() const;
 
-	cmsHTRANSFORM rgbColorDisplayTransform() const;   // stdTransRGBMonG
-	cmsHTRANSFORM rgbColorProofingTransform() const;  // stdProofG
-	cmsHTRANSFORM rgbImageDisplayTransform() const;   // stdTransImgG
-	cmsHTRANSFORM rgbImageProofingTransform() const;  // stdProofImgG
-	cmsHTRANSFORM rgbToCymkColorTransform() const;    // stdTransCMYKG
-	cmsHTRANSFORM rgbGamutCheckTransform() const;     // stdProofGCG
+	ScColorTransform rgbColorDisplayTransform() const;   // stdTransRGBMonG
+	ScColorTransform rgbColorProofingTransform() const;  // stdProofG
+	ScColorTransform rgbImageDisplayTransform() const;   // stdTransImgG
+	ScColorTransform rgbImageProofingTransform() const;  // stdProofImgG
+	ScColorTransform rgbToCymkColorTransform() const;    // stdTransCMYKG
+	ScColorTransform rgbGamutCheckTransform() const;     // stdProofGCG
 
-	cmsHTRANSFORM cmykColorDisplayTransform() const;  // stdTransCMYKMonG
-	cmsHTRANSFORM cmykColorProofingTransform() const; // stdProofCMYKG
-	cmsHTRANSFORM cmykImageProofingTransform() const; // stdProofImgCMYK
-	cmsHTRANSFORM cmykToRgbColorTransform() const;    // stdTransRGBG
-	cmsHTRANSFORM cmykGamutCheckTransform() const;    //stdProofCMYKGCG
+	ScColorTransform cmykColorDisplayTransform() const;  // stdTransCMYKMonG
+	ScColorTransform cmykColorProofingTransform() const; // stdProofCMYKG
+	ScColorTransform cmykImageProofingTransform() const; // stdProofImgCMYK
+	ScColorTransform cmykToRgbColorTransform() const;    // stdTransRGBG
+	ScColorTransform cmykGamutCheckTransform() const;    //stdProofCMYKGCG
 
 protected:
 	ScribusDoc* m_Doc;
 	QString m_ProfileName;
 	QString m_outputProfile;
-	int m_Intent;
+	eRenderIntent m_Intent;
 
 };
 

Modified: branches/Version135/Scribus/scribus/cmsprefs.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/cmsprefs.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/cmsprefs.cpp (original)
+++ branches/Version135/Scribus/scribus/cmsprefs.cpp Sun Oct 31 10:44:16 2010
@@ -111,8 +111,8 @@
 	prefs->DefaultSolidColorCMYKProfile = inputPCMYK->currentText();
 	prefs->DefaultMonitorProfile = monitorP->currentText();
 	prefs->DefaultPrinterProfile = printerP->currentText();
-	prefs->DefaultIntentColors = colorsI->currentIndex();
-	prefs->DefaultIntentImages = imagesI->currentIndex();
+	prefs->DefaultIntentColors = (eRenderIntent) colorsI->currentIndex();
+	prefs->DefaultIntentImages = (eRenderIntent) imagesI->currentIndex();
 	prefs->SoftProofOn = simulate->isChecked();
 	prefs->SoftProofFullOn = convertAll->isChecked();
 	prefs->GamutCheck = gamutC->isChecked();
@@ -142,8 +142,8 @@
 	doc->CMSSettings.DefaultSolidColorCMYKProfile = inputPCMYK->currentText();
 	doc->CMSSettings.DefaultMonitorProfile = monitorP->currentText();
 	doc->CMSSettings.DefaultPrinterProfile = printerP->currentText();
-	doc->CMSSettings.DefaultIntentColors = colorsI->currentIndex();
-	doc->CMSSettings.DefaultIntentImages = imagesI->currentIndex();
+	doc->CMSSettings.DefaultIntentColors = (eRenderIntent) colorsI->currentIndex();
+	doc->CMSSettings.DefaultIntentImages = (eRenderIntent) imagesI->currentIndex();
 	doc->CMSSettings.SoftProofOn = simulate->isChecked();
 	doc->CMSSettings.SoftProofFullOn = convertAll->isChecked();
 	doc->CMSSettings.GamutCheck = gamutC->isChecked();

Modified: branches/Version135/Scribus/scribus/customfdialog.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/customfdialog.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/customfdialog.cpp (original)
+++ branches/Version135/Scribus/scribus/customfdialog.cpp Sun Oct 31 10:44:16 2010
@@ -159,7 +159,7 @@
 	{
 		ScImage im;
 		//No doc to send data anyway, so no doc to get into scimage.
-		CMSettings cms(0, "", 0);
+		CMSettings cms(0, "", Intent_Perceptual);
 		if (im.LoadPicture(name, 1, cms, false, false, ScImage::Thumbnail, 72, &mode))
 		{
 			int ix,iy;

Modified: branches/Version135/Scribus/scribus/effectsdialog.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/effectsdialog.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/effectsdialog.cpp (original)
+++ branches/Version135/Scribus/scribus/effectsdialog.cpp Sun Oct 31 10:44:16 2010
@@ -49,7 +49,7 @@
 	doc = docc;
 	currentOptions = 0;
 	bool mode = false;
-	CMSettings cms(docc, "", 0);
+	CMSettings cms(docc, "", Intent_Perceptual);
 	image.LoadPicture(currItem->Pfile, currItem->pixm.imgInfo.actualPageNumber, cms, false, false, ScImage::RGBData, 72, &mode);
 	int ix = image.width();
 	int iy = image.height();

Modified: branches/Version135/Scribus/scribus/hruler.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/hruler.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/hruler.cpp (original)
+++ branches/Version135/Scribus/scribus/hruler.cpp Sun Oct 31 10:44:16 2010
@@ -20,6 +20,8 @@
  *   (at your option) any later version.                                   *
  *                                                                         *
  ***************************************************************************/
+
+#include <cmath>
 
 #include <QCursor>
 #include <QMouseEvent>

Modified: branches/Version135/Scribus/scribus/main_win32.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/main_win32.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/main_win32.cpp (original)
+++ branches/Version135/Scribus/scribus/main_win32.cpp Sun Oct 31 10:44:16 2010
@@ -49,8 +49,8 @@
 
 #include "scconfig.h"
 
+#include <windows.h>
 #include <wincon.h>
-#include <windows.h>
 
 int mainApp(ScribusQApp& app);
 

Modified: branches/Version135/Scribus/scribus/pageitem.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/pageitem.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/pageitem.cpp (original)
+++ branches/Version135/Scribus/scribus/pageitem.cpp Sun Oct 31 10:44:16 2010
@@ -32,7 +32,6 @@
 #include <QRegExp>
 #include <QMessageBox>
 #include <QPolygon>
-#include <cmath>
 #include <cassert>
 #include <QDebug>
 
@@ -429,7 +428,7 @@
 	Sizing = false;
 	toPixmap = false;
 	UseEmbedded = true;
-	IRender = 1;
+	IRender = Intent_Relative_Colorimetric;
 	EmProfile = "";
 	Groups.clear();
 	LayerNr = m_Doc->activeLayer();

Modified: branches/Version135/Scribus/scribus/pageitem.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/pageitem.h
==============================================================================
--- branches/Version135/Scribus/scribus/pageitem.h (original)
+++ branches/Version135/Scribus/scribus/pageitem.h Sun Oct 31 10:44:16 2010
@@ -38,6 +38,7 @@
 
 #include "scribusapi.h"
 #include "annotation.h"
+#include "colormgmt/sccolormgmtstructs.h"
 #include "observable.h"
 #include "pagestructs.h"
 #include "scimage.h"
@@ -424,10 +425,10 @@
 	QString IProfile;
 	bool UseEmbedded;
 	QString EmProfile;
-	int IRender;
+	eRenderIntent IRender;
 	// some accessor methods:
-	int cmsRenderingIntent() const { return IRender; }
-	void setCmsRenderingIntent(int val) { IRender = val; }
+	int  cmsRenderingIntent() const { return IRender; }
+	void setCmsRenderingIntent(eRenderIntent val) { IRender = val; }
 	QString cmsProfile() const { return IProfile; }
 	void setCmsProfile(QString val) { IProfile = val; }
 	

Modified: branches/Version135/Scribus/scribus/pageitem_desaxe.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/pageitem_desaxe.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/pageitem_desaxe.cpp (original)
+++ branches/Version135/Scribus/scribus/pageitem_desaxe.cpp Sun Oct 31 10:44:16 2010
@@ -25,7 +25,10 @@
 
 using namespace desaxe;
 
-
+eRenderIntent parseIntent(const Xml_string& str)
+{
+	return (eRenderIntent) str.toInt();
+}
 
 FPointArray parseSVG(const Xml_string& str)
 {
@@ -637,7 +640,7 @@
 	ruleset.addRule(itemPrefix, SetAttributeWithConversion<PageItem,bool>( & PageItem::setImageFlippedH, "image-flipped-hor", &parseBool ));
 	ruleset.addRule(itemPrefix, SetAttributeWithConversion<PageItem,bool>( & PageItem::setImageFlippedV, "image-flipped-vert", &parseBool ));
 	ruleset.addRule(itemPrefix, SetAttribute<PageItem,QString>( & PageItem::setCmsProfile, "cms-profile" ));
-	ruleset.addRule(itemPrefix, SetAttributeWithConversion<PageItem,int>( & PageItem::setCmsRenderingIntent, "cms-intent", &parseInt ));
+	ruleset.addRule(itemPrefix, SetAttributeWithConversion<PageItem, eRenderIntent>( & PageItem::setCmsRenderingIntent, "cms-intent", &parseIntent ));
 
 	ruleset.addRule(itemPrefix, SetAttributeWithConversion<PageItem,bool>( & PageItem::setControlsGroup, "isGroupControl", &parseBool ));
 	ruleset.addRule(itemPrefix, PatchIdRefAttribute<PageItem, PageItem>( & PageItem::setGroupsLastItem, "groupsLastItem" ));

Modified: branches/Version135/Scribus/scribus/pageitem_pathtext.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/pageitem_pathtext.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/pageitem_pathtext.cpp (original)
+++ branches/Version135/Scribus/scribus/pageitem_pathtext.cpp Sun Oct 31 10:44:16 2010
@@ -27,7 +27,6 @@
 #include <QList>
 #include <QPainterPath>
 
-#include <cmath>
 #include <cassert>
 
 #include "page.h"

Modified: branches/Version135/Scribus/scribus/pageitem_polyline.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/pageitem_polyline.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/pageitem_polyline.cpp (original)
+++ branches/Version135/Scribus/scribus/pageitem_polyline.cpp Sun Oct 31 10:44:16 2010
@@ -21,7 +21,6 @@
  *                                                                         *
  ***************************************************************************/
 
-#include <cmath>
 #include <cassert>
 
 #include "page.h"
@@ -39,6 +38,7 @@
 #include "scconfig.h"
 
 #include "util.h"
+#include "util_math.h"
 
 using namespace std;
 

Modified: branches/Version135/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/pageitem_textframe.cpp (original)
+++ branches/Version135/Scribus/scribus/pageitem_textframe.cpp Sun Oct 31 10:44:16 2010
@@ -29,7 +29,6 @@
 #include <QPolygon>
 #include <QRegion>
 #include <cassert>
-#include <cmath>
 
 
 #include "canvas.h"

Modified: branches/Version135/Scribus/scribus/pdflib_core.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/pdflib_core.cpp (original)
+++ branches/Version135/Scribus/scribus/pdflib_core.cpp Sun Oct 31 10:44:16 2010
@@ -20,6 +20,10 @@
  *   (at your option) any later version.                                   *
  *                                                                         *
  ***************************************************************************/
+
+#if defined(_MSC_VER)
+#define _USE_MATH_DEFINES
+#endif
 
 #include "pdflib_core.h"
 
@@ -5862,7 +5866,7 @@
 						}
 						if (!ite->Pfile2.isEmpty())
 						{
-							CMSettings cms(ite->doc(), "", 0);
+							CMSettings cms(ite->doc(), "", Intent_Perceptual);
 							img.LoadPicture(ite->Pfile2, 1, cms, false, false, ScImage::RGBData, 72);
 							QByteArray im;
 							img3.getAlpha(ite->Pfile2, 1, im, true, false);
@@ -5873,7 +5877,7 @@
 						}
 						if (!ite->Pfile3.isEmpty())
 						{
-							CMSettings cms(ite->doc(), "", 0);
+							CMSettings cms(ite->doc(), "", Intent_Perceptual);
 							img2.LoadPicture(ite->Pfile3, 1, cms, false, false, ScImage::RGBData, 72);
 							QByteArray im;
 							img3.getAlpha(ite->Pfile3, 1, im, true, false);
@@ -6682,7 +6686,7 @@
 #endif
 
 
-bool PDFLibCore::PDF_Image(PageItem* c, const QString& fn, double sx, double sy, double x, double y, bool fromAN, const QString& Profil, bool Embedded, int Intent, QString* output)
+bool PDFLibCore::PDF_Image(PageItem* c, const QString& fn, double sx, double sy, double x, double y, bool fromAN, const QString& Profil, bool Embedded, eRenderIntent Intent, QString* output)
 {
 	QFileInfo fi = QFileInfo(fn);
 	QString ext = fi.suffix().toLower();

Modified: branches/Version135/Scribus/scribus/pdflib_core.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/pdflib_core.h
==============================================================================
--- branches/Version135/Scribus/scribus/pdflib_core.h (original)
+++ branches/Version135/Scribus/scribus/pdflib_core.h Sun Oct 31 10:44:16 2010
@@ -155,7 +155,7 @@
 	bool    PDF_Annotation(PageItem *ite, uint PNr);
 	void    PDF_Form(const QString& im);
 	void    PDF_xForm(uint objNr, double w, double h, QString im);
-	bool    PDF_Image(PageItem* c, const QString& fn, double sx, double sy, double x, double y, bool fromAN = false, const QString& Profil = "", bool Embedded = false, int Intent = 1, QString* output = NULL);
+	bool    PDF_Image(PageItem* c, const QString& fn, double sx, double sy, double x, double y, bool fromAN = false, const QString& Profil = "", bool Embedded = false, eRenderIntent Intent = Intent_Relative_Colorimetric, QString* output = NULL);
 	bool    PDF_EmbeddedPDF(PageItem* c, const QString& fn, double sx, double sy, double x, double y, bool fromAN, const QString& Profil, bool Embedded, int Intent, ShIm& imgInfo, QString* output = NULL);
 #if HAVE_PODOFO
 	void copyPoDoFoObject(const PoDoFo::PdfObject* obj, uint scObjID, QMap<PoDoFo::PdfReference, uint>& importedObjects);

Modified: branches/Version135/Scribus/scribus/pdfopts.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/pdfopts.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/pdfopts.cpp (original)
+++ branches/Version135/Scribus/scribus/pdfopts.cpp Sun Oct 31 10:44:16 2010
@@ -28,6 +28,7 @@
 #include <QToolTip>
 #include <QVBoxLayout>
 
+#include "colormgmt/sccolormgmtengine.h"
 #include "commonstrings.h"
 #include "customfdialog.h"
 #include "pdfoptions.h"
@@ -341,18 +342,14 @@
 				Opts.PrintProf = Options->PrintProfC->currentText();
 				if (Opts.Version == PDFOptions::PDFVersion_X3)
 				{
-					cmsHPROFILE hIn;
-					QByteArray profilePath( appPrinterProfiles[Opts.PrintProf].toLocal8Bit() );
-					hIn = cmsOpenProfileFromFile(profilePath.data(), "r");
-					const char *Descriptor = cmsTakeProductDesc(hIn);
-					cmsDescriptorName = QString(Descriptor);
-					if (static_cast<int>(cmsGetColorSpace(hIn)) == icSigRgbData)
+					ScColorProfile hIn = ScColorMgmtEngine::openProfileFromFile(appPrinterProfiles[Opts.PrintProf]);
+					cmsDescriptorName  = hIn.productDescription();
+					if (hIn.colorSpace() == ColorSpace_Rgb)
 						components = 3;
-					if (static_cast<int>(cmsGetColorSpace(hIn)) == icSigCmykData)
+					if (hIn.colorSpace() == ColorSpace_Cmyk)
 						components = 4;
-					if (static_cast<int>(cmsGetColorSpace(hIn)) == icSigCmyData)
+					if (hIn.colorSpace() == ColorSpace_Cmy)
 						components = 3;
-					cmsCloseProfile(hIn);
 					Opts.Info = Options->InfoString->text();
 					Opts.Encrypt = false;
 					Opts.MirrorH = false;

Modified: branches/Version135/Scribus/scribus/picsearch.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/picsearch.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/picsearch.cpp (original)
+++ branches/Version135/Scribus/scribus/picsearch.cpp Sun Oct 31 10:44:16 2010
@@ -71,7 +71,7 @@
 		ext = getImageType(currentImage);
 	ScImage im;
 	//No doc to send data anyway, so no doc to get into scimage.
-	CMSettings cms(0, "", 0);
+	CMSettings cms(0, "", Intent_Perceptual);
 	if (im.LoadPicture(currentImage, 1, cms, false, false, ScImage::Thumbnail, 72, &mode))
 	{
 		int ix,iy;

Modified: branches/Version135/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp (original)
+++ branches/Version135/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp Sun Oct 31 10:44:16 2010
@@ -347,8 +347,8 @@
 		m_Doc->CMSSettings.DefaultSolidColorCMYKProfile = dc.attribute("DPPr",""); // Use DPPr to match 1.2.x behavior
 		//m_Doc->CMSSettings.DefaultIntentPrinter = dc.attribute("DIPr", "0").toInt();
 		//m_Doc->CMSSettings.DefaultIntentMonitor = dc.attribute("DIMo", "1").toInt();
-		m_Doc->CMSSettings.DefaultIntentColors = dc.attribute("DISc", "1").toInt();
-		m_Doc->CMSSettings.DefaultIntentImages = dc.attribute("DIIm", "0").toInt();
+		m_Doc->CMSSettings.DefaultIntentColors = (eRenderIntent) dc.attribute("DISc", "1").toInt();
+		m_Doc->CMSSettings.DefaultIntentImages = (eRenderIntent) dc.attribute("DIIm", "0").toInt();
 		activeLayer = dc.attribute("ALAYER", "0").toInt();
 		m_Doc->Language = dc.attribute("LANGUAGE", "");
 		m_Doc->MinWordLen = dc.attribute("MINWORDLEN", "3").toInt();
@@ -947,9 +947,9 @@
 	OB->Pfile  = Relative2Path(obj->attribute("PFILE" ,""), baseDir);
 	OB->Pfile2 = Relative2Path(obj->attribute("PFILE2",""), baseDir);
 	OB->Pfile3 = Relative2Path(obj->attribute("PFILE3",""), baseDir);
-	OB->IProfile=obj->attribute("PRFILE","");
-	OB->EmProfile=obj->attribute("EPROF","");
-	OB->IRender = obj->attribute("IRENDER", "1").toInt();
+	OB->IProfile = obj->attribute("PRFILE","");
+	OB->EmProfile= obj->attribute("EPROF","");
+	OB->IRender  = (eRenderIntent) obj->attribute("IRENDER", "1").toInt();
 	OB->UseEmbedded = obj->attribute("EMBEDDED", "1").toInt();
 	OB->Locked = static_cast<bool>(obj->attribute("LOCK", "0").toInt());
 	OB->LockRes = static_cast<bool>(obj->attribute("LOCKR", "0").toInt());

Modified: branches/Version135/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp (original)
+++ branches/Version135/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp Sun Oct 31 10:44:16 2010
@@ -323,8 +323,8 @@
 			m_Doc->CMSSettings.DefaultSolidColorCMYKProfile = dc.attribute("DPPr","");
 		//m_Doc->CMSSettings.DefaultIntentPrinter = dc.attribute("DIPr", "0").toInt();
 		//m_Doc->CMSSettings.DefaultIntentMonitor = dc.attribute("DIMo", "1").toInt();
-		m_Doc->CMSSettings.DefaultIntentColors = dc.attribute("DISc", "1").toInt();
-		m_Doc->CMSSettings.DefaultIntentImages = dc.attribute("DIIm", "0").toInt();
+		m_Doc->CMSSettings.DefaultIntentColors = (eRenderIntent) dc.attribute("DISc", "1").toInt();
+		m_Doc->CMSSettings.DefaultIntentImages = (eRenderIntent) dc.attribute("DIIm", "0").toInt();
 		layerToSetActive=dc.attribute("ALAYER", "0").toInt();
 		m_Doc->Language = dc.attribute("LANGUAGE", "");
 		m_Doc->MinWordLen = dc.attribute("MINWORDLEN", "3").toInt();
@@ -2164,7 +2164,7 @@
 		}
 		currItem->IProfile  = obj->attribute("PRFILE","");
 		currItem->EmProfile = obj->attribute("EPROF","");
-		currItem->IRender = obj->attribute("IRENDER", "1").toInt();
+		currItem->IRender   = (eRenderIntent) obj->attribute("IRENDER", "1").toInt();
 		currItem->UseEmbedded = obj->attribute("EMBEDDED", "1").toInt();
 		currItem->pixm.imgInfo.lowResType = obj->attribute("ImageRes", "1").toInt();
 		currItem->pixm.imgInfo.actualPageNumber = obj->attribute("Pagenumber", "0").toInt();
@@ -2183,9 +2183,9 @@
 		}
 		if (!currItem->Pfile.isEmpty())
 			doc->loadPict(currItem->Pfile, currItem, false);
-		currItem->IProfile = obj->attribute("PRFILE","");
+		currItem->IProfile  = obj->attribute("PRFILE","");
 		currItem->EmProfile = obj->attribute("EPROF","");
-		currItem->IRender = obj->attribute("IRENDER", "1").toInt();
+		currItem->IRender   = (eRenderIntent) obj->attribute("IRENDER", "1").toInt();
 		currItem->UseEmbedded = obj->attribute("EMBEDDED", "1").toInt();
 		if (currItem->asLatexFrame())
 		{
@@ -2455,7 +2455,7 @@
 			currItem->Pfile3 = Relative2Path(obj->attribute("PFILE3",""), baseDir);
 			currItem->IProfile = obj->attribute("PRFILE","");
 			currItem->EmProfile = obj->attribute("EPROF","");
-			currItem->IRender = obj->attribute("IRENDER", "1").toInt();
+			currItem->IRender   = (eRenderIntent) obj->attribute("IRENDER", "1").toInt();
 			currItem->UseEmbedded = obj->attribute("EMBEDDED", "1").toInt();
 			doc->LoadPict(currItem->Pfile, z);
 			currItem->setImageXYScale(scx, scy);

Modified: branches/Version135/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format_save.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format_save.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format_save.cpp (original)
+++ branches/Version135/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format_save.cpp Sun Oct 31 10:44:16 2010
@@ -7,6 +7,7 @@
 #include "scribus134format.h"
 #include "scribus134formatimpl.h"
 
+#include <ctime>
 #include <memory>
 
 #include "../../formatidlist.h"

Modified: branches/Version135/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp (original)
+++ branches/Version135/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp Sun Oct 31 10:44:16 2010
@@ -319,10 +319,8 @@
 			m_Doc->CMSSettings.DefaultSolidColorCMYKProfile = dc.attribute("DPIn3","");
 		else
 			m_Doc->CMSSettings.DefaultSolidColorCMYKProfile = dc.attribute("DPPr","");
-		//m_Doc->CMSSettings.DefaultIntentPrinter = dc.attribute("DIPr", "0").toInt();
-		//m_Doc->CMSSettings.DefaultIntentMonitor = dc.attribute("DIMo", "1").toInt();
-		m_Doc->CMSSettings.DefaultIntentColors = dc.attribute("DISc", "1").toInt();
-		m_Doc->CMSSettings.DefaultIntentImages = dc.attribute("DIIm", "0").toInt();
+		m_Doc->CMSSettings.DefaultIntentColors = (eRenderIntent) dc.attribute("DISc", "1").toInt();
+		m_Doc->CMSSettings.DefaultIntentImages = (eRenderIntent) dc.attribute("DIIm", "0").toInt();
 		layerToSetActive=dc.attribute("ALAYER", "0").toInt();
 		m_Doc->Language = dc.attribute("LANGUAGE", "");
 		m_Doc->MinWordLen = dc.attribute("MINWORDLEN", "3").toInt();
@@ -2055,7 +2053,7 @@
 		currItem->Pfile     = Relative2Path(obj->attribute("PFILE"), baseDir);
 		currItem->IProfile  = obj->attribute("PRFILE","");
 		currItem->EmProfile = obj->attribute("EPROF","");
-		currItem->IRender = obj->attribute("IRENDER", "1").toInt();
+		currItem->IRender   = (eRenderIntent) obj->attribute("IRENDER", "1").toInt();
 		currItem->UseEmbedded = obj->attribute("EMBEDDED", "1").toInt();
 		currItem->pixm.imgInfo.lowResType = obj->attribute("ImageRes", "1").toInt();
 		IT = obj->firstChild();
@@ -2073,9 +2071,9 @@
 		}
 		if (!currItem->Pfile.isEmpty())
 			doc->loadPict(currItem->Pfile, currItem, false);
-		currItem->IProfile = obj->attribute("PRFILE","");
+		currItem->IProfile  = obj->attribute("PRFILE","");
 		currItem->EmProfile = obj->attribute("EPROF","");
-		currItem->IRender = obj->attribute("IRENDER", "1").toInt();
+		currItem->IRender   = (eRenderIntent) obj->attribute("IRENDER", "1").toInt();
 		currItem->UseEmbedded = obj->attribute("EMBEDDED", "1").toInt();
 		currItem->setImageXYScale(scx, scy);
 		clPath = obj->attribute("ImageClip", "");
@@ -2347,7 +2345,7 @@
 			currItem->Pfile3 = Relative2Path(obj->attribute("PFILE3",""), baseDir);
 			currItem->IProfile = obj->attribute("PRFILE","");
 			currItem->EmProfile = obj->attribute("EPROF","");
-			currItem->IRender = obj->attribute("IRENDER", "1").toInt();
+			currItem->IRender   = (eRenderIntent) obj->attribute("IRENDER", "1").toInt();
 			currItem->UseEmbedded = obj->attribute("EMBEDDED", "1").toInt();
 			doc->LoadPict(currItem->Pfile, z);
 			currItem->setImageXYScale(scx, scy);

Modified: branches/Version135/Scribus/scribus/plugins/import/ai/importai.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/plugins/import/ai/importai.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/plugins/import/ai/importai.cpp (original)
+++ branches/Version135/Scribus/scribus/plugins/import/ai/importai.cpp Sun Oct 31 10:44:16 2010
@@ -17,7 +17,6 @@
 #include <QTemporaryFile>
 #include <QDebug>
 
-#include <cmath>
 #include <cstdlib>
 #include <tiffio.h>
 #include <zlib.h>

Modified: branches/Version135/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp (original)
+++ branches/Version135/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp Sun Oct 31 10:44:16 2010
@@ -13,7 +13,6 @@
 #include <QDomElement>
 #include <QDrag>
 #include <QMimeData>
-#include <cmath>
 
 #include "oodrawimp.h"
 

Modified: branches/Version135/Scribus/scribus/plugins/import/ps/importps.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/plugins/import/ps/importps.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/plugins/import/ps/importps.cpp (original)
+++ branches/Version135/Scribus/scribus/plugins/import/ps/importps.cpp Sun Oct 31 10:44:16 2010
@@ -16,9 +16,7 @@
 #include <QStack>
 #include <QStack>
 
-#include <cmath>
 #include <cstdlib>
-
 
 #include "commonstrings.h"
 #include "customfdialog.h"

Modified: branches/Version135/Scribus/scribus/plugins/import/svg/svgplugin.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/plugins/import/svg/svgplugin.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/plugins/import/svg/svgplugin.cpp (original)
+++ branches/Version135/Scribus/scribus/plugins/import/svg/svgplugin.cpp Sun Oct 31 10:44:16 2010
@@ -14,7 +14,7 @@
 #include <QPainterPath>
 #include <QRegExp>
 #include <QTemporaryFile>
-#include <cmath>
+
 #include "color.h"
 #include "commonstrings.h"
 #include "customfdialog.h"

Modified: branches/Version135/Scribus/scribus/plugins/import/xfig/importxfig.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/plugins/import/xfig/importxfig.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/plugins/import/xfig/importxfig.cpp (original)
+++ branches/Version135/Scribus/scribus/plugins/import/xfig/importxfig.cpp Sun Oct 31 10:44:16 2010
@@ -15,6 +15,9 @@
 #include <QStack>
 #include <QDebug>
 
+#if defined(_MSC_VER)
+#define _USE_MATH_DEFINES
+#endif
 #include <cmath>
 #include <cstdlib>
 

Modified: branches/Version135/Scribus/scribus/plugins/scriptplugin/objpdffile.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/plugins/scriptplugin/objpdffile.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/plugins/scriptplugin/objpdffile.cpp (original)
+++ branches/Version135/Scribus/scribus/plugins/scriptplugin/objpdffile.cpp Sun Oct 31 10:44:16 2010
@@ -6,6 +6,7 @@
 */
 #include "objpdffile.h"
 #include "cmdutil.h"
+#include "colormgmt/sccolormgmtengine.h"
 #include "bookmarkpalette.h"
 #include "prefsmanager.h"
 #include "scribusdoc.h"
@@ -1106,18 +1107,15 @@
 			if (ScCore->primaryMainWindow()->doc->PDF_Options.Version == PDFOptions::PDFVersion_X3)
 			{
 // Where does compiler find cms function when I have not included header for it
-				const char *Descriptor;
-				cmsHPROFILE hIn;
-				hIn = cmsOpenProfileFromFile(ScCore->PrinterProfiles[ScCore->primaryMainWindow()->doc->PDF_Options.PrintProf].toLocal8Bit().constData(), "r");
-				Descriptor = cmsTakeProductDesc(hIn);
-				nam = QString(Descriptor);
-				if (static_cast<int>(cmsGetColorSpace(hIn)) == icSigRgbData)
+				ScColorProfile hIn;
+				hIn = ScColorMgmtEngine::openProfileFromFile(ScCore->PrinterProfiles[ScCore->primaryMainWindow()->doc->PDF_Options.PrintProf]);
+				nam = hIn.productDescription();
+				if (hIn.colorSpace() == ColorSpace_Rgb)
 					Components = 3;
-				if (static_cast<int>(cmsGetColorSpace(hIn)) == icSigCmykData)
+				if (hIn.colorSpace() == ColorSpace_Cmyk)
 					Components = 4;
-				if (static_cast<int>(cmsGetColorSpace(hIn)) == icSigCmyData)
+				if (hIn.colorSpace() == ColorSpace_Gray)
 					Components = 3;
-				cmsCloseProfile(hIn);
 				ScCore->primaryMainWindow()->doc->PDF_Options.Info = PyString_AsString(self->info);
 				self->bleedt = minmaxd(self->bleedt, 0, ScCore->primaryMainWindow()->view->Doc->pageHeight*ScCore->primaryMainWindow()->view->Doc->unitRatio());
 				ScCore->primaryMainWindow()->doc->PDF_Options.bleeds.Top = self->bleedt/ScCore->primaryMainWindow()->view->Doc->unitRatio();

Modified: branches/Version135/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp (original)
+++ branches/Version135/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp Sun Oct 31 10:44:16 2010
@@ -46,6 +46,7 @@
 #include "scmessagebox.h"
 #include "scpattern.h"
 #include "util.h"
+#include "util_math.h"
 #include "customfdialog.h"
 #include "sctextstruct.h"
 #include "guidemanager.h"

Modified: branches/Version135/Scribus/scribus/plugins/tools/2geomtools/meshdistortion/meshdistortion.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/plugins/tools/2geomtools/meshdistortion/meshdistortion.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/plugins/tools/2geomtools/meshdistortion/meshdistortion.cpp (original)
+++ branches/Version135/Scribus/scribus/plugins/tools/2geomtools/meshdistortion/meshdistortion.cpp Sun Oct 31 10:44:16 2010
@@ -29,7 +29,7 @@
 #include "scribuscore.h"
 #include "scribusstructs.h"
 #include "util.h"
-#include "util_math.h"
+//#include "util_math.h"
 
 int meshdistortion_getPluginAPIVersion()
 {

Modified: branches/Version135/Scribus/scribus/plugins/tools/2geomtools/meshdistortion/meshdistortiondialog.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/plugins/tools/2geomtools/meshdistortion/meshdistortiondialog.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/plugins/tools/2geomtools/meshdistortion/meshdistortiondialog.cpp (original)
+++ branches/Version135/Scribus/scribus/plugins/tools/2geomtools/meshdistortion/meshdistortiondialog.cpp Sun Oct 31 10:44:16 2010
@@ -36,7 +36,7 @@
 #include "scpattern.h"
 #include "selection.h"
 #include "util_icon.h"
-#include "util_math.h"
+//#include "util_math.h"
 
 NodeItem::NodeItem(QRectF geom, uint num, MeshDistortionDialog *parent) : QGraphicsEllipseItem(geom)
 {

Modified: branches/Version135/Scribus/scribus/plugins/tools/2geomtools/pathalongpath/pathalongpath.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/plugins/tools/2geomtools/pathalongpath/pathalongpath.h
==============================================================================
--- branches/Version135/Scribus/scribus/plugins/tools/2geomtools/pathalongpath/pathalongpath.h (original)
+++ branches/Version135/Scribus/scribus/plugins/tools/2geomtools/pathalongpath/pathalongpath.h Sun Oct 31 10:44:16 2010
@@ -30,6 +30,10 @@
 #include "pluginapi.h"
 #include "scplugin.h"
 #include "selection.h"
+
+#if defined(_MSC_VER)
+#define _USE_MATH_DEFINES
+#endif
 
 #include "../lib2geom/sbasis.h"
 #include "../lib2geom/sbasis-geometric.h"

Modified: branches/Version135/Scribus/scribus/plugins/tools/lenseffects/lensdialog.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/plugins/tools/lenseffects/lensdialog.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/plugins/tools/lenseffects/lensdialog.cpp (original)
+++ branches/Version135/Scribus/scribus/plugins/tools/lenseffects/lensdialog.cpp Sun Oct 31 10:44:16 2010
@@ -27,6 +27,7 @@
 #include "lensdialog.h"
 #include <QRadialGradient>
 #include "util_icon.h"
+#include "util_math.h"
 #include "selection.h"
 #include "sccolorengine.h"
 #include "scpattern.h"

Modified: branches/Version135/Scribus/scribus/plugins/tools/pathstroker/pathstroker.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/plugins/tools/pathstroker/pathstroker.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/plugins/tools/pathstroker/pathstroker.cpp (original)
+++ branches/Version135/Scribus/scribus/plugins/tools/pathstroker/pathstroker.cpp Sun Oct 31 10:44:16 2010
@@ -30,6 +30,7 @@
 #include "scribuscore.h"
 #include "scribusstructs.h"
 #include "util.h"
+#include "util_math.h"
 #include <QPainterPathStroker>
 
 int pathstroker_getPluginAPIVersion()

Modified: branches/Version135/Scribus/scribus/plugins/tools/transform/transformdialog.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/plugins/tools/transform/transformdialog.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/plugins/tools/transform/transformdialog.cpp (original)
+++ branches/Version135/Scribus/scribus/plugins/tools/transform/transformdialog.cpp Sun Oct 31 10:44:16 2010
@@ -29,6 +29,10 @@
 #include "selection.h"
 #include "commonstrings.h"
 #include "units.h"
+
+#if defined(_MSC_VER)
+#define _USE_MATH_DEFINES
+#endif
 #include <cmath>
 
 TransformItem::TransformItem(QString text, QListWidget* parent, int type, double val1, double val2) : QListWidgetItem(text, parent, type)

Modified: branches/Version135/Scribus/scribus/prefsmanager.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/prefsmanager.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/prefsmanager.cpp (original)
+++ branches/Version135/Scribus/scribus/prefsmanager.cpp Sun Oct 31 10:44:16 2010
@@ -33,6 +33,7 @@
 #include "prefsmanager.h"
 
 #include "actionmanager.h"
+#include "colormgmt/sccolormgmtengine.h"
 #include "colorsetmanager.h"
 #include "commonstrings.h"
 #include "filewatcher.h"
@@ -371,8 +372,8 @@
 	appPrefs.DCMSset.SoftProofFullOn = false;
 	appPrefs.DCMSset.GamutCheck = false;
 	appPrefs.DCMSset.BlackPoint = true;
-	appPrefs.DCMSset.DefaultIntentColors = 1;
-	appPrefs.DCMSset.DefaultIntentImages = 0;
+	appPrefs.DCMSset.DefaultIntentColors = Intent_Relative_Colorimetric;
+	appPrefs.DCMSset.DefaultIntentImages = Intent_Perceptual;
 	appPrefs.GFontSub.clear();
 	appPrefs.scratch.Left = 100;
 	appPrefs.scratch.Right = 100;
@@ -2050,8 +2051,8 @@
 			appPrefs.DCMSset.DefaultImageCMYKProfile = dc.attribute("DPInCMYK","");
 			appPrefs.DCMSset.DefaultSolidColorRGBProfile = dc.attribute("DPIn2","");
 			appPrefs.DCMSset.DefaultSolidColorCMYKProfile = dc.attribute("DPIn3","");
-			appPrefs.DCMSset.DefaultIntentColors = dc.attribute("DISc", "1").toInt();
-			appPrefs.DCMSset.DefaultIntentImages = dc.attribute("DIIm", "0").toInt();
+			appPrefs.DCMSset.DefaultIntentColors = (eRenderIntent) dc.attribute("DISc", "1").toInt();
+			appPrefs.DCMSset.DefaultIntentImages = (eRenderIntent) dc.attribute("DIIm", "0").toInt();
 		}
 		if (!importingFrom12 && dc.tagName()=="SHORTCUT")
 		{

Modified: branches/Version135/Scribus/scribus/preview.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/preview.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/preview.cpp (original)
+++ branches/Version135/Scribus/scribus/preview.cpp Sun Oct 31 10:44:16 2010
@@ -963,7 +963,7 @@
 					q++;
 				}
 			}
-			CMSettings cms(doc, "", 0);
+			CMSettings cms(doc, "", Intent_Perceptual);
 			if (flagsVisible["Cyan"]->isChecked())
 			{
 				if ((GsMinor < 54) && (GsMajor < 9))
@@ -1039,7 +1039,7 @@
 			}
 			if (flagsVisible["Black"]->isChecked())
 			{
-				CMSettings cms(doc, "", 0);
+				CMSettings cms(doc, "", Intent_Perceptual);
 				if ((GsMinor < 54) && (GsMajor < 9))
 					loaderror = im.LoadPicture(ScPaths::getTempFileDir()+"/sc.tif.Black.tif", 1, cms, false, false, ScImage::RGBData, 72, &mode);
 				else
@@ -1095,11 +1095,11 @@
 				{
 					QRgb alphaFF = qRgba(0,0,0,255);
 					QRgb alphaOO = qRgba(255,255,255,0);
-					cmsHTRANSFORM transCMYK = cmsCreateTransform(doc->DocPrinterProf, (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1)|DOSWAP_SH(1)|SWAPFIRST_SH(1)), doc->DocOutputProf, TYPE_BGRA_8, INTENT_RELATIVE_COLORIMETRIC, cmsFLAGS_LOWRESPRECALC);
+					ScColorTransform transCMYK = ScColorMgmtEngine::createTransform(doc->DocPrinterProf, Format_YMCK_8, doc->DocOutputProf, Format_BGRA_8, Intent_Relative_Colorimetric, Ctf_LowResPrecalc);
 					for( int yi=0; yi < h2; ++yi )
 					{
-						LPBYTE ptr = image.scanLine( yi );
-						cmsDoTransform(transCMYK, ptr, ptr, image.width());
+						uchar* ptr = image.scanLine( yi );
+						transCMYK.apply(ptr, ptr, image.width());
 						QRgb *q = (QRgb *) ptr;
 						for (int xi = 0; xi < image.width(); xi++, q++)
 						{
@@ -1117,7 +1117,6 @@
 								*q |= alphaFF;
 						}
 					}
-					cmsDeleteTransform (transCMYK);
 				}
 				else
 				{
@@ -1157,10 +1156,10 @@
 				{
 					QRgb alphaFF = qRgba(0,0,0,255);
 					QRgb alphaOO = qRgba(255,255,255,0);
-					cmsHTRANSFORM transCMYK = cmsCreateTransform(doc->DocPrinterProf, (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1)|DOSWAP_SH(1)|SWAPFIRST_SH(1)), doc->DocOutputProf, TYPE_BGRA_8, INTENT_RELATIVE_COLORIMETRIC, cmsFLAGS_LOWRESPRECALC);
+					ScColorTransform transCMYK = ScColorMgmtEngine::createTransform(doc->DocPrinterProf, Format_YMCK_8, doc->DocOutputProf, Format_BGRA_8, Intent_Relative_Colorimetric, Ctf_LowResPrecalc);
 					for (int y=0; y < h2; ++y )
 					{
-						LPBYTE ptr = image.scanLine( y );
+						uchar* ptr = image.scanLine( y );
 						f.read(imgc.data(), w2);
 						p = (uint *)image.scanLine( y );
 						for (int x=0; x < w2; x += 4 )
@@ -1180,7 +1179,7 @@
 							*p = qRgba(cyan, magenta, yellow, black);
 							p++;
 						}
-						cmsDoTransform(transCMYK, ptr, ptr, image.width());
+						transCMYK.apply(ptr, ptr, image.width());
 						QRgb *q = (QRgb *) ptr;
 						for (int xi = 0; xi < image.width(); xi++, q++)
 						{
@@ -1198,7 +1197,6 @@
 								*q |= alphaFF;
 						}
 					}
-					cmsDeleteTransform (transCMYK);
 				}
 				else
 				{

Modified: branches/Version135/Scribus/scribus/propertiespalette.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/propertiespalette.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/propertiespalette.cpp (original)
+++ branches/Version135/Scribus/scribus/propertiespalette.cpp Sun Oct 31 10:44:16 2010
@@ -41,7 +41,9 @@
 #include <QValidator>
 #include <QWidget>
 
-
+#if defined(_MSC_VER)
+#define _USE_MATH_DEFINES
+#endif
 #include <cmath>
 #include "arrowchooser.h"
 #include "autoform.h"

Modified: branches/Version135/Scribus/scribus/pslib.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/pslib.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/pslib.cpp (original)
+++ branches/Version135/Scribus/scribus/pslib.cpp Sun Oct 31 10:44:16 2010
@@ -22,7 +22,6 @@
  ***************************************************************************/
 
 #include "pslib.h"
-#include <cmath>
 
 #include <QFileInfo>
 #include <QImage>
@@ -56,7 +55,6 @@
 #include "scstreamfilter_ascii85.h"
 #include "scstreamfilter_flate.h"
 #include "util.h"
-#include "util_cms.h"
 #include "util_formats.h"
 #include "util_math.h"
 
@@ -1847,7 +1845,7 @@
 		PS_setGray();
 	applyICC = Ic;
 	if ((Doc->HasCMS) && (ScCore->haveCMS()) && (applyICC))
-		solidTransform = scCmsCreateTransform(Doc->DocInputCMYKProf, TYPE_CMYK_16, Doc->DocPrinterProf, TYPE_CMYK_16, Doc->IntentColors, 0);
+		solidTransform = ScColorMgmtEngine::createTransform(Doc->DocInputCMYKProf, Format_CMYK_16, Doc->DocPrinterProf, Format_CMYK_16, Doc->IntentColors, 0);
 	else
 		applyICC = false;
 	if (usingGUI)
@@ -2256,8 +2254,6 @@
 	}
 	PS_close();
 	if (usingGUI) progressDialog->close();
-	if ((Doc->HasCMS) && (ScCore->haveCMS()) && (applyICC))
-		cmsDeleteTransform(solidTransform);
 	if (errorOccured)
 		return 1;
 	else if (abortExport)
@@ -3485,13 +3481,13 @@
 		s1 = qRound(s1 * shade / 100.0);
 		v1 = qRound(v1 * shade / 100.0);
 		k1 = qRound(k1 * shade / 100.0);
-		WORD inC[4];
-		WORD outC[4];
+		unsigned short inC[4];
+		unsigned short outC[4];
 		inC[0] = h1 * 257;
 		inC[1] = s1 * 257;
 		inC[2] = v1 * 257;
 		inC[3] = k1 * 257;
-		cmsDoTransform(solidTransform, inC, outC, 1);
+		solidTransform.apply(inC, outC, 1);
 		*h= outC[0] / 257;
 		*s = outC[1] / 257;
 		*v = outC[2] / 257;

Modified: branches/Version135/Scribus/scribus/pslib.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/pslib.h
==============================================================================
--- branches/Version135/Scribus/scribus/pslib.h (original)
+++ branches/Version135/Scribus/scribus/pslib.h Sun Oct 31 10:44:16 2010
@@ -38,7 +38,7 @@
 #include "page.h"
 #include "scribusapi.h"
 #include "scribusstructs.h"
-#include CMS_INC
+#include "colormgmt/sccolormgmtengine.h"
 
 #ifdef NLS_PROTO
 class ScText;
@@ -189,7 +189,7 @@
 		bool useSpotColors;
 		bool fillRule;
 		bool applyICC;
-		cmsHTRANSFORM solidTransform;
+		ScColorTransform solidTransform;
 		QString currentSpot;
 		ColorList colorsToUse;
 		QString colorDesc;

Modified: branches/Version135/Scribus/scribus/sccolorengine.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/sccolorengine.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/sccolorengine.cpp (original)
+++ branches/Version135/Scribus/scribus/sccolorengine.cpp Sun Oct 31 10:44:16 2010
@@ -23,7 +23,7 @@
 
 #include "sccolorengine.h"
 #include "scribuscore.h"
-#include CMS_INC
+#include "colormgmt/sccolormgmtengine.h"
 
 QColor ScColorEngine::getRGBColor(const ScColor& color, const ScribusDoc* doc)
 {
@@ -56,7 +56,7 @@
 void ScColorEngine::getRGBValues(const ScColor& color, const ScribusDoc* doc, RGBColor& rgb)
 {
 	colorModel    model = color.getColorModel();
-	cmsHTRANSFORM transRGB = doc ? doc->stdTransRGB : ScCore->defaultCMYKToRGBTrans;
+	ScColorTransform transRGB = doc ? doc->stdTransRGB : ScCore->defaultCMYKToRGBTrans;
 	if (ScCore->haveCMS() && transRGB)
 	{
 		if (model == colorModelRGB)
@@ -67,13 +67,13 @@
 		}
 		else
 		{
-			WORD inC[4];
-			WORD outC[4];
+			unsigned short inC[4];
+			unsigned short outC[4];
 			inC[0] = color.CR * 257;
 			inC[1] = color.MG * 257;
 			inC[2] = color.YB * 257;
 			inC[3] = color.K * 257;
-			cmsDoTransform(transRGB, inC, outC, 1);
+			transRGB.apply(inC, outC, 1);
 			rgb.r = outC[0] / 257;
 			rgb.g = outC[1] / 257;
 			rgb.b = outC[2] / 257;
@@ -95,10 +95,10 @@
 
 void ScColorEngine::getCMYKValues(const ScColor& color, const ScribusDoc* doc, CMYKColor& cmyk)
 {
-	WORD inC[4];
-	WORD outC[4];
+	unsigned short inC[4];
+	unsigned short outC[4];
 	colorModel model = color.getColorModel();
-	cmsHTRANSFORM transCMYK = doc ? doc->stdTransCMYK : ScCore->defaultRGBToCMYKTrans;
+	ScColorTransform transCMYK = doc ? doc->stdTransCMYK : ScCore->defaultRGBToCMYKTrans;
 	if (ScCore->haveCMS() && transCMYK)
 	{
 		if (model == colorModelRGB)
@@ -114,7 +114,7 @@
 				inC[0] = color.CR * 257;
 				inC[1] = color.MG * 257;
 				inC[2] = color.YB * 257;
-				cmsDoTransform(transCMYK, inC, outC, 1);
+				transCMYK.apply(inC, outC, 1);
 				cmyk.c = outC[0] / 257;
 				cmyk.m = outC[1] / 257;
 				cmyk.y = outC[2] / 257;
@@ -333,12 +333,12 @@
 
 QColor ScColorEngine::getColorProof(RGBColor& rgb, const ScribusDoc* doc, bool spot, bool gamutCkeck)
 {
-	WORD inC[4];
-	WORD outC[4];
+	unsigned short inC[4];
+	unsigned short outC[4];
 	int  r = rgb.r, g = rgb.g, b = rgb.b;
-	cmsHTRANSFORM transRGBMon  = doc ? doc->stdTransRGBMon : ScCore->defaultRGBToScreenSolidTrans;
-	cmsHTRANSFORM transProof   = doc ? doc->stdProof   : ScCore->defaultRGBToScreenSolidTrans;
-	cmsHTRANSFORM transProofGC = doc ? doc->stdProofGC : ScCore->defaultRGBToScreenSolidTrans;
+	ScColorTransform transRGBMon  = doc ? doc->stdTransRGBMon : ScCore->defaultRGBToScreenSolidTrans;
+	ScColorTransform transProof   = doc ? doc->stdProof   : ScCore->defaultRGBToScreenSolidTrans;
+	ScColorTransform transProofGC = doc ? doc->stdProofGC : ScCore->defaultRGBToScreenSolidTrans;
 	bool cmsUse   = doc ? doc->HasCMS : false;
 	bool cmsTrans = (transRGBMon && transProof && transProofGC); 
 	if (ScCore->haveCMS() && cmsTrans)
@@ -348,15 +348,15 @@
 		inC[2] = rgb.b * 257;
 		if (cmsUse && !spot && doc->SoftProofing)
 		{
-			cmsHTRANSFORM xform = gamutCkeck ? transProofGC : transProof;
-			cmsDoTransform(xform, inC, outC, 1);
+			ScColorTransform xform = gamutCkeck ? transProofGC : transProof;
+			xform.apply(inC, outC, 1);
 			r = outC[0] / 257;
 			g = outC[1] / 257;
 			b = outC[2] / 257;
 		}
 		else
 		{
-			cmsDoTransform(transRGBMon, inC, outC, 1);
+			transRGBMon.apply(inC, outC, 1);
 			r = outC[0] / 257;
 			g = outC[1] / 257;
 			b = outC[2] / 257;
@@ -368,11 +368,11 @@
 QColor ScColorEngine::getColorProof(CMYKColor& cmyk, const ScribusDoc* doc, bool spot, bool gamutCkeck)
 {
 	int  r = 0, g = 0, b = 0;
-	WORD inC[4];
-	WORD outC[4];
-	cmsHTRANSFORM transCMYKMon     = doc ? doc->stdTransCMYKMon : ScCore->defaultCMYKToRGBTrans;
-	cmsHTRANSFORM transProofCMYK   = doc ? doc->stdProofCMYK   : ScCore->defaultCMYKToRGBTrans;
-	cmsHTRANSFORM transProofCMYKGC = doc ? doc->stdProofCMYKGC : ScCore->defaultCMYKToRGBTrans;
+	unsigned short inC[4];
+	unsigned short outC[4];
+	ScColorTransform transCMYKMon     = doc ? doc->stdTransCMYKMon : ScCore->defaultCMYKToRGBTrans;
+	ScColorTransform transProofCMYK   = doc ? doc->stdProofCMYK   : ScCore->defaultCMYKToRGBTrans;
+	ScColorTransform transProofCMYKGC = doc ? doc->stdProofCMYKGC : ScCore->defaultCMYKToRGBTrans;
 	bool cmsUse   = doc ? doc->HasCMS : false;
 	bool cmsTrans = (transCMYKMon && transProofCMYK && transProofCMYKGC); 
 	if (ScCore->haveCMS() && cmsTrans)
@@ -383,15 +383,15 @@
 		inC[3] = cmyk.k * 257;
 		if (cmsUse && !spot && doc->SoftProofing)
 		{
-			cmsHTRANSFORM xform = gamutCkeck ? transProofCMYKGC : transProofCMYK;
-			cmsDoTransform(xform, inC, outC, 1);
+			ScColorTransform xform = gamutCkeck ? transProofCMYKGC : transProofCMYK;
+			xform.apply(inC, outC, 1);
 			r = outC[0] / 257;
 			g = outC[1] / 257;
 			b = outC[2] / 257;
 		}
 		else
 		{
-			cmsDoTransform(transCMYKMon, inC, outC, 1);
+			transCMYKMon.apply(inC, outC, 1);
 			r = outC[0] / 257;
 			g = outC[1] / 257;
 			b = outC[2] / 257;
@@ -408,18 +408,18 @@
 
 QColor ScColorEngine::getDisplayColor(RGBColor& rgb, const ScribusDoc* doc, bool spot)
 {
-	WORD inC[4];
-	WORD outC[4];
+	unsigned short inC[4];
+	unsigned short outC[4];
 	int r = rgb.r;
 	int g = rgb.g;
 	int b = rgb.b; 
-	cmsHTRANSFORM transRGBMon = doc ? doc->stdTransRGBMon : ScCore->defaultRGBToScreenSolidTrans;
+	ScColorTransform transRGBMon = doc ? doc->stdTransRGBMon : ScCore->defaultRGBToScreenSolidTrans;
 	if (ScCore->haveCMS() && transRGBMon)
 	{
 		inC[0] = r * 257;
 		inC[1] = g * 257;
 		inC[2] = b * 257;
-		cmsDoTransform(transRGBMon, inC, outC, 1);
+		transRGBMon.apply(inC, outC, 1);
 		r = outC[0] / 257;
 		g = outC[1] / 257;
 		b = outC[2] / 257;
@@ -430,16 +430,16 @@
 QColor ScColorEngine::getDisplayColor(CMYKColor& cmyk, const ScribusDoc* doc, bool spot)
 {
 	int  r = 0, g = 0, b = 0;
-	WORD inC[4];
-	WORD outC[4];
-	cmsHTRANSFORM transCMYKMon = doc ? doc->stdTransCMYKMon : ScCore->defaultCMYKToRGBTrans;
+	unsigned short inC[4];
+	unsigned short outC[4];
+	ScColorTransform transCMYKMon = doc ? doc->stdTransCMYKMon : ScCore->defaultCMYKToRGBTrans;
 	if (ScCore->haveCMS() && transCMYKMon)
 	{
 		inC[0] = cmyk.c * 257;
 		inC[1] = cmyk.m * 257;
 		inC[2] = cmyk.y * 257;
 		inC[3] = cmyk.k * 257;
-		cmsDoTransform(transCMYKMon, inC, outC, 1);
+		transCMYKMon.apply(inC, outC, 1);
 		r = outC[0] / 257;
 		g = outC[1] / 257;
 		b = outC[2] / 257;
@@ -458,13 +458,13 @@
 	bool outOfGamutFlag = false;
 	if (color.isSpotColor())
 		return false;
-	WORD inC[4];
-	WORD outC[4];
+	unsigned short inC[4];
+	unsigned short outC[4];
 	bool cmsUse = doc ? doc->HasCMS : false;
 	if (ScCore->haveCMS() && cmsUse)
 	{
 		bool alert = true;
-		cmsHTRANSFORM xformProof;
+		ScColorTransform xformProof;
 		if (color.getColorModel() == colorModelRGB)
 		{
 			inC[0] = color.CR * 257;
@@ -492,7 +492,7 @@
 		}
 		if (alert)
 		{
-			cmsDoTransform(xformProof, inC, outC, 1);
+			xformProof.apply(inC, outC, 1);
 			if ((outC[0]/257 == 0) && (outC[1]/257 == 255) && (outC[2]/257 == 0))
 				outOfGamutFlag = true;
 		}

Modified: branches/Version135/Scribus/scribus/scdocoutput_ps2.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/scdocoutput_ps2.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/scdocoutput_ps2.cpp (original)
+++ branches/Version135/Scribus/scribus/scdocoutput_ps2.cpp Sun Oct 31 10:44:16 2010
@@ -8,6 +8,7 @@
 #include "scdocoutput_ps2.h"
 #include "scpageoutput_ps2.h"
 #include "scribuscore.h"
+#include "colormgmt/sccolormgmtengine.h"
 #include "cmserrorhandling.h"
 #include "commonstrings.h"
 #include "scribusdoc.h"
@@ -34,7 +35,6 @@
 {
 	if (m_file.isOpen())
 		m_file.close();
-	closeTransforms();
 }
 
 void ScDocOutput_Ps2::begin(void)
@@ -73,77 +73,51 @@
 	m_file.close();
 }
 
-void ScDocOutput_Ps2::closeTransforms(void)
-{
-	if (m_options.rgbToOutputColorTransform)
-		cmsDeleteTransform(m_options.rgbToOutputColorTransform);
-	if (m_options.rgbToOutputImageTransform)
-		cmsDeleteTransform(m_options.rgbToOutputImageTransform);
-	if (m_options.cmykToOutputColorTransform)
-		cmsDeleteTransform(m_options.cmykToOutputColorTransform);
-	if (m_options.cmykToOutputImageTransform)
-		cmsDeleteTransform(m_options.cmykToOutputImageTransform);
-	if (m_options.hProfile)
-		cmsCloseProfile(m_options.hProfile);
-	m_options.hProfile = NULL;
-	m_options.rgbToOutputColorTransform = NULL;
-	m_options.rgbToOutputImageTransform = NULL;
-	m_options.cmykToOutputColorTransform = NULL;
-	m_options.cmykToOutputImageTransform = NULL;
-}
-
 bool ScDocOutput_Ps2::initializeCmsTransforms(void)
 {
 	bool success = false;
 	if (!m_options.outputProfile.isEmpty() && QFile::exists(m_options.outputProfile))
 	{
-		cmsErrorAction(LCMS_ERROR_ABORT);
-		if (setjmp(cmsJumpBuffer))
+		int dcmsflags = 0;
+		dcmsflags |= Ctf_LowResPrecalc;
+		if (m_doc->BlackPoint)
+			dcmsflags |= Ctf_BlackPointCompensation;
+
+		eColorFormat outputDataTypeColors = Format_Undefined;
+		eColorFormat outputDataTypeImages = Format_Undefined;
+		m_options.hProfile = ScColorMgmtEngine::openProfileFromFile(m_options.outputProfile);
+		if (m_options.hProfile.colorSpace() == ColorSpace_Rgb)
 		{
-			cmsSetErrorHandler(NULL);
-			cmsErrorAction(LCMS_ERROR_IGNORE);
-			closeTransforms();
-			cmsErrorAction(LCMS_ERROR_ABORT);
-			m_lastError = QObject::tr("An error occurred while initializing icc transforms");
-			qWarning( "%s", m_lastError.toLocal8Bit().data() );
-			return false;
+			outputDataTypeColors = Format_RGB_16;
+			outputDataTypeImages = Format_ARGB_8;
 		}
-		cmsSetErrorHandler(&cmsErrorHandler);
-
-		int dcmsflags = 0;
-		dcmsflags |= cmsFLAGS_LOWRESPRECALC;
-		if (m_doc->BlackPoint)
-			dcmsflags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
-
-		int outputDataTypeColors = 0;
-		int outputDataTypeImages = 0;
-		QByteArray outputProfilePath(m_options.outputProfile.toLocal8Bit());
-		m_options.hProfile = cmsOpenProfileFromFile(outputProfilePath.data(), "r");
-		if (static_cast<int>(cmsGetColorSpace(m_options.hProfile)) == icSigRgbData)
+		else if (m_options.hProfile.colorSpace()  == ColorSpace_Cmyk)
 		{
-			outputDataTypeColors = TYPE_RGB_16;
-			outputDataTypeImages = TYPE_ARGB_8;
-		}
-		else if (static_cast<int>(cmsGetColorSpace(m_options.hProfile)) == icSigCmykData)
-		{
-			outputDataTypeColors = TYPE_CMYK_16;
-			outputDataTypeImages = TYPE_CMYK_8;
+			outputDataTypeColors = Format_CMYK_16;
+			outputDataTypeImages = Format_CMYK_8;
 		}
 		else
 		{
 			m_lastError = QObject::tr("Output profile is not supported");
 			return false;
 		}
-		m_options.rgbToOutputColorTransform = cmsCreateTransform(m_doc->DocInputRGBProf, TYPE_RGB_16, m_options.hProfile, 
+		m_options.rgbToOutputColorTransform  = ScColorMgmtEngine::createTransform(m_doc->DocInputRGBProf, Format_RGB_16, m_options.hProfile, 
 													outputDataTypeColors, m_doc->IntentColors, dcmsflags); 
-		m_options.rgbToOutputImageTransform = cmsCreateTransform(m_doc->DocInputRGBProf, TYPE_ARGB_8, m_options.hProfile, 
+		m_options.rgbToOutputImageTransform  = ScColorMgmtEngine::createTransform(m_doc->DocInputRGBProf, Format_ARGB_8, m_options.hProfile, 
 													outputDataTypeImages, m_doc->IntentImages, dcmsflags);
-		m_options.cmykToOutputColorTransform = cmsCreateTransform(m_doc->DocInputRGBProf, TYPE_CMYK_16, m_options.hProfile, 
+		m_options.cmykToOutputColorTransform = ScColorMgmtEngine::createTransform(m_doc->DocInputRGBProf, Format_CMYK_16, m_options.hProfile, 
 													outputDataTypeColors, m_doc->IntentColors, dcmsflags);
-		m_options.cmykToOutputImageTransform = cmsCreateTransform(m_doc->DocInputRGBProf, TYPE_CMYK_8 , m_options.hProfile, 
+		m_options.cmykToOutputImageTransform = ScColorMgmtEngine::createTransform(m_doc->DocInputRGBProf, Format_CMYK_8 , m_options.hProfile, 
 													outputDataTypeImages, m_doc->IntentImages, dcmsflags);
-		cmsSetErrorHandler(NULL);
-		success = true;
+		
+		success = (m_options.rgbToOutputColorTransform  && m_options.rgbToOutputImageTransform &&
+			       m_options.cmykToOutputColorTransform && m_options.cmykToOutputImageTransform );
+		if (!success)
+		{
+			m_lastError = QObject::tr("An error occurred while initializing icc transforms");
+			qWarning( "%s", m_lastError.toLocal8Bit().data() );
+			return false;
+		}
 	}
 	return success;
 }

Modified: branches/Version135/Scribus/scribus/scdocoutput_ps2.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/scdocoutput_ps2.h
==============================================================================
--- branches/Version135/Scribus/scribus/scdocoutput_ps2.h (original)
+++ branches/Version135/Scribus/scribus/scdocoutput_ps2.h Sun Oct 31 10:44:16 2010
@@ -45,7 +45,6 @@
 
 	virtual ScPageOutput* createPageOutputComponent(int pageIndex);
 
-	void closeTransforms(void);
 	bool initializeCmsTransforms(void);
 
 public:

Modified: branches/Version135/Scribus/scribus/scimage.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/scimage.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/scimage.cpp (original)
+++ branches/Version135/Scribus/scribus/scimage.cpp Sun Oct 31 10:44:16 2010
@@ -27,8 +27,8 @@
 #include <cstdlib>
 #include <memory>
 #include <setjmp.h>
-#include CMS_INC
-#include "util_cms.h"
+
+#include "colormgmt/sccolormgmtengine.h"
 #include "commonstrings.h"
 #include "exif.h"
 #include "util_ghostscript.h"
@@ -1893,7 +1893,7 @@
 	Q_ASSERT(profile);
 	Q_ASSERT(components);
 	ScImgDataLoader* pDataLoader = NULL;
-	cmsHPROFILE prof = 0;
+	ScColorProfile prof;
 
 	profile->resize(0);
 	*components = 0;
@@ -1917,18 +1917,17 @@
 		QByteArray embeddedProfile = pDataLoader->embeddedProfile();
 		if	(embeddedProfile.size())
 		{
-			prof = cmsOpenProfileFromMem(embeddedProfile.data(), embeddedProfile.size());
+			prof = ScColorMgmtEngine::openProfileFromMem(embeddedProfile);
 			if (prof)
 			{
-				if (static_cast<int>(cmsGetColorSpace(prof)) == icSigRgbData)
+				if (prof.colorSpace() == ColorSpace_Rgb)
 					*components = 3;
-				if (static_cast<int>(cmsGetColorSpace(prof)) == icSigCmykData)
+				if (prof.colorSpace() == ColorSpace_Cmyk)
 					*components = 4;
-				if (static_cast<int>(cmsGetColorSpace(prof)) == icSigGrayData)
+				if (prof.colorSpace() == ColorSpace_Gray)
 					*components = 1;
 				*profile = embeddedProfile;
 			}
-			cmsCloseProfile(prof);
 		}
 		delete pDataLoader;
 	}
@@ -1949,8 +1948,8 @@
 	bool bilevel = false;
 //	short resolutionunit = 0;
 	RequestType reqType = requestType;
-	cmsHTRANSFORM xform = 0;
-	cmsHPROFILE inputProf = 0;
+	ScColorTransform xform = 0;
+	ScColorProfile   inputProf = 0;
 	int cmsFlags = 0;
 	int cmsProofFlags = 0;
 	auto_ptr<ScImgDataLoader> pDataLoader;
@@ -2037,12 +2036,12 @@
 	{
 		if ((embeddedProfile.size() > 0 ) && (useEmbedded))
 		{
-			inputProf = cmsOpenProfileFromMem(embeddedProfile.data(), embeddedProfile.size());
+			inputProf = ScColorMgmtEngine::openProfileFromMem(embeddedProfile);
 			inputProfisEmbedded = true;
 		}
 		else
 		{
-			QByteArray profilePath;
+			QString profilePath;
 			//CB If this is null, customfiledialog/picsearch/ScPreview might be sending it
 			Q_ASSERT(cmSettings.doc()!=0);
 			if (isCMYK)
@@ -2051,8 +2050,8 @@
 				{
 					imgInfo.profileName = cmSettings.profileName();
 					inputProfisEmbedded = true;
-					profilePath = ScCore->InputProfilesCMYK[imgInfo.profileName].toLocal8Bit();
-					inputProf = cmsOpenProfileFromFile(profilePath.data(), "r");
+					profilePath = ScCore->InputProfilesCMYK[imgInfo.profileName];
+					inputProf = ScColorMgmtEngine::openProfileFromFile(profilePath);
 				}
 				else
 				{
@@ -2068,7 +2067,7 @@
 					imgInfo.profileName = cmSettings.profileName();
 					profilePath = ScCore->InputProfiles[imgInfo.profileName].toLocal8Bit();
 					inputProfisEmbedded = true;
-					inputProf = cmsOpenProfileFromFile(profilePath.data(), "r");
+					inputProf = ScColorMgmtEngine::openProfileFromFile(profilePath);
 				}
 				else
 				{
@@ -2081,7 +2080,7 @@
 	}
 	else if ((useProf && embeddedProfile.size() > 0) && (useEmbedded))
 	{
-		inputProf = cmsOpenProfileFromMem(embeddedProfile.data(), embeddedProfile.size());
+		inputProf = ScColorMgmtEngine::openProfileFromMem(embeddedProfile);
 		inputProfisEmbedded = true;
 	}
 	else if (useProf && isCMYK)
@@ -2090,55 +2089,54 @@
 		inputProf = NULL; // Workaround to map directly gray to K channel
 	else if (useProf)
 		inputProf = ScCore->defaultRGBProfile;
-	cmsHPROFILE screenProf  = cmSettings.monitorProfile() ? cmSettings.monitorProfile() : ScCore->defaultRGBProfile;
-	cmsHPROFILE printerProf = cmSettings.printerProfile() ? cmSettings.printerProfile() : ScCore->defaultCMYKProfile;
+	ScColorProfile screenProf  = cmSettings.monitorProfile() ? cmSettings.monitorProfile() : ScCore->defaultRGBProfile;
+	ScColorProfile printerProf = cmSettings.printerProfile() ? cmSettings.printerProfile() : ScCore->defaultCMYKProfile;
 	if (useProf && inputProf && screenProf && printerProf)
 	{
 		bool  isPsdTiff = (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext));
-		DWORD SC_TYPE_YMCK_8 = (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1)|DOSWAP_SH(1)|SWAPFIRST_SH(1));
-		DWORD inputProfFormat = TYPE_BGRA_8;
-		DWORD outputProfFormat = SC_TYPE_YMCK_8;
-		int inputProfColorSpace = static_cast<int>(cmsGetColorSpace(inputProf));
-		if ( inputProfColorSpace == icSigRgbData )
-			inputProfFormat = isPsdTiff ? TYPE_RGBA_8 : TYPE_BGRA_8; // Later make tiff and psd loader use TYPE_BGRA_8
-		else if (( inputProfColorSpace == icSigCmykData ) && isPsdTiff)
+		eColorFormat inputProfFormat  = Format_BGRA_8;
+		eColorFormat outputProfFormat = Format_YMCK_8;
+		eColorSpaceType inputProfColorSpace = inputProf.colorSpace();
+		if ( inputProfColorSpace == ColorSpace_Rgb )
+			inputProfFormat = isPsdTiff ? Format_RGBA_8 : Format_BGRA_8; // Later make tiff and psd loader use Format_BGRA_8
+		else if (( inputProfColorSpace == ColorSpace_Cmyk ) && isPsdTiff)
 		{
 			if (pDataLoader->r_image.channels() == 5)
-				inputProfFormat = (COLORSPACE_SH(PT_CMYK)|EXTRA_SH(1)|CHANNELS_SH(4)|BYTES_SH(1));
+				inputProfFormat = Format_CMYKA_8;
 			else
-				inputProfFormat = TYPE_CMYK_8;
-		}
-		else if ( inputProfColorSpace == icSigCmykData )
-			inputProfFormat = SC_TYPE_YMCK_8;
-		else if ( inputProfColorSpace == icSigGrayData )
-			inputProfFormat = TYPE_GRAY_8;
-		int outputProfColorSpace = static_cast<int>(cmsGetColorSpace(printerProf));
-		if ( outputProfColorSpace == icSigRgbData )
-			outputProfFormat = TYPE_BGRA_8;
-		else if ( outputProfColorSpace == icSigCmykData )
-			outputProfFormat = SC_TYPE_YMCK_8;
+				inputProfFormat = Format_CMYK_8;
+		}
+		else if ( inputProfColorSpace == ColorSpace_Cmyk )
+			inputProfFormat = Format_YMCK_8;
+		else if ( inputProfColorSpace == ColorSpace_Gray )
+			inputProfFormat = Format_GRAY_8;
+		eColorSpaceType outputProfColorSpace = printerProf.colorSpace();
+		if ( outputProfColorSpace == ColorSpace_Rgb )
+			outputProfFormat = Format_BGRA_8;
+		else if ( outputProfColorSpace == ColorSpace_Cmyk )
+			outputProfFormat = Format_YMCK_8;
 		if (cmSettings.useColorManagement() && cmSettings.doSoftProofing())
 		{
-			cmsProofFlags |= cmsFLAGS_SOFTPROOFING;
+			cmsProofFlags |= Ctf_Softproofing;
 			if (cmSettings.doGamutCheck())
 			{
-				cmsProofFlags |= cmsFLAGS_GAMUTCHECK;
+				cmsProofFlags |= Ctf_GamutCheck;
 			}
 		}
 		if (!cmSettings.useColorManagement() || cmSettings.useBlackPoint())
-			cmsFlags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
+			cmsFlags |= Ctf_BlackPointCompensation;
 		switch (reqType)
 		{
 		case CMYKData: // CMYK
 //			if ((!isCMYK && (outputProfColorSpace == icSigCmykData)) || (isCMYK && (outputProfColorSpace == icSigRgbData)) )
-				xform = scCmsCreateTransform(inputProf, inputProfFormat, printerProf, outputProfFormat, cmSettings.imageRenderingIntent(), cmsFlags);
-			if (outputProfColorSpace != icSigCmykData )
+			xform = ScColorMgmtEngine::createTransform(inputProf, inputProfFormat, printerProf, outputProfFormat, cmSettings.imageRenderingIntent(), cmsFlags);
+			if (outputProfColorSpace != ColorSpace_Cmyk )
 				*realCMYK = isCMYK = false;
 			break;
 		case Thumbnail:
 		case RGBData: // RGB
 			if (isCMYK)
-				xform = scCmsCreateTransform(inputProf, inputProfFormat, screenProf, TYPE_BGRA_8, cmSettings.intent(), cmsFlags);
+				xform = ScColorMgmtEngine::createTransform(inputProf, inputProfFormat, screenProf, Format_BGRA_8, cmSettings.intent(), cmsFlags);
 			else
 			{
 				if (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext))
@@ -2164,17 +2162,17 @@
 							xform = cmSettings.cmykImageProofingTransform();
 						else
 							xform = cmSettings.rgbImageProofingTransform();
-						cmsChangeBuffersFormat(xform, inputProfFormat, TYPE_BGRA_8);
+						xform.changeBufferFormat(inputProfFormat, Format_BGRA_8);
 						stdProof = true;
 					}
 					else
-						xform = scCmsCreateProofingTransform(inputProf, inputProfFormat,
-					                     screenProf, TYPE_BGRA_8, printerProf,
-					                     cmSettings.intent(), INTENT_RELATIVE_COLORIMETRIC, cmsFlags | cmsProofFlags);
+						xform = ScColorMgmtEngine::createProofingTransform(inputProf, inputProfFormat,
+					                     screenProf, Format_BGRA_8, printerProf,
+					                     cmSettings.intent(), Intent_Relative_Colorimetric, cmsFlags | cmsProofFlags);
 				}
 				else
-					xform = scCmsCreateTransform(inputProf, inputProfFormat, screenProf, 
-										 TYPE_BGRA_8, cmSettings.intent(), cmsFlags);
+					xform = ScColorMgmtEngine::createTransform(inputProf, inputProfFormat, screenProf, 
+										 Format_BGRA_8, cmSettings.intent(), cmsFlags);
 			}
 			break;
 		case RawData: // no Conversion just raw Data
@@ -2205,13 +2203,13 @@
 				// JG : this line overwrite image profile info and should not be needed here!!!!
 				// imgInfo = pDataLoader->imageInfoRecord();
 			}
-			LPBYTE ptr2 = NULL;
+			uchar* ptr2 = NULL;
 			for (int i = 0; i < height(); i++)
 			{
-				LPBYTE ptr = scanLine(i);
+				uchar* ptr = scanLine(i);
 				if (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext))
 					ptr2 = pDataLoader->r_image.scanLine(i);
-				if ( inputProfFormat == TYPE_GRAY_8 && (reqType != CMYKData) )
+				if ( inputProfFormat == Format_GRAY_8 && (reqType != CMYKData) )
 				{
 					unsigned char* ucs = ptr2 ? (ptr2 + 1) : (ptr + 1);
 					unsigned char* uc = new unsigned char[width()];
@@ -2220,10 +2218,10 @@
 						uc[uci] = *ucs;
 						ucs += 4;
 					}
-					cmsDoTransform(xform, uc, ptr, width());
+					xform.apply(uc, ptr, width());
 					delete[] uc;
 				}
-				else if ( inputProfFormat == TYPE_GRAY_8 && (reqType == CMYKData) )
+				else if ( inputProfFormat == Format_GRAY_8 && (reqType == CMYKData) )
 				{
 					unsigned char  value;
 					unsigned char* ucs = ptr2 ? ptr2 : ptr;
@@ -2240,10 +2238,10 @@
 				{
 					if (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext))
 					{
-						cmsDoTransform(xform, ptr2, ptr, width());
+						xform.apply(ptr2, ptr, width());
 					}
 					else
-						cmsDoTransform(xform, ptr, ptr, width());
+						xform.apply(ptr, ptr, width());
 				}
 				// if transforming from CMYK to RGB, flatten the alpha channel
 				// which will still contain the black channel
@@ -2299,15 +2297,11 @@
 					}
 				}
 			}
-			if (!stdProof && !ScCore->IsDefaultTransform(xform))
-				cmsDeleteTransform (xform);
-		}
-		if ((inputProf) && (inputProfisEmbedded) && !ScCore->IsDefaultProfile(inputProf))
-			cmsCloseProfile(inputProf);
+		}
 		if (isCMYK)
-			cmsChangeBuffersFormat(cmSettings.cmykImageProofingTransform(), TYPE_CMYK_8, TYPE_RGBA_8);
+			cmSettings.cmykImageProofingTransform().changeBufferFormat(Format_CMYK_8, Format_RGBA_8);
 		else
-			cmsChangeBuffersFormat(cmSettings.rgbImageProofingTransform(), TYPE_RGBA_8, TYPE_RGBA_8);
+			cmSettings.rgbImageProofingTransform().changeBufferFormat(Format_RGBA_8, Format_RGBA_8);
 	}
 	else
 	{

Modified: branches/Version135/Scribus/scribus/scimgdataloader_jpeg.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/scimgdataloader_jpeg.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/scimgdataloader_jpeg.cpp (original)
+++ branches/Version135/Scribus/scribus/scimgdataloader_jpeg.cpp Sun Oct 31 10:44:16 2010
@@ -10,9 +10,8 @@
 #include <setjmp.h>
 #include "scconfig.h"
 #include "scimgdataloader_jpeg.h"
+#include "colormgmt/sccolormgmtengine.h"
 #include "exif.h"
-
-#include CMS_INC
 
 typedef struct my_error_mgr
 {
@@ -76,18 +75,18 @@
 	unsigned char* EmbedBuffer;
 	if (read_jpeg_marker(ICC_MARKER,&cinfo, &EmbedBuffer, &EmbedLen))
 	{
-		cmsHPROFILE prof = cmsOpenProfileFromMem(EmbedBuffer, EmbedLen);
+		QByteArray profArray = QByteArray((const char*) EmbedBuffer, EmbedLen);
+		ScColorProfile prof  = ScColorMgmtEngine::openProfileFromMem(profArray);
 		if (prof)
 		{
-			if (static_cast<int>(cmsGetColorSpace(prof)) == icSigRgbData)
+			if (prof.colorSpace() == ColorSpace_Rgb)
 				m_profileComponents = 3;
-			if (static_cast<int>(cmsGetColorSpace(prof)) == icSigCmykData)
+			if (prof.colorSpace() == ColorSpace_Cmyk)
 				m_profileComponents = 4;
-			if (static_cast<int>(cmsGetColorSpace(prof)) == icSigGrayData)
+			if (prof.colorSpace() == ColorSpace_Gray)
 				m_profileComponents = 1;
-			m_embeddedProfile = QByteArray((const char*) EmbedBuffer, EmbedLen);
-		}
-		cmsCloseProfile(prof);
+			m_embeddedProfile = profArray;
+		}
 		free(EmbedBuffer);
 	}
 	//(void) jpeg_finish_decompress(&cinfo);
@@ -220,12 +219,11 @@
 	unsigned char* EmbedBuffer;
 	if (read_jpeg_marker(ICC_MARKER,&cinfo, &EmbedBuffer, &EmbedLen))
 	{
-		const char *Descriptor;
-		cmsHPROFILE prof = cmsOpenProfileFromMem(EmbedBuffer, EmbedLen);
-		Descriptor = cmsTakeProductDesc(prof);
-		m_embeddedProfile = QByteArray((const char*) EmbedBuffer, EmbedLen);
-		m_imageInfoRecord.profileName = QString(Descriptor);
-		m_imageInfoRecord.isEmbedded = true;
+		QByteArray profArray = QByteArray((const char*) EmbedBuffer, EmbedLen);
+		ScColorProfile prof = ScColorMgmtEngine::openProfileFromMem(profArray);
+		m_embeddedProfile   = profArray;
+		m_imageInfoRecord.profileName = prof.productDescription();
+		m_imageInfoRecord.isEmbedded  = true;
 		free(EmbedBuffer);
 	}
 	else

Modified: branches/Version135/Scribus/scribus/scimgdataloader_ps.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/scimgdataloader_ps.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/scimgdataloader_ps.cpp (original)
+++ branches/Version135/Scribus/scribus/scimgdataloader_ps.cpp Sun Oct 31 10:44:16 2010
@@ -11,6 +11,7 @@
 #include <QFileInfo>
 #include <QRegExp>
 
+#include "colormgmt/sccolormgmtengine.h"
 #include "scclocale.h"
 #include "scpaths.h"
 #include "scribuscore.h"
@@ -81,20 +82,17 @@
 					}
 					if (tmp.startsWith("%%EndICCProfile"))
 					{
-						cmsHPROFILE prof = cmsOpenProfileFromMem(psdata.data(), psdata.size());
+						ScColorProfile prof = ScColorMgmtEngine::openProfileFromMem(psdata);
 						if (prof)
 						{
-							if (static_cast<int>(cmsGetColorSpace(prof)) == icSigRgbData)
+							if (prof.colorSpace() == ColorSpace_Rgb)
 								m_profileComponents = 3;
-							if (static_cast<int>(cmsGetColorSpace(prof)) == icSigCmykData)
+							if (prof.colorSpace() == ColorSpace_Cmyk)
 								m_profileComponents = 4;
-							const char *Descriptor;
-							Descriptor = cmsTakeProductDesc(prof);
-							m_imageInfoRecord.profileName = QString(Descriptor);
+							m_imageInfoRecord.profileName = prof.productDescription();
 							m_imageInfoRecord.isEmbedded = true;
 							m_embeddedProfile = QByteArray((const char*)psdata.data(), psdata.size());
 						}
-						cmsCloseProfile(prof);
 						break;
 					}
 				}
@@ -180,7 +178,7 @@
 					f2.close();
 					imgc.resize(0);
 					ScImage thum;
-					CMSettings cms(0, "", 0);
+					CMSettings cms(0, "", Intent_Perceptual);
 					bool mode = true;
 					if (thum.LoadPicture(tmpFile, 1, cms, false, false, ScImage::RGBData, 72, &mode))
 					{
@@ -427,20 +425,17 @@
 							}
 							if (tmp.startsWith("%%EndICCProfile"))
 							{
-								cmsHPROFILE prof = cmsOpenProfileFromMem(psdata.data(), psdata.size());
+								ScColorProfile prof = ScColorMgmtEngine::openProfileFromMem(psdata);
 								if (prof)
 								{
-									if (static_cast<int>(cmsGetColorSpace(prof)) == icSigRgbData)
+									if (prof.colorSpace() == ColorSpace_Rgb)
 										m_profileComponents = 3;
-									if (static_cast<int>(cmsGetColorSpace(prof)) == icSigCmykData)
+									if (prof.colorSpace() == ColorSpace_Cmyk)
 										m_profileComponents = 4;
-									const char *Descriptor;
-									Descriptor = cmsTakeProductDesc(prof);
-									m_imageInfoRecord.profileName = QString(Descriptor);
-									m_imageInfoRecord.isEmbedded = true;
+									m_imageInfoRecord.profileName = prof.productDescription();
+									m_imageInfoRecord.isEmbedded  = true;
 									m_embeddedProfile = QByteArray((const char*)psdata.data(), psdata.size());
 								}
-								cmsCloseProfile(prof);
 								break;
 							}
 						}

Modified: branches/Version135/Scribus/scribus/scimgdataloader_psd.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/scimgdataloader_psd.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/scimgdataloader_psd.cpp (original)
+++ branches/Version135/Scribus/scribus/scimgdataloader_psd.cpp Sun Oct 31 10:44:16 2010
@@ -6,14 +6,13 @@
 */
 #include "scconfig.h"
 #include "scimgdataloader_psd.h"
+#include "sccolorengine.h"
 #include "util_color.h"
-#include "sccolorengine.h"
+#include "colormgmt/sccolormgmtengine.h"
 
 #include <QFile>
 #include <QFileInfo>
 #include <QList>
-
-#include CMS_INC
 
 static QDataStream & operator>> ( QDataStream & s, PSDHeader & header )
 {
@@ -46,7 +45,7 @@
 {
 	m_embeddedProfile.resize(0);
 	m_profileComponents = 0;
-	cmsHPROFILE prof = 0;
+	ScColorProfile prof;
 	QFileInfo fi = QFileInfo(fn);
 	if (!fi.exists())
 		return;
@@ -72,17 +71,16 @@
 				return;
 			if (m_embeddedProfile.size() > 0)
 			{
-				prof = cmsOpenProfileFromMem(m_embeddedProfile.data(), m_embeddedProfile.size());
+				prof = ScColorMgmtEngine::openProfileFromMem(m_embeddedProfile);
 				if (prof)
 				{
-					if (static_cast<int>(cmsGetColorSpace(prof)) == icSigRgbData)
+					if (prof.colorSpace() == ColorSpace_Rgb)
 						m_profileComponents = 3;
-					if (static_cast<int>(cmsGetColorSpace(prof)) == icSigCmykData)
+					if (prof.colorSpace() == ColorSpace_Cmyk)
 						m_profileComponents = 4;
-					if (static_cast<int>(cmsGetColorSpace(prof)) == icSigGrayData)
+					if (prof.colorSpace() == ColorSpace_Gray)
 						m_profileComponents = 1;
 				}
-				cmsCloseProfile(prof);
 			}
 			f.close();
 		}
@@ -167,11 +165,9 @@
 			return false;
 		if (m_embeddedProfile.size() > 0)
 		{
-			cmsHPROFILE prof = cmsOpenProfileFromMem(m_embeddedProfile.data(), m_embeddedProfile.size());
-			const char *Descriptor;
-			Descriptor = cmsTakeProductDesc(prof);
-			m_imageInfoRecord.profileName = QString(Descriptor);
-			m_imageInfoRecord.isEmbedded = true;
+			ScColorProfile prof = ScColorMgmtEngine::openProfileFromMem(m_embeddedProfile);
+			m_imageInfoRecord.profileName = prof.productDescription();
+			m_imageInfoRecord.isEmbedded  = true;
 		}
 		if (header.color_mode == CM_CMYK)
 			isCMYK = true;
@@ -926,18 +922,14 @@
 	}
 	if (header.color_mode == CM_LABCOLOR)
 	{
-		cmsHPROFILE hsRGB = cmsCreate_sRGBProfile();
-		cmsHPROFILE hLab  = cmsCreateLabProfile(NULL);
-		DWORD inputProfFormat = (COLORSPACE_SH(PT_Lab)|CHANNELS_SH(3)|BYTES_SH(1)|EXTRA_SH(1));
-		cmsHTRANSFORM xform = cmsCreateTransform(hLab, inputProfFormat, hsRGB, TYPE_RGBA_8, INTENT_PERCEPTUAL, 0);
+		ScColorProfile hsRGB = ScColorMgmtEngine::createProfile_sRGB();
+		ScColorProfile hLab  = ScColorMgmtEngine::createProfile_Lab();
+		ScColorTransform xform = ScColorMgmtEngine::createTransform(hLab, Format_LabA_8, hsRGB, Format_RGBA_8, Intent_Perceptual, 0);
 		for (int i = 0; i < r2_image.height(); i++)
 		{
-			LPBYTE ptr = r2_image.scanLine(i);
-			cmsDoTransform(xform, ptr, ptr, r2_image.width());
-		}
-		cmsDeleteTransform (xform);
-		cmsCloseProfile(hsRGB);
-		cmsCloseProfile(hLab);
+			uchar* ptr = r2_image.scanLine(i);
+			xform.apply(ptr, ptr, r2_image.width());
+		}
 	}
 	s.device()->seek( base2 );
 	QImage tmpImg2;
@@ -1517,18 +1509,14 @@
 	}
 	if (header.color_mode == CM_LABCOLOR)
 	{
-		cmsHPROFILE hsRGB = cmsCreate_sRGBProfile();
-		cmsHPROFILE hLab  = cmsCreateLabProfile(NULL);
-		DWORD inputProfFormat = (COLORSPACE_SH(PT_Lab)|CHANNELS_SH(3)|BYTES_SH(1)|EXTRA_SH(1));
-		cmsHTRANSFORM xform = cmsCreateTransform(hLab, inputProfFormat, hsRGB, TYPE_RGBA_8, INTENT_PERCEPTUAL, 0);
+		ScColorProfile hsRGB   = ScColorMgmtEngine::createProfile_sRGB();
+		ScColorProfile hLab    = ScColorMgmtEngine::createProfile_Lab();
+		ScColorTransform xform = ScColorMgmtEngine::createTransform(hLab, Format_LabA_8, hsRGB, Format_RGBA_8, Intent_Perceptual, 0);
 		for (int i = 0; i < r_image.height(); i++)
 		{
-			LPBYTE ptr = r_image.scanLine(i);
-			cmsDoTransform(xform, ptr, ptr, r_image.width());
-		}
-		cmsDeleteTransform (xform);
-		cmsCloseProfile(hsRGB);
-		cmsCloseProfile(hLab);
+			uchar* ptr = r_image.scanLine(i);
+			xform.apply(ptr, ptr, r_image.width());
+		}
 	}
 	return true;
 }

Modified: branches/Version135/Scribus/scribus/scimgdataloader_tiff.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/scimgdataloader_tiff.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/scimgdataloader_tiff.cpp (original)
+++ branches/Version135/Scribus/scribus/scimgdataloader_tiff.cpp Sun Oct 31 10:44:16 2010
@@ -12,7 +12,8 @@
 #include "scconfig.h"
 #include "scimgdataloader_tiff.h"
 #include "util_color.h"
-#include CMS_INC
+
+#include "colormgmt/sccolormgmtengine.h"
 
 static void TagExtender(TIFF *tiff)
 {
@@ -45,22 +46,22 @@
 	TIFF* tif = TIFFOpen(fn.toLocal8Bit(), "r");
 	if(tif)
 	{
-		DWORD EmbedLen = 0;
-		LPBYTE EmbedBuffer;
+		uint32 EmbedLen = 0;
+		void*  EmbedBuffer;
 		if (TIFFGetField(tif, TIFFTAG_ICCPROFILE, &EmbedLen, &EmbedBuffer))
 		{
-			cmsHPROFILE tiffProf = cmsOpenProfileFromMem(EmbedBuffer, EmbedLen);
+			QByteArray profArray((const char*) EmbedBuffer, EmbedLen);
+			ScColorProfile tiffProf = ScColorMgmtEngine::openProfileFromMem(profArray);
 			if (tiffProf)
 			{
-				if (static_cast<int>(cmsGetColorSpace(tiffProf)) == icSigRgbData)
+				if (tiffProf.colorSpace() == ColorSpace_Rgb)
 					m_profileComponents = 3;
-				if (static_cast<int>(cmsGetColorSpace(tiffProf)) == icSigCmykData)
+				if (tiffProf.colorSpace() == ColorSpace_Cmyk)
 					m_profileComponents = 4;
-				if (static_cast<int>(cmsGetColorSpace(tiffProf)) == icSigGrayData)
+				if (tiffProf.colorSpace() == ColorSpace_Gray)
 					m_profileComponents = 1;
-				m_embeddedProfile = QByteArray((const char*) EmbedBuffer, EmbedLen);
-			}
-			cmsCloseProfile(tiffProf);
+				m_embeddedProfile = profArray;
+			}
 		}
 		TIFFClose(tif);
 	}
@@ -661,17 +662,15 @@
 		m_imageInfoRecord.exifInfo.artist = QString(artist);
 		m_imageInfoRecord.exifInfo.thumbnail = QImage();
 		m_imageInfoRecord.exifDataValid = true;
-		DWORD EmbedLen = 0;
-		LPBYTE EmbedBuffer;
+		uint32 EmbedLen = 0;
+		void*  EmbedBuffer;
 		if (TIFFGetField(tif, TIFFTAG_ICCPROFILE, &EmbedLen, &EmbedBuffer))
 		{
-			const char *Descriptor;
-			cmsHPROFILE tiffProf = cmsOpenProfileFromMem(EmbedBuffer, EmbedLen);
-			Descriptor = cmsTakeProductDesc(tiffProf);
-			m_embeddedProfile = QByteArray((const char*) EmbedBuffer, EmbedLen);
-			m_imageInfoRecord.profileName = QString(Descriptor);
-			m_imageInfoRecord.isEmbedded = true;
-			cmsCloseProfile(tiffProf);
+			QByteArray profArray((const char*) EmbedBuffer, EmbedLen);
+			ScColorProfile tiffProf = ScColorMgmtEngine::openProfileFromMem(profArray);
+			m_embeddedProfile = profArray;
+			m_imageInfoRecord.profileName = tiffProf.productDescription();
+			m_imageInfoRecord.isEmbedded  = true;
 		}
 		else
 		{

Modified: branches/Version135/Scribus/scribus/scpainterex_ps2.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/scpainterex_ps2.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/scpainterex_ps2.cpp (original)
+++ branches/Version135/Scribus/scribus/scpainterex_ps2.cpp Sun Oct 31 10:44:16 2010
@@ -459,9 +459,9 @@
 	}
 	else if ( m_options.hProfile && m_options.rgbToOutputColorTransform && m_options.cmykToOutputColorTransform)
 	{
-		DWORD colorIn[4];
-		DWORD colorOut[4];
-		cmsHTRANSFORM cmsTranform = NULL;
+		unsigned long colorIn[4];
+		unsigned long colorOut[4];
+		ScColorTransform cmsTranform;
 		if( colorShade.color.getColorModel() == colorModelRGB )
 		{
 			RGBColor rgb;
@@ -483,15 +483,15 @@
 			colorMode = cmykMode;
 			cmsTranform = m_options.cmykToOutputColorTransform;
 		}
-		cmsDoTransform( cmsTranform, colorIn, colorOut, 1 );
-		if (static_cast<int>(cmsGetColorSpace(m_options.hProfile)) == icSigRgbData)
+		cmsTranform.apply(colorIn, colorOut, 1 );
+		if (m_options.hProfile.colorSpace() == ColorSpace_Rgb)
 		{
 			r = colorOut[0] / 257;
 			g = colorOut[1] / 257;
 			b = colorOut[2] / 257;
 			colorMode = rgbMode;
 		}
-		else if (static_cast<int>(cmsGetColorSpace(m_options.hProfile)) == icSigCmykData)
+		else if (m_options.hProfile.colorSpace() == ColorSpace_Cmyk)
 		{
 			c = colorOut[0] / 257;
 			m = colorOut[1] / 257;

Modified: branches/Version135/Scribus/scribus/scpainterex_ps2.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/scpainterex_ps2.h
==============================================================================
--- branches/Version135/Scribus/scribus/scpainterex_ps2.h (original)
+++ branches/Version135/Scribus/scribus/scpainterex_ps2.h Sun Oct 31 10:44:16 2010
@@ -41,12 +41,12 @@
 
 #include "scribusapi.h"
 #include "scconfig.h"
+#include "colormgmt/sccolormgmtengine.h"
 #include "fpoint.h"
 #include "fpointarray.h"
 #include "vgradient.h"
 
 #include "scpainterexbase.h"
-#include CMS_INC
 
 class ScribusDoc;
 
@@ -63,11 +63,11 @@
 	bool mirrorH;
 	bool mirrorV;
 	QString outputProfile;
-	cmsHPROFILE   hProfile;
-	cmsHTRANSFORM rgbToOutputColorTransform;
-	cmsHTRANSFORM rgbToOutputImageTransform;
-	cmsHTRANSFORM cmykToOutputColorTransform;
-	cmsHTRANSFORM cmykToOutputImageTransform;
+	ScColorProfile   hProfile;
+	ScColorTransform rgbToOutputColorTransform;
+	ScColorTransform rgbToOutputImageTransform;
+	ScColorTransform cmykToOutputColorTransform;
+	ScColorTransform cmykToOutputImageTransform;
 };
 
 class SCRIBUS_API ScPainterEx_Ps2 : public ScPainterExBase

Modified: branches/Version135/Scribus/scribus/scpreview.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/scpreview.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/scpreview.cpp (original)
+++ branches/Version135/Scribus/scribus/scpreview.cpp Sun Oct 31 10:44:16 2010
@@ -19,7 +19,6 @@
 #include <QPolygon>
 #include <QPixmap>
 #include <QTemporaryFile>
-#include <cmath>
 #include <cstdlib>
 
 #include "cmsettings.h"
@@ -298,7 +297,7 @@
 			OB.Pfile3 = pg.attribute("PFILE3","");
 			OB.IProfile = pg.attribute("PRFILE","");
 			OB.EmProfile = pg.attribute("EPROF","");
-			OB.IRender = pg.attribute("IRENDER", "1").toInt();
+			OB.IRender = (eRenderIntent) pg.attribute("IRENDER", "1").toInt();
 			OB.UseEmbedded = pg.attribute("EMBEDDED", "1").toInt();
 			OB.Locked = static_cast<bool>(pg.attribute("LOCK", "0").toInt());
 			OB.Reverse = static_cast<bool>(pg.attribute("REVERS", "0").toInt());
@@ -607,7 +606,7 @@
 							pS->scale(1, -1);
 						}
 						ScImage pixm;
-						CMSettings cms(0, "", 0);
+						CMSettings cms(0, "", Intent_Perceptual);
 						pixm.LoadPicture(OB.Pfile, 1, cms, false, false, 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));
@@ -650,7 +649,7 @@
 									pS->scale(1, -1);
 								}
 								ScImage pixm;
-								CMSettings cms(0, "", 0);
+								CMSettings cms(0, "", Intent_Perceptual);
 								pixm.LoadPicture(fileName, 1, cms, false, false, 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));

Modified: branches/Version135/Scribus/scribus/scribus.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/scribus.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/scribus.cpp (original)
+++ branches/Version135/Scribus/scribus/scribus.cpp Sun Oct 31 10:44:16 2010
@@ -49,10 +49,8 @@
 #include <QTranslator>
 #include <QWheelEvent>
 
-
 #include <cstdio>
 #include <cstdlib>
-#include <cmath>
 #include <cassert>
 
 #include "scconfig.h"
@@ -215,6 +213,7 @@
 #include "util_formats.h"
 #include "util_ghostscript.h"
 #include "util_icon.h"
+#include "util_math.h"
 #include "vruler.h"
 #include "loadsaveplugin.h"
 #include "plugins/formatidlist.h"

Modified: branches/Version135/Scribus/scribus/scribusXml.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/scribusXml.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/scribusXml.cpp (original)
+++ branches/Version135/Scribus/scribus/scribusXml.cpp Sun Oct 31 10:44:16 2010
@@ -30,7 +30,6 @@
 #include <QDebug>
 
 #include <cstdlib>
-#include <cmath>
 #include "missing.h"
 #include "page.h"
 #include "pageitem.h"
@@ -285,7 +284,7 @@
 	OB->Pfile3     = attrAsString(attrs, "PFILE3","");
 	OB->IProfile   = attrAsString(attrs, "PRFILE","");
 	OB->EmProfile  = attrAsString(attrs, "EPROF","");
-	OB->IRender    = attrAsInt (attrs, "IRENDER", 1);
+	OB->IRender    = (eRenderIntent) attrAsInt (attrs, "IRENDER", (int) Intent_Relative_Colorimetric);
 	OB->UseEmbedded= attrAsInt (attrs, "EMBEDDED", 1);
 	OB->Locked       = attrAsBool(attrs, "LOCK", false);
 	OB->LockRes      = attrAsBool(attrs, "LOCKR", false);

Modified: branches/Version135/Scribus/scribus/scribuscore.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/scribuscore.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/scribuscore.cpp (original)
+++ branches/Version135/Scribus/scribus/scribuscore.cpp Sun Oct 31 10:44:16 2010
@@ -25,7 +25,7 @@
 #include <QDebug>
 #include <QGlobalStatic>
 
-#include "cmserrorhandling.h"
+#include "colormgmt/sccolormgmtengine.h"
 #include "commonstrings.h"
 #include "filewatcher.h"
 #include "pluginmanager.h"
@@ -37,7 +37,6 @@
 #include "undomanager.h"
 #include "util.h"
 #include "util_icon.h"
-#include "util_cms.h"
 #include "util_ghostscript.h"
 
 
@@ -378,227 +377,130 @@
 
 void ScribusCore::getCMSProfilesDir(QString pfad, bool showInfo, bool recursive)
 {
-	QDir d(pfad, "*", QDir::Name, QDir::Files | QDir::Readable | QDir::Dirs | QDir::NoSymLinks);
-	if ((d.exists()) && (d.count() != 0))
-	{
-		QString nam = "";
-		const char *Descriptor;
-		cmsHPROFILE hIn = NULL;
-
-		for (uint dc = 0; dc < d.count(); ++dc)
-		{
-			if (d[dc] == "." ||  d[dc] == "..")
-				continue;
-			QFileInfo fi(pfad + "/" + d[dc]);
-			if (fi.isDir() && !recursive)
-				continue;
-			else if (fi.isDir() && d[dc][0] != '.')
+	QString profileName;
+	QList<ScColorProfileInfo> profileInfos = ScColorMgmtEngine::getAvailableProfileInfo(pfad, recursive);
+	for (int i = 0; i < profileInfos.count(); ++i)
+	{
+		const ScColorProfileInfo& profInfo = profileInfos.at(i);
+		profileName = profInfo.description;
+		if (profileName.isEmpty())
+		{
+			if (showInfo)
+				sDebug(QString("Color profile %s is broken : no valid description").arg(profInfo.file));
+			continue;
+		}
+		if (!profInfo.debug.isEmpty())
+		{
+			if (showInfo)
+				sDebug(profInfo.debug);
+			continue;
+		}
+		switch (static_cast<int>(profInfo.deviceClass))
+		{
+		case Class_Input:
+			if (profInfo.colorSpace == ColorSpace_Rgb)
 			{
-				getCMSProfilesDir(fi.filePath()+"/", showInfo, true);
-				continue;
+				if (!InputProfiles.contains(profileName))
+					InputProfiles.insert(profileName, profInfo.file);
 			}
-
-			QFile f(fi.filePath());
-			QByteArray bb(40, ' ');
-			if (!f.open(QIODevice::ReadOnly)) {
-				sDebug(QString("couldn't open %1 as color profile").arg(fi.filePath()));
-				continue;
+			break;
+		case Class_ColorSpace:
+			if (profInfo.colorSpace == ColorSpace_Rgb)
+			{
+				if (!InputProfiles.contains(profileName))
+					InputProfiles.insert(profileName, profInfo.file);
 			}
-			int len = f.read(bb.data(), 40);
-			f.close();
-			if (len == 40 && bb[36] == 'a' && bb[37] == 'c' && bb[38] == 's' && bb[39] == 'p')
+			if (profInfo.colorSpace == ColorSpace_Cmyk)
 			{
-				const QByteArray profilePath( QString(pfad + d[dc]).toLocal8Bit() );
-				if (setjmp(cmsJumpBuffer))
-				{
-					// Profile is broken, show info if necessary
-					if (showInfo)
-						sDebug(QString("Color profile %s is broken").arg(fi.filePath()));
-					// Reset to the default handler otherwise may enter a loop
-					// if an error occur in cmsCloseProfile()
-					cmsSetErrorHandler(NULL);
-					if (hIn)
-					{
-						cmsCloseProfile(hIn);
-						hIn = NULL;
-					}
-					continue;
-				}
-				cmsSetErrorHandler(&cmsErrorHandler);
-				hIn = cmsOpenProfileFromFile(profilePath.data(), "r");
-				if (hIn == NULL)
-					continue;
-				Descriptor = cmsTakeProductDesc(hIn);
-				nam = QString(Descriptor);
-				if (nam.isEmpty())
-				{
-					cmsCloseProfile(hIn);
-					if (showInfo)
-						sDebug(QString("Color profile %s is broken : no valid description").arg(fi.filePath()));
-					continue;
-				}
-				switch (static_cast<int>(cmsGetDeviceClass(hIn)))
-				{
-				case icSigInputClass:
-					if (static_cast<int>(cmsGetColorSpace(hIn)) == icSigRgbData)
-					{
-						if (!InputProfiles.contains(nam))
-							InputProfiles.insert(nam, pfad + d[dc]);
-					}
-					break;
-				case icSigColorSpaceClass:
-					if (static_cast<int>(cmsGetColorSpace(hIn)) == icSigRgbData)
-					{
-						if (!InputProfiles.contains(nam))
-							InputProfiles.insert(nam, pfad + d[dc]);
-					}
-					if (static_cast<int>(cmsGetColorSpace(hIn)) == icSigCmykData)
-					{
-						if (!InputProfilesCMYK.contains(nam))
-							InputProfilesCMYK.insert(nam, pfad + d[dc]);
-					}
-					break;
-				case icSigDisplayClass:
-					if (static_cast<int>(cmsGetColorSpace(hIn)) == icSigRgbData)
-					{
-						if (!MonitorProfiles.contains(nam))
-							MonitorProfiles.insert(nam, pfad + d[dc]);
-						if (!InputProfiles.contains(nam))
-							InputProfiles.insert(nam, pfad + d[dc]);
-					}
-					if (static_cast<int>(cmsGetColorSpace(hIn)) == icSigCmykData)
-					{
-						if (!InputProfilesCMYK.contains(nam))
-							InputProfilesCMYK.insert(nam, pfad + d[dc]);
-					}
-					break;
-				case icSigOutputClass:
-					// Disable rgb printer profile detection until effective support
-					// PrinterProfiles.insert(nam, pfad + d[dc], false);
-					if (static_cast<int>(cmsGetColorSpace(hIn)) == icSigCmykData)
-					{
-						if (!PDFXProfiles.contains(nam))
-							PDFXProfiles.insert(nam, pfad + d[dc]);
-						if (!InputProfilesCMYK.contains(nam))
-							InputProfilesCMYK.insert(nam, pfad + d[dc]);
-						if (!PrinterProfiles.contains(nam))
-							PrinterProfiles.insert(nam, pfad + d[dc]);
-					}
-					break;
-				}
-				cmsCloseProfile(hIn);
-				hIn = NULL;
-				if (showInfo)
-					sDebug( QString("Color profile %1 loaded from %2").arg(nam).arg(pfad + d[dc]) );
+				if (!InputProfilesCMYK.contains(profileName))
+					InputProfilesCMYK.insert(profileName, profInfo.file);
 			}
-		}
-		cmsSetErrorHandler(NULL);
+			break;
+		case Class_Display:
+			if (profInfo.colorSpace == ColorSpace_Rgb)
+			{
+				if (!MonitorProfiles.contains(profileName))
+					MonitorProfiles.insert(profileName, profInfo.file);
+				if (!InputProfiles.contains(profileName))
+					InputProfiles.insert(profileName, profInfo.file);
+			}
+			if (profInfo.colorSpace == ColorSpace_Cmyk)
+			{
+				if (!InputProfilesCMYK.contains(profileName))
+					InputProfilesCMYK.insert(profileName, profInfo.file);
+			}
+			break;
+		case Class_Output:
+			// Disable rgb printer profile detection until effective support
+			// PrinterProfiles.insert(nam, pfad + d[dc], false);
+			if (profInfo.colorSpace == ColorSpace_Cmyk)
+			{
+				if (!PDFXProfiles.contains(profileName))
+					PDFXProfiles.insert(profileName, profInfo.file);
+				if (!InputProfilesCMYK.contains(profileName))
+					InputProfilesCMYK.insert(profileName, profInfo.file);
+				if (!PrinterProfiles.contains(profileName))
+					PrinterProfiles.insert(profileName, profInfo.file);
+			}
+			break;
+		}
+		if (showInfo)
+			sDebug( QString("Color profile %1 loaded from %2").arg(profileName).arg(profInfo.file) );
 	}
 }
 
 void ScribusCore::InitDefaultColorTransforms(void)
 {
 	TermDefaultColorTransforms();
-
-	cmsErrorAction(LCMS_ERROR_ABORT);
-	if (setjmp(cmsJumpBuffer))
-	{
-		// Reset to the default handler otherwise may enter a loop
-		// if an error occur afterwards
-		cmsSetErrorHandler(NULL);
-		cmsErrorAction(LCMS_ERROR_IGNORE);
-		TermDefaultColorTransforms();
-		cmsErrorAction(LCMS_ERROR_ABORT);
-		return;
-	}
-	cmsSetErrorHandler(&cmsErrorHandler);
 
 	// Ouvre le profile RGB par d�fault
 	if (InputProfiles.contains("sRGB IEC61966-2.1"))
-	{
-		const QByteArray rgbProfPath(InputProfiles["sRGB IEC61966-2.1"].toLocal8Bit());
-		defaultRGBProfile = cmsOpenProfileFromFile(rgbProfPath.data(), "r");
-	}
+		defaultRGBProfile = ScColorMgmtEngine::openProfileFromFile(InputProfiles["sRGB IEC61966-2.1"]);
 	else
-		defaultRGBProfile = cmsCreate_sRGBProfile();
+		defaultRGBProfile = ScColorMgmtEngine::createProfile_sRGB();
 
 	// Ouvre le profile CMYK par d�faut
 	if (InputProfilesCMYK.contains("Fogra27L CMYK Coated Press"))
 	{
-		const QByteArray cmykProfPath(InputProfilesCMYK["Fogra27L CMYK Coated Press"].toLocal8Bit());
-		defaultCMYKProfile = cmsOpenProfileFromFile(cmykProfPath.data(), "r");
+		defaultCMYKProfile = ScColorMgmtEngine::openProfileFromFile(InputProfilesCMYK["Fogra27L CMYK Coated Press"]);
 	}
 
 	if (!defaultRGBProfile || !defaultCMYKProfile)
 	{
 		TermDefaultColorTransforms();
-		cmsSetErrorHandler(NULL);
 		return;
 	}
 
-	int dcmsFlags = cmsFLAGS_LOWRESPRECALC | cmsFLAGS_BLACKPOINTCOMPENSATION;
-	int intent    = INTENT_RELATIVE_COLORIMETRIC;
-
-	defaultRGBToScreenSolidTrans  = scCmsCreateTransform(defaultRGBProfile, TYPE_RGB_16,
-				defaultRGBProfile, TYPE_RGB_16, intent, cmsFLAGS_NULLTRANSFORM);
-	defaultRGBToScreenImageTrans  = scCmsCreateTransform(defaultRGBProfile, TYPE_RGBA_8,
-				defaultRGBProfile, TYPE_RGBA_8, intent, cmsFLAGS_NULLTRANSFORM);
-	defaultCMYKToScreenImageTrans = scCmsCreateTransform(defaultRGBProfile, TYPE_CMYK_8,
-				defaultCMYKProfile, TYPE_RGBA_8, intent, cmsFLAGS_NULLTRANSFORM);
-	defaultRGBToCMYKTrans = scCmsCreateTransform(defaultRGBProfile, TYPE_RGB_16,
-				defaultCMYKProfile, TYPE_CMYK_16, intent, dcmsFlags);
-	defaultCMYKToRGBTrans = scCmsCreateTransform(defaultCMYKProfile, TYPE_CMYK_16,
-				defaultRGBProfile, TYPE_RGB_16, intent, dcmsFlags);
+	int dcmsFlags = Ctf_BlackPointCompensation | Ctf_LowResPrecalc;
+	eRenderIntent intent = Intent_Relative_Colorimetric;
+
+	defaultRGBToScreenSolidTrans  = ScColorMgmtEngine::createTransform(defaultRGBProfile, Format_RGB_16,
+				defaultRGBProfile, Format_RGB_16, intent, Ctf_NullTransform);
+	defaultRGBToScreenImageTrans  = ScColorMgmtEngine::createTransform(defaultRGBProfile, Format_RGBA_8,
+				defaultRGBProfile, Format_RGBA_8, intent, Ctf_NullTransform);
+	defaultCMYKToScreenImageTrans = ScColorMgmtEngine::createTransform(defaultRGBProfile, Format_CMYK_8,
+				defaultCMYKProfile, Format_RGBA_8, intent, Ctf_NullTransform);
+	defaultRGBToCMYKTrans = ScColorMgmtEngine::createTransform(defaultRGBProfile, Format_RGB_16,
+				defaultCMYKProfile, Format_CMYK_16, intent, dcmsFlags);
+	defaultCMYKToRGBTrans = ScColorMgmtEngine::createTransform(defaultCMYKProfile, Format_CMYK_16,
+				defaultRGBProfile, Format_RGB_16, intent, dcmsFlags);
 	if (!defaultRGBToScreenSolidTrans  || !defaultRGBToScreenImageTrans || 
 		!defaultCMYKToScreenImageTrans || !defaultRGBToCMYKTrans || 
 		!defaultCMYKToRGBTrans )
 	{
 		TermDefaultColorTransforms();
 	}
-	cmsSetErrorHandler(NULL);
 }
 
 void ScribusCore::TermDefaultColorTransforms(void)
 {
-	if (defaultRGBProfile)
-		cmsCloseProfile(defaultRGBProfile); 
-	if (defaultCMYKProfile)
-		cmsCloseProfile(defaultCMYKProfile);
-	if (defaultRGBToScreenSolidTrans)
-		cmsDeleteTransform(defaultRGBToScreenSolidTrans);
-	if (defaultRGBToScreenImageTrans)
-		cmsDeleteTransform(defaultRGBToScreenImageTrans);
-	if (defaultCMYKToScreenImageTrans)
-		cmsDeleteTransform(defaultCMYKToScreenImageTrans);
-	if (defaultRGBToCMYKTrans)
-		cmsDeleteTransform(defaultRGBToCMYKTrans);
-	if (defaultCMYKToRGBTrans)
-		cmsDeleteTransform(defaultCMYKToRGBTrans);
-	defaultRGBProfile  = NULL;
-	defaultCMYKProfile = NULL;
-	defaultRGBToScreenSolidTrans  = NULL;
-	defaultRGBToScreenImageTrans  = NULL;
-	defaultCMYKToScreenImageTrans = NULL;
-	defaultRGBToCMYKTrans = NULL;
-	defaultCMYKToRGBTrans = NULL;
-}
-
-bool ScribusCore::IsDefaultProfile(cmsHPROFILE prof)
-{
-	if (prof == defaultRGBProfile || prof == defaultCMYKProfile)
-		return true;
-	return false;
-}
-
-bool ScribusCore::IsDefaultTransform(cmsHTRANSFORM trans)
-{
-	if (trans == defaultRGBToScreenSolidTrans || trans == defaultRGBToScreenImageTrans)
-		return true;
-	if (trans == defaultCMYKToScreenImageTrans)
-		return true;
-	if (trans == defaultRGBToCMYKTrans || trans == defaultCMYKToRGBTrans)
-		return true;
-	return false;
+	defaultRGBProfile  = ScColorProfile();
+	defaultCMYKProfile = ScColorProfile();
+	defaultRGBToScreenSolidTrans  = ScColorTransform();
+	defaultRGBToScreenImageTrans  = ScColorTransform();
+	defaultCMYKToScreenImageTrans = ScColorTransform();
+	defaultRGBToCMYKTrans = ScColorTransform();
+	defaultCMYKToRGBTrans = ScColorTransform();
 }
 
 void ScribusCore::initCMS()

Modified: branches/Version135/Scribus/scribus/scribuscore.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/scribuscore.h
==============================================================================
--- branches/Version135/Scribus/scribus/scribuscore.h (original)
+++ branches/Version135/Scribus/scribus/scribuscore.h Sun Oct 31 10:44:16 2010
@@ -27,7 +27,8 @@
 #include "scribus.h"
 #include "scribusapi.h"
 
-#include CMS_INC
+#include "colormgmt/sccolorprofile.h"
+#include "colormgmt/sccolortransform.h"
 
 class QWidget;
 class FileWatcher;
@@ -98,8 +99,6 @@
 	void getCMSProfilesDir(QString pfad, bool showInfo, bool recursive);
 	void InitDefaultColorTransforms(void);
 	void TermDefaultColorTransforms(void);
-	bool IsDefaultProfile(cmsHPROFILE prof);
-	bool IsDefaultTransform(cmsHTRANSFORM trans);
 	bool fileWatcherActive() const;
 	void recheckGS();
 	
@@ -115,13 +114,13 @@
 	ProfilesL PrinterProfiles;
 	ProfilesL PDFXProfiles;
 
-	cmsHPROFILE   defaultRGBProfile;
-	cmsHPROFILE   defaultCMYKProfile;
-	cmsHTRANSFORM defaultRGBToScreenSolidTrans;
-	cmsHTRANSFORM defaultRGBToScreenImageTrans;
-	cmsHTRANSFORM defaultCMYKToScreenImageTrans;
-	cmsHTRANSFORM defaultRGBToCMYKTrans;
-	cmsHTRANSFORM defaultCMYKToRGBTrans;
+	ScColorProfile   defaultRGBProfile;
+	ScColorProfile   defaultCMYKProfile;
+	ScColorTransform defaultRGBToScreenSolidTrans;
+	ScColorTransform defaultRGBToScreenImageTrans;
+	ScColorTransform defaultCMYKToScreenImageTrans;
+	ScColorTransform defaultRGBToCMYKTrans;
+	ScColorTransform defaultCMYKToRGBTrans;
 	//CB FIXME protect
 // 	QWidget *m_PaletteParent;
 	

Modified: branches/Version135/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/scribusdoc.cpp (original)
+++ branches/Version135/Scribus/scribus/scribusdoc.cpp Sun Oct 31 10:44:16 2010
@@ -39,6 +39,7 @@
 #include "canvas.h"
 #include "cmserrorhandling.h"
 #include "commonstrings.h"
+#include "colormgmt/sccolormgmtengine.h"
 #include "desaxe/digester.h"
 #include "desaxe/saxXML.h"
 #include "fileloader.h"
@@ -81,7 +82,6 @@
 #include "undostate.h"
 #include "units.h"
 #include "util.h"
-#include "util_cms.h"
 #include "util_icon.h"
 #include "util_math.h"
 
@@ -662,57 +662,6 @@
 void ScribusDoc::CloseCMSProfiles()
 {
 	HasCMS = false;
-	if (ScCore->haveCMS() /*&& CMSSettings.CMSinUse*/)
-	{
-		if (DocInputImageRGBProf && !ScCore->IsDefaultProfile(DocInputImageRGBProf))
-			cmsCloseProfile(DocInputImageRGBProf);
-		if (DocInputImageCMYKProf && !ScCore->IsDefaultProfile(DocInputImageCMYKProf))
-			cmsCloseProfile(DocInputImageCMYKProf);
-		if (DocInputRGBProf && !ScCore->IsDefaultProfile(DocInputRGBProf))
-			cmsCloseProfile(DocInputRGBProf);
-		if (DocInputCMYKProf && !ScCore->IsDefaultProfile(DocInputCMYKProf))
-			cmsCloseProfile(DocInputCMYKProf);
-		if (DocOutputProf && !ScCore->IsDefaultProfile(DocOutputProf))
-			cmsCloseProfile(DocOutputProf);
-		if (DocPrinterProf && !ScCore->IsDefaultProfile(DocPrinterProf))
-			cmsCloseProfile(DocPrinterProf);
-		if (stdTransRGBMon && !ScCore->IsDefaultTransform(stdTransRGBMon))
-			cmsDeleteTransform(stdTransRGBMon);
-		if (stdTransCMYKMon && !ScCore->IsDefaultTransform(stdTransCMYKMon))
-			cmsDeleteTransform(stdTransCMYKMon);
-		if (stdProof && !ScCore->IsDefaultTransform(stdProof))
-			cmsDeleteTransform(stdProof);
-		if (stdTransImg && !ScCore->IsDefaultTransform(stdTransImg))
-			cmsDeleteTransform(stdTransImg);
-		if (stdProofImg && !ScCore->IsDefaultTransform(stdProofImg))
-			cmsDeleteTransform(stdProofImg);
-		if (stdTransCMYK && !ScCore->IsDefaultTransform(stdTransCMYK))
-			cmsDeleteTransform(stdTransCMYK);
-		if (stdProofCMYK && !ScCore->IsDefaultTransform(stdProofCMYK))
-			cmsDeleteTransform(stdProofCMYK);
-		if (stdTransRGB && !ScCore->IsDefaultTransform(stdTransRGB))
-			cmsDeleteTransform(stdTransRGB);
-		if (stdProofCMYKGC && !ScCore->IsDefaultTransform(stdProofCMYKGC))
-			cmsDeleteTransform(stdProofCMYKGC);
-		if (stdProofGC && !ScCore->IsDefaultTransform(stdProofGC))
-			cmsDeleteTransform(stdProofGC);
-		DocInputRGBProf = NULL;
-		DocInputCMYKProf = NULL;
-		DocInputImageRGBProf = NULL;
-		DocInputImageCMYKProf = NULL;
-		DocOutputProf = NULL;
-		DocPrinterProf = NULL;
-		stdTransRGBMon = NULL;
-		stdTransCMYKMon = NULL;
-		stdProof = NULL;
-		stdTransImg = NULL;
-		stdProofImg = NULL;
-		stdTransCMYK = NULL;
-		stdProofCMYK = NULL;
-		stdTransRGB = NULL;
-		stdProofCMYKGC = NULL;
-		stdProofGC = NULL;
-	}
 	SetDefaultCMSParams();
 }
 
@@ -721,8 +670,8 @@
 	BlackPoint     = true;
 	SoftProofing   = false;
 	Gamut          = false;
-	IntentColors   = 1; // INTENT_RELATIVE_COLORIMETRIC
-	IntentImages   = 1; // INTENT_RELATIVE_COLORIMETRIC
+	IntentColors   = Intent_Relative_Colorimetric;
+	IntentImages   = Intent_Relative_Colorimetric;
 	DocInputRGBProf       = ScCore->defaultRGBProfile;
 	DocInputCMYKProf      = ScCore->defaultCMYKProfile;
 	DocInputImageRGBProf  = ScCore->defaultRGBProfile;
@@ -745,16 +694,119 @@
 bool ScribusDoc::OpenCMSProfiles(ProfilesL InPo, ProfilesL InPoCMYK, ProfilesL MoPo, ProfilesL PrPo)
 {
 	HasCMS = false;
-	cmsHPROFILE inputProf = NULL;
-	cmsErrorAction(LCMS_ERROR_ABORT);
-	if (setjmp(cmsJumpBuffer))
+	ScColorProfile inputProf = NULL;
+
+	DocInputRGBProf  = ScColorMgmtEngine::openProfileFromFile( InPo[CMSSettings.DefaultSolidColorRGBProfile] );
+	DocInputCMYKProf = ScColorMgmtEngine::openProfileFromFile( InPoCMYK[CMSSettings.DefaultSolidColorCMYKProfile] );
+	DocOutputProf    =  ScColorMgmtEngine::openProfileFromFile( MoPo[CMSSettings.DefaultMonitorProfile] );
+	DocPrinterProf   =  ScColorMgmtEngine::openProfileFromFile( PrPo[CMSSettings.DefaultPrinterProfile] );
+	DocInputImageRGBProf =  ScColorMgmtEngine::openProfileFromFile( InPo[CMSSettings.DefaultImageRGBProfile] );
+	DocInputImageCMYKProf =  ScColorMgmtEngine::openProfileFromFile( InPoCMYK[CMSSettings.DefaultImageCMYKProfile] );
+
+	if ((!DocInputRGBProf) || (!DocInputCMYKProf) || (!DocOutputProf) || (!DocPrinterProf) || (!DocInputImageCMYKProf) || (!DocInputImageRGBProf))
+	{
+		CMSSettings.CMSinUse = false;
+		return false;
+	}
+
+	int dcmsFlags   = 0;
+	int dcmsFlagsGC = 0;
+	dcmsFlags   |= Ctf_LowResPrecalc;
+	dcmsFlagsGC |= Ctf_LowResPrecalc;
+//	int dcmsFlags2 = cmsFLAGS_NOTPRECALC;
+	if (CMSSettings.GamutCheck)
+		dcmsFlagsGC |= Ctf_GamutCheck;
+	if (CMSSettings.BlackPoint)
+	{
+		dcmsFlags   |= Ctf_BlackPointCompensation;
+		dcmsFlagsGC |= Ctf_BlackPointCompensation;
+	}
+
+	stdTransRGBMon  = ScColorMgmtEngine::createTransform(DocInputRGBProf, Format_RGB_16,
+										DocOutputProf, Format_RGB_16,
+										IntentColors, dcmsFlags);
+	stdTransCMYKMon = ScColorMgmtEngine::createTransform(DocInputCMYKProf, Format_CMYK_16,
+										DocOutputProf, Format_RGB_16,
+										IntentColors, dcmsFlags);
+	// TODO : check input profiles used for images
+	stdProofImg = ScColorMgmtEngine::createProofingTransform(DocInputImageRGBProf, Format_RGBA_8,
+					DocOutputProf, Format_RGBA_8, DocPrinterProf, IntentImages,
+					Intent_Relative_Colorimetric, dcmsFlagsGC);
+	stdProofImgCMYK = ScColorMgmtEngine::createProofingTransform(DocInputImageCMYKProf, Format_CMYK_8,
+					DocOutputProf, Format_RGBA_8, DocPrinterProf, IntentImages, 
+					Intent_Relative_Colorimetric, dcmsFlagsGC);
+	stdTransImg = ScColorMgmtEngine::createTransform(DocInputRGBProf, Format_RGBA_8,
+	                     DocOutputProf, Format_RGBA_8,
+	                     IntentImages, dcmsFlags);
+	stdTransRGB = ScColorMgmtEngine::createTransform(DocInputCMYKProf, Format_CMYK_16,
+						DocInputRGBProf, Format_RGB_16,
+						IntentColors, dcmsFlags);
+	stdTransCMYK = ScColorMgmtEngine::createTransform(DocInputRGBProf, Format_RGB_16,
+						DocInputCMYKProf, Format_CMYK_16,
+						IntentColors, dcmsFlags);
+
+	ScColorProfile inputProfRGB;
+	ScColorProfile inputProfCMYK;
+	if (DocPrinterProf.colorSpace() == ColorSpace_Cmyk)
+	{
+		inputProf = (CMSSettings.SoftProofOn && CMSSettings.SoftProofFullOn) ? DocInputCMYKProf : DocPrinterProf;
+		inputProfRGB  = DocInputRGBProf;
+		inputProfCMYK = inputProf;
+	}
+	else
+	{
+		inputProf = (CMSSettings.SoftProofOn && CMSSettings.SoftProofFullOn) ? DocInputRGBProf : DocPrinterProf;
+		inputProfRGB  = inputProf;
+		inputProfCMYK = DocInputCMYKProf;
+	}
+	stdProof = ScColorMgmtEngine::createProofingTransform(inputProfRGB, Format_RGB_16,
+	                    DocOutputProf, Format_RGB_16,
+	                    DocPrinterProf,
+	                    IntentColors,
+	                    Intent_Relative_Colorimetric, dcmsFlags);
+	stdProofGC = ScColorMgmtEngine::createProofingTransform(inputProfRGB, Format_RGB_16,
+	                    DocOutputProf, Format_RGB_16,
+	                    DocPrinterProf,
+	                    IntentColors,
+	                    Intent_Relative_Colorimetric, dcmsFlags | Ctf_GamutCheck);
+	stdProofCMYK = ScColorMgmtEngine::createProofingTransform(inputProfCMYK, Format_CMYK_16,
+						DocOutputProf, Format_RGB_16,
+						DocPrinterProf,
+						IntentColors,
+						Intent_Relative_Colorimetric, dcmsFlags);
+	stdProofCMYKGC = ScColorMgmtEngine::createProofingTransform(inputProfCMYK, Format_CMYK_16,
+						DocOutputProf, Format_RGB_16,
+						DocPrinterProf,
+						IntentColors,
+						Intent_Relative_Colorimetric, dcmsFlags | Ctf_GamutCheck);
+
+	if (DocInputRGBProf.colorSpace() == ColorSpace_Rgb)
+			CMSSettings.ComponentsInput2 = 3;
+	if (DocInputRGBProf.colorSpace() == ColorSpace_Cmyk)
+			CMSSettings.ComponentsInput2 = 4;
+	if (DocInputRGBProf.colorSpace() == ColorSpace_Cmyk)
+			CMSSettings.ComponentsInput2 = 3;
+	if (DocInputCMYKProf.colorSpace() == ColorSpace_Rgb)
+			CMSSettings.ComponentsInput3 = 3;
+	if (DocInputCMYKProf.colorSpace() == ColorSpace_Cmyk)
+			CMSSettings.ComponentsInput3 = 4;
+	if (DocInputCMYKProf.colorSpace() == ColorSpace_Cmy)
+			CMSSettings.ComponentsInput3 = 3;
+	if (DocPrinterProf.colorSpace() == ColorSpace_Rgb)
+			CMSSettings.ComponentsPrinter = 3;
+	if (DocPrinterProf.colorSpace() == ColorSpace_Cmyk)
+			CMSSettings.ComponentsPrinter = 4;
+	if (DocPrinterProf.colorSpace() == ColorSpace_Cmy)
+			CMSSettings.ComponentsPrinter = 3;
+
+	bool success  = (stdTransRGBMon && stdTransCMYKMon && stdProofImg  && stdProofImgCMYK &&
+		             stdTransImg    && stdTransRGB     && stdTransCMYK && stdProof       &&
+	                 stdProofGC     && stdProofCMYK    && stdProofCMYKGC);
+	if (!success)
 	{
 		// Reset to the default handler otherwise may enter a loop
 		// if an error occur afterwards
-		cmsSetErrorHandler(NULL);
-		cmsErrorAction(LCMS_ERROR_IGNORE);
 		CloseCMSProfiles();
-		cmsErrorAction(LCMS_ERROR_ABORT);
 		CMSSettings.CMSinUse = false;
 		QString message = tr("An error occurred while opening ICC profiles, color management is not enabled." );
 		if (ScCore->usingGUI())
@@ -763,125 +815,7 @@
 			qWarning( "%s", message.toLocal8Bit().data() );
 		return false;
 	}
-	cmsSetErrorHandler(&cmsErrorHandler);
-	const QByteArray rgbInputProfilePath(InPo[CMSSettings.DefaultSolidColorRGBProfile].toLocal8Bit());
-	DocInputRGBProf = cmsOpenProfileFromFile(rgbInputProfilePath.data(), "r");
-	const QByteArray cmykInputProfilePath(InPoCMYK[CMSSettings.DefaultSolidColorCMYKProfile].toLocal8Bit());
-	DocInputCMYKProf = cmsOpenProfileFromFile(cmykInputProfilePath.data(), "r");
-	const QByteArray monitorProfilePath(MoPo[CMSSettings.DefaultMonitorProfile].toLocal8Bit());
-	DocOutputProf = cmsOpenProfileFromFile(monitorProfilePath.data(), "r");
-	const QByteArray printerProfilePath(PrPo[CMSSettings.DefaultPrinterProfile].toLocal8Bit());
-	DocPrinterProf = cmsOpenProfileFromFile(printerProfilePath, "r");
-	const QByteArray rgbInputImgProfilePath(InPo[CMSSettings.DefaultImageRGBProfile].toLocal8Bit());
-	DocInputImageRGBProf = cmsOpenProfileFromFile(rgbInputImgProfilePath.data(), "r");
-	const QByteArray cmykInputImgProfilePath(InPoCMYK[CMSSettings.DefaultImageCMYKProfile].toLocal8Bit());
-	DocInputImageCMYKProf = cmsOpenProfileFromFile(cmykInputImgProfilePath.data(), "r");
-	if ((DocInputRGBProf == NULL) || (DocInputCMYKProf == NULL) || (DocOutputProf == NULL) || (DocPrinterProf == NULL) || (DocInputImageCMYKProf == NULL) || (DocInputImageRGBProf == NULL))
-	{
-		CMSSettings.CMSinUse = false;
-		cmsSetErrorHandler(NULL);
-		return false;
-	}
-	int dcmsFlags = 0;
-	int dcmsFlagsGC = 0;
-	dcmsFlags |= cmsFLAGS_LOWRESPRECALC;
-	dcmsFlagsGC |= cmsFLAGS_LOWRESPRECALC;
-//	int dcmsFlags2 = cmsFLAGS_NOTPRECALC;
-	if (CMSSettings.GamutCheck)
-		dcmsFlagsGC |= cmsFLAGS_GAMUTCHECK;
-	if (CMSSettings.BlackPoint)
-	{
-		dcmsFlags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
-		dcmsFlagsGC |= cmsFLAGS_BLACKPOINTCOMPENSATION;
-	}
-	// set Gamut alarm color to #00ff00
-	cmsSetAlarmCodes(0, 255, 0);
-	stdTransRGBMon  = scCmsCreateTransform(DocInputRGBProf, TYPE_RGB_16,
-										DocOutputProf, TYPE_RGB_16,
-										IntentColors,
-										dcmsFlags);
-	stdTransCMYKMon = scCmsCreateTransform(DocInputCMYKProf, TYPE_CMYK_16,
-										DocOutputProf, TYPE_RGB_16,
-										IntentColors,
-										dcmsFlags);
-	// TODO : check input profiles used for images
-	stdProofImg = scCmsCreateProofingTransform(DocInputImageRGBProf, TYPE_RGBA_8,
-	              DocOutputProf, TYPE_RGBA_8,
-	              DocPrinterProf,
-	              IntentImages,
-	              INTENT_RELATIVE_COLORIMETRIC, dcmsFlagsGC | cmsFLAGS_SOFTPROOFING);
-	stdProofImgCMYK = scCmsCreateProofingTransform(DocInputImageCMYKProf, TYPE_CMYK_8,
-	              DocOutputProf, TYPE_RGBA_8,
-	              DocPrinterProf,
-	              IntentImages,
-	              INTENT_RELATIVE_COLORIMETRIC, dcmsFlagsGC | cmsFLAGS_SOFTPROOFING);
-	stdTransImg = scCmsCreateTransform(DocInputRGBProf, TYPE_RGBA_8,
-	                                 DocOutputProf, TYPE_RGBA_8,
-	                                 IntentImages,
-	                                 dcmsFlags);
-	stdTransRGB = scCmsCreateTransform(DocInputCMYKProf, TYPE_CMYK_16,
-						DocInputRGBProf, TYPE_RGB_16,
-						IntentColors,
-						dcmsFlags);
-	stdTransCMYK = scCmsCreateTransform(DocInputRGBProf, TYPE_RGB_16,
-						DocInputCMYKProf, TYPE_CMYK_16,
-						IntentColors,
-						dcmsFlags);
-	cmsHPROFILE inputProfRGB = NULL;
-	cmsHPROFILE inputProfCMYK = NULL;
-	if (static_cast<int>(cmsGetColorSpace(DocPrinterProf)) == icSigCmykData)
-	{
-		inputProf = (CMSSettings.SoftProofOn && CMSSettings.SoftProofFullOn) ? DocInputCMYKProf : DocPrinterProf;
-		inputProfRGB  = DocInputRGBProf;
-		inputProfCMYK = inputProf;
-	}
-	else
-	{
-		inputProf = (CMSSettings.SoftProofOn && CMSSettings.SoftProofFullOn) ? DocInputRGBProf : DocPrinterProf;
-		inputProfRGB  = inputProf;
-		inputProfCMYK = DocInputCMYKProf;
-	}
-	stdProof = scCmsCreateProofingTransform(inputProfRGB, TYPE_RGB_16,
-	                    DocOutputProf, TYPE_RGB_16,
-	                    DocPrinterProf,
-	                    IntentColors,
-	                    INTENT_RELATIVE_COLORIMETRIC, dcmsFlags | cmsFLAGS_SOFTPROOFING);
-	stdProofGC = scCmsCreateProofingTransform(inputProfRGB, TYPE_RGB_16,
-	                    DocOutputProf, TYPE_RGB_16,
-	                    DocPrinterProf,
-	                    IntentColors,
-	                    INTENT_RELATIVE_COLORIMETRIC, dcmsFlags | cmsFLAGS_SOFTPROOFING | cmsFLAGS_GAMUTCHECK);
-	stdProofCMYK = scCmsCreateProofingTransform(inputProfCMYK, TYPE_CMYK_16,
-						DocOutputProf, TYPE_RGB_16,
-						DocPrinterProf,
-						IntentColors,
-						INTENT_RELATIVE_COLORIMETRIC, dcmsFlags | cmsFLAGS_SOFTPROOFING);
-	stdProofCMYKGC = scCmsCreateProofingTransform(inputProfCMYK, TYPE_CMYK_16,
-						DocOutputProf, TYPE_RGB_16,
-						DocPrinterProf,
-						IntentColors,
-						INTENT_RELATIVE_COLORIMETRIC, dcmsFlags | cmsFLAGS_SOFTPROOFING | cmsFLAGS_GAMUTCHECK);
-
-	if (static_cast<int>(cmsGetColorSpace(DocInputRGBProf)) == icSigRgbData)
-			CMSSettings.ComponentsInput2 = 3;
-	if (static_cast<int>(cmsGetColorSpace(DocInputRGBProf)) == icSigCmykData)
-			CMSSettings.ComponentsInput2 = 4;
-	if (static_cast<int>(cmsGetColorSpace(DocInputRGBProf)) == icSigCmyData)
-			CMSSettings.ComponentsInput2 = 3;
-	if (static_cast<int>(cmsGetColorSpace(DocInputCMYKProf)) == icSigRgbData)
-			CMSSettings.ComponentsInput3 = 3;
-	if (static_cast<int>(cmsGetColorSpace(DocInputCMYKProf)) == icSigCmykData)
-			CMSSettings.ComponentsInput3 = 4;
-	if (static_cast<int>(cmsGetColorSpace(DocInputCMYKProf)) == icSigCmyData)
-			CMSSettings.ComponentsInput3 = 3;
-	if (static_cast<int>(cmsGetColorSpace(DocPrinterProf)) == icSigRgbData)
-			CMSSettings.ComponentsPrinter = 3;
-	if (static_cast<int>(cmsGetColorSpace(DocPrinterProf)) == icSigCmykData)
-			CMSSettings.ComponentsPrinter = 4;
-	if (static_cast<int>(cmsGetColorSpace(DocPrinterProf)) == icSigCmyData)
-			CMSSettings.ComponentsPrinter = 3;
-
-	cmsSetErrorHandler(NULL);
+
 	return true;
 }
 
@@ -11098,7 +11032,7 @@
 		PageItem *currItem = itemSelection->itemAt(i);
 		if (currItem && currItem->itemType() == PageItem::ImageFrame)
 		{
-			currItem->IRender = intentIndex;
+			currItem->IRender = (eRenderIntent) intentIndex;
 			LoadPict(currItem->Pfile, currItem->ItemNr, true);
 			currItem->update();
 		}

Modified: branches/Version135/Scribus/scribus/scribusdoc.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/scribusdoc.h
==============================================================================
--- branches/Version135/Scribus/scribus/scribusdoc.h (original)
+++ branches/Version135/Scribus/scribus/scribusdoc.h Sun Oct 31 10:44:16 2010
@@ -52,7 +52,8 @@
 #include "updatemanager.h"
 #include "sclayer.h"
 
-#include CMS_INC
+#include "colormgmt/sccolorprofile.h"
+#include "colormgmt/sccolortransform.h"
 
 #include <ft2build.h>
 #include FT_FREETYPE_H
@@ -1029,28 +1030,28 @@
 	bool marginColored;
 	int GroupCounter;
 	CMSData CMSSettings;
-	cmsHPROFILE DocInputImageRGBProf;
-	cmsHPROFILE DocInputImageCMYKProf;
-	cmsHPROFILE DocInputRGBProf;
-	cmsHPROFILE DocInputCMYKProf;
-	cmsHPROFILE DocOutputProf;
-	cmsHPROFILE DocPrinterProf;
-	cmsHTRANSFORM stdTransRGBMon;
-	cmsHTRANSFORM stdTransCMYKMon;
-	cmsHTRANSFORM stdProof;
-	cmsHTRANSFORM stdTransImg;
-	cmsHTRANSFORM stdProofImg;
-	cmsHTRANSFORM stdProofImgCMYK;
-	cmsHTRANSFORM stdTransCMYK;
-	cmsHTRANSFORM stdProofCMYK;
-	cmsHTRANSFORM stdTransRGB;
-	cmsHTRANSFORM stdProofGC;
-	cmsHTRANSFORM stdProofCMYKGC;
+	ScColorProfile DocInputImageRGBProf;
+	ScColorProfile DocInputImageCMYKProf;
+	ScColorProfile DocInputRGBProf;
+	ScColorProfile DocInputCMYKProf;
+	ScColorProfile DocOutputProf;
+	ScColorProfile DocPrinterProf;
+	ScColorTransform stdTransRGBMon;
+	ScColorTransform stdTransCMYKMon;
+	ScColorTransform stdProof;
+	ScColorTransform stdTransImg;
+	ScColorTransform stdProofImg;
+	ScColorTransform stdProofImgCMYK;
+	ScColorTransform stdTransCMYK;
+	ScColorTransform stdProofCMYK;
+	ScColorTransform stdTransRGB;
+	ScColorTransform stdProofGC;
+	ScColorTransform stdProofCMYKGC;
 	bool BlackPoint;
 	bool SoftProofing;
 	bool Gamut;
-	int  IntentColors;
-	int  IntentImages;
+	eRenderIntent IntentColors;
+	eRenderIntent IntentImages;
 	bool HasCMS;
 	QMap<QString,QString> JavaScripts;
 	int TotalItems;

Modified: branches/Version135/Scribus/scribus/scribusstructs.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/scribusstructs.h
==============================================================================
--- branches/Version135/Scribus/scribus/scribusstructs.h (original)
+++ branches/Version135/Scribus/scribus/scribusstructs.h Sun Oct 31 10:44:16 2010
@@ -25,6 +25,7 @@
 #include <vector>
 
 #include "scribusapi.h"
+#include "colormgmt/sccolormgmtstructs.h"
 #include "scimagestructs.h"
 #include "sctextstruct.h"
 #include "scfonts.h"
@@ -128,7 +129,7 @@
 	QString Pfile3;
 	QString IProfile;
 	QString EmProfile;
-	int IRender;
+	eRenderIntent IRender;
 	bool UseEmbedded;
 	QString itemText;
 	QPolygon Clip;
@@ -188,7 +189,7 @@
 	ScImageEffectList effects;
 	QString inputProfile;
 	bool   useEmbedded;
-	int    renderingIntent;
+	eRenderIntent renderingIntent;
 };
 
 /** \brief Pagemargins and bleeds*/
@@ -247,8 +248,8 @@
 	int ComponentsInput2;
 	int ComponentsInput3;
 	int ComponentsPrinter;
-	int DefaultIntentImages;
-	int DefaultIntentColors;
+	eRenderIntent DefaultIntentImages;
+	eRenderIntent DefaultIntentColors;
 	bool CMSinUse;
 	bool SoftProofOn;
 	bool SoftProofFullOn;

Modified: branches/Version135/Scribus/scribus/scribusview.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/scribusview.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/scribusview.cpp (original)
+++ branches/Version135/Scribus/scribus/scribusview.cpp Sun Oct 31 10:44:16 2010
@@ -51,7 +51,6 @@
 #include <QWheelEvent>
 #include <QWidgetAction>
 
-#include <cmath>
 #include <cstdio>
 #include <cstdlib>
 

Modified: branches/Version135/Scribus/scribus/util.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/util.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/util.cpp (original)
+++ branches/Version135/Scribus/scribus/util.cpp Sun Oct 31 10:44:16 2010
@@ -38,6 +38,9 @@
 #if !defined(_WIN32) && !defined(Q_OS_MAC) 
 #include <execinfo.h>
 #include <cxxabi.h>
+#endif
+#if defined(_WIN32)
+#include <windows.h>
 #endif
 
 using namespace std;

Modified: branches/Version135/Scribus/scribus/util_color.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/util_color.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/util_color.cpp (original)
+++ branches/Version135/Scribus/scribus/util_color.cpp Sun Oct 31 10:44:16 2010
@@ -37,8 +37,6 @@
 #include "util_formats.h"
 #include "util_icon.h"
 
-#include CMS_INC
-
 using namespace std;
 
 void handleOldColorShade(ScribusDoc* doc, QString& colName, int& shade)
@@ -115,8 +113,8 @@
 		int outheight=out.height();
 		for (int i=0; i < outheight; ++i)
 		{
-			LPBYTE ptr = out.scanLine(i);
-			cmsDoTransform(doc->stdProofImg, ptr, ptr, out.width());
+			uchar* ptr = out.scanLine(i);
+			doc->stdProofImg.apply(ptr, ptr, out.width());
 		}
 	}
 	else
@@ -126,8 +124,8 @@
 			int outheight=out.height();
 			for (int i=0; i < outheight; ++i)
 			{
-				LPBYTE ptr = out.scanLine(i);
-				cmsDoTransform(doc->stdTransImg, ptr, ptr, out.width());
+				uchar* ptr = out.scanLine(i);
+				doc->stdTransImg.apply(ptr, ptr, out.width());
 			}
 		}
 	}

Modified: branches/Version135/Scribus/scribus/util_ghostscript.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/util_ghostscript.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/util_ghostscript.cpp (original)
+++ branches/Version135/Scribus/scribus/util_ghostscript.cpp Sun Oct 31 10:44:16 2010
@@ -36,6 +36,10 @@
 
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
+
+#if defined(_WIN32)
+#include <windows.h>
 #endif
 
 #include "prefsfile.h"

Modified: branches/Version135/Scribus/scribus/vruler.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/scribus/vruler.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/vruler.cpp (original)
+++ branches/Version135/Scribus/scribus/vruler.cpp Sun Oct 31 10:44:16 2010
@@ -30,6 +30,8 @@
 #include <QPolygon>
 #include <QRect>
 #include <QRubberBand>
+
+#include <cmath>
 
 #include "canvasgesture_rulermove.h"
 #include "page.h"

Modified: branches/Version135/Scribus/win32/vc8/Scribus-1.3.x.vcproj
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15706&path=/branches/Version135/Scribus/win32/vc8/Scribus-1.3.x.vcproj
==============================================================================
--- branches/Version135/Scribus/win32/vc8/Scribus-1.3.x.vcproj (original)
+++ branches/Version135/Scribus/win32/vc8/Scribus-1.3.x.vcproj Sun Oct 31 10:44:16 2010
@@ -11416,6 +11416,98 @@
 				>
 			</File>
 		</Filter>
+		<Filter
+			Name="colormgmt"
+			>
+			<File
+				RelativePath="..\..\scribus\colormgmt\sccolormgmtengine.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\scribus\colormgmt\sccolormgmtengine.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\scribus\colormgmt\sccolormgmtenginedata.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\scribus\colormgmt\sccolormgmtstructs.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\scribus\colormgmt\sccolormgmtstructs.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\scribus\colormgmt\sccolorprofile.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\scribus\colormgmt\sccolorprofile.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\scribus\colormgmt\sccolorprofilecache.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\scribus\colormgmt\sccolorprofilecache.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\scribus\colormgmt\sccolorprofiledata.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\scribus\colormgmt\sccolorprofiledata.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\scribus\colormgmt\sccolortransform.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\scribus\colormgmt\sccolortransform.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\scribus\colormgmt\sccolortransformdata.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\scribus\colormgmt\sccolortransformpool.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\scribus\colormgmt\sccolortransformpool.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\scribus\colormgmt\sclcmscolormgmtengineimpl.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\scribus\colormgmt\sclcmscolormgmtengineimpl.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\scribus\colormgmt\sclcmscolorprofileimpl.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\scribus\colormgmt\sclcmscolorprofileimpl.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\scribus\colormgmt\sclcmscolortransformimpl.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\scribus\colormgmt\sclcmscolortransformimpl.h"
+				>
+			</File>
+		</Filter>
 	</Files>
 	<Globals>
 	</Globals>




More information about the scribus-commit mailing list