r14772 by jghali - get rid of icc34.h include in non lcms specific classes and use generic enums instead

scribus-commit scribus-commit at lists.scribus.net
Fri Feb 19 21:01:11 CET 2010


Revision: 14772
Author: jghali
Date: 2010-02-19T19:53:01.517476Z
Commit message: get rid of icc34.h include in non lcms specific classes and use generic enums instead

Changeset: 
M  /trunk/Scribus/scribus/colormgmt/sccolorprofile.cpp
M  /trunk/Scribus/scribus/colormgmt/sclcmscolormgmtengineimpl.h
M  /trunk/Scribus/scribus/scimgdataloader_jpeg.cpp
M  /trunk/Scribus/scribus/scimgdataloader_psd.cpp
M  /trunk/Scribus/scribus/colormgmt/sclcmscolorprofileimpl.cpp
M  /trunk/Scribus/scribus/colormgmt/sccolormgmtstructs.h
M  /trunk/Scribus/scribus/scimgdataloader_tiff.cpp
M  /trunk/Scribus/scribus/ui/pdfopts.cpp
M  /trunk/Scribus/scribus/colormgmt/sccolorprofile.h
M  /trunk/Scribus/scribus/colormgmt/sclcmscolorprofileimpl.h
M  /trunk/Scribus/scribus/scribusdoc.cpp
M  /trunk/Scribus/scribus/scdocoutput_ps2.cpp
M  /trunk/Scribus/scribus/colormgmt/sccolortransformdata.h
M  /trunk/Scribus/scribus/documentchecker.cpp
M  /trunk/Scribus/scribus/plugins/scriptplugin/objpdffile.cpp
M  /trunk/Scribus/scribus/scimage.cpp
M  /trunk/Scribus/scribus/scpainterex_ps2.cpp
M  /trunk/Scribus/scribus/scribuscore.cpp
M  /trunk/Scribus/scribus/colormgmt/sclcmscolormgmtengineimpl.cpp
M  /trunk/Scribus/scribus/scimgdataloader_ps.cpp
M  /trunk/Scribus/scribus/colormgmt/sccolorprofiledata.h

Diffs:
Index: scribus/documentchecker.cpp
===================================================================
--- scribus/documentchecker.cpp	(revision 14771)
+++ scribus/documentchecker.cpp	(revision 14772)
@@ -164,11 +164,11 @@
 					{
 						if (checkerSettings.checkNotCMYKOrSpot || checkerSettings.checkDeviceColorsAndOutputIntend)
 						{
-							int currPrintProfCS = -1;
+							eColorSpaceType currPrintProfCS = ColorSpace_Unknown;
 							if (currDoc->HasCMS)
 							{
 								ScColorProfile printerProf = currDoc->DocPrinterProf;
-								currPrintProfCS = static_cast<int>(printerProf.colorSpace());
+								currPrintProfCS = printerProf.colorSpace();
 							}
 							if (checkerSettings.checkNotCMYKOrSpot)
 							{
@@ -186,12 +186,12 @@
 							{
 								for (int i=0; i<usedColorSpaces.size(); ++i)
 								{
-									if (currPrintProfCS == icSigCmykData && (usedColorSpaces[i] == CS_DeviceRGB || usedColorSpaces[i] == CS_DeviceGray))
+									if (currPrintProfCS == ColorSpace_Cmyk && (usedColorSpaces[i] == CS_DeviceRGB || usedColorSpaces[i] == CS_DeviceGray))
 									{
 										itemError.insert(DeviceColorAndOutputIntend, 0);
 										break;
 									}
-									else if (currPrintProfCS == icSigRgbData && (usedColorSpaces[i] == CS_DeviceCMYK || usedColorSpaces[i] == CS_DeviceGray))
+									else if (currPrintProfCS == ColorSpace_Rgb && (usedColorSpaces[i] == CS_DeviceCMYK || usedColorSpaces[i] == CS_DeviceGray))
 									{
 										itemError.insert(DeviceColorAndOutputIntend, 0);
 										break;
@@ -413,12 +413,12 @@
 							{
 								for (int i=0; i<usedColorSpaces.size(); ++i)
 								{
-									if (currPrintProfCS == icSigCmykData && (usedColorSpaces[i] == CS_DeviceRGB || usedColorSpaces[i] == CS_DeviceGray))
+									if (currPrintProfCS == ColorSpace_Cmyk && (usedColorSpaces[i] == CS_DeviceRGB || usedColorSpaces[i] == CS_DeviceGray))
 									{
 										itemError.insert(DeviceColorAndOutputIntend, 0);
 										break;
 									}
-									else if (currPrintProfCS == icSigRgbData && (usedColorSpaces[i] == CS_DeviceCMYK || usedColorSpaces[i] == CS_DeviceGray))
+									else if (currPrintProfCS == ColorSpace_Rgb && (usedColorSpaces[i] == CS_DeviceCMYK || usedColorSpaces[i] == CS_DeviceGray))
 									{
 										itemError.insert(DeviceColorAndOutputIntend, 0);
 										break;
Index: scribus/scpainterex_ps2.cpp
===================================================================
--- scribus/scpainterex_ps2.cpp	(revision 14771)
+++ scribus/scpainterex_ps2.cpp	(revision 14772)
@@ -485,14 +485,14 @@
 			cmsTranform = m_options.cmykToOutputColorTransform;
 		}
 		cmsTranform.apply(colorIn, colorOut, 1 );
-		if (static_cast<int>(m_options.hProfile.colorSpace()) == icSigRgbData)
+		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>(m_options.hProfile.colorSpace()) == icSigCmykData)
+		else if (m_options.hProfile.colorSpace() == ColorSpace_Cmyk)
 		{
 			c = colorOut[0] / 257;
 			m = colorOut[1] / 257;
Index: scribus/scimgdataloader_ps.cpp
===================================================================
--- scribus/scimgdataloader_ps.cpp	(revision 14771)
+++ scribus/scimgdataloader_ps.cpp	(revision 14772)
@@ -86,9 +86,9 @@
 						ScColorProfile prof = engine.openProfileFromMem(psdata);
 						if (prof)
 						{
-							if (static_cast<int>(prof.colorSpace()) == icSigRgbData)
+							if (prof.colorSpace() == ColorSpace_Rgb)
 								m_profileComponents = 3;
-							if (static_cast<int>(prof.colorSpace()) == icSigCmykData)
+							if (prof.colorSpace() == ColorSpace_Cmyk)
 								m_profileComponents = 4;
 							m_imageInfoRecord.profileName = prof.productDescription();
 							m_imageInfoRecord.isEmbedded = true;
@@ -431,9 +431,9 @@
 								ScColorProfile prof = engine.openProfileFromMem(psdata);
 								if (prof)
 								{
-									if (static_cast<int>(prof.colorSpace()) == icSigRgbData)
+									if (prof.colorSpace() == ColorSpace_Rgb)
 										m_profileComponents = 3;
-									if (static_cast<int>(prof.colorSpace()) == icSigCmykData)
+									if (prof.colorSpace() == ColorSpace_Cmyk)
 										m_profileComponents = 4;
 									m_imageInfoRecord.profileName = prof.productDescription();
 									m_imageInfoRecord.isEmbedded = true;
Index: scribus/scribuscore.cpp
===================================================================
--- scribus/scribuscore.cpp	(revision 14771)
+++ scribus/scribuscore.cpp	(revision 14772)
@@ -401,43 +401,43 @@
 		}
 		switch (static_cast<int>(profInfo.deviceClass))
 		{
-		case icSigInputClass:
-			if (static_cast<int>(profInfo.colorSpace) == icSigRgbData)
+		case Class_Input:
+			if (profInfo.colorSpace == ColorSpace_Rgb)
 			{
 				if (!InputProfiles.contains(profileName))
 					InputProfiles.insert(profileName, profInfo.file);
 			}
 			break;
-		case icSigColorSpaceClass:
-			if (static_cast<int>(profInfo.colorSpace) == icSigRgbData)
+		case Class_ColorSpace:
+			if (profInfo.colorSpace == ColorSpace_Rgb)
 			{
 				if (!InputProfiles.contains(profileName))
 					InputProfiles.insert(profileName, profInfo.file);
 			}
-			if (static_cast<int>(profInfo.colorSpace) == icSigCmykData)
+			if (profInfo.colorSpace == ColorSpace_Cmyk)
 			{
 				if (!InputProfilesCMYK.contains(profileName))
 					InputProfilesCMYK.insert(profileName, profInfo.file);
 			}
 			break;
-		case icSigDisplayClass:
-			if (static_cast<int>(profInfo.colorSpace) == icSigRgbData)
+		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 (static_cast<int>(profInfo.colorSpace) == icSigCmykData)
+			if (profInfo.colorSpace == ColorSpace_Cmyk)
 			{
 				if (!InputProfilesCMYK.contains(profileName))
 					InputProfilesCMYK.insert(profileName, profInfo.file);
 			}
 			break;
-		case icSigOutputClass:
+		case Class_Output:
 			// Disable rgb printer profile detection until effective support
 			// PrinterProfiles.insert(nam, pfad + d[dc], false);
-			if (static_cast<int>(profInfo.colorSpace) == icSigCmykData)
+			if (profInfo.colorSpace == ColorSpace_Cmyk)
 			{
 				if (!PDFXProfiles.contains(profileName))
 					PDFXProfiles.insert(profileName, profInfo.file);
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp	(revision 14771)
+++ scribus/scribusdoc.cpp	(revision 14772)
@@ -801,7 +801,7 @@
 
 	ScColorProfile inputProfRGB;
 	ScColorProfile inputProfCMYK;
-	if (static_cast<int>(DocPrinterProf.colorSpace()) == icSigCmykData)
+	if (DocPrinterProf.colorSpace() == ColorSpace_Cmyk)
 	{
 		inputProf = (CMSSettings.SoftProofOn && CMSSettings.SoftProofFullOn) ? DocInputCMYKProf : DocPrinterProf;
 		inputProfRGB  = DocInputRGBProf;
@@ -832,23 +832,23 @@
 						IntentColors,
 						Intent_Relative_Colorimetric, dcmsFlags | Ctf_GamutCheck);
 
-	if (static_cast<int>(DocInputRGBProf.colorSpace()) == icSigRgbData)
+	if (DocInputRGBProf.colorSpace() == ColorSpace_Rgb)
 			CMSSettings.ComponentsInput2 = 3;
-	if (static_cast<int>(DocInputRGBProf.colorSpace()) == icSigCmykData)
+	if (DocInputRGBProf.colorSpace() == ColorSpace_Cmyk)
 			CMSSettings.ComponentsInput2 = 4;
-	if (static_cast<int>(DocInputRGBProf.colorSpace()) == icSigCmyData)
+	if (DocInputRGBProf.colorSpace() == ColorSpace_Cmy)
 			CMSSettings.ComponentsInput2 = 3;
-	if (static_cast<int>(DocInputCMYKProf.colorSpace()) == icSigRgbData)
+	if (DocInputCMYKProf.colorSpace() == ColorSpace_Rgb)
 			CMSSettings.ComponentsInput3 = 3;
-	if (static_cast<int>(DocInputCMYKProf.colorSpace()) == icSigCmykData)
+	if (DocInputCMYKProf.colorSpace() == ColorSpace_Cmyk)
 			CMSSettings.ComponentsInput3 = 4;
-	if (static_cast<int>(DocInputCMYKProf.colorSpace()) == icSigCmyData)
+	if (DocInputCMYKProf.colorSpace() == ColorSpace_Cmy)
 			CMSSettings.ComponentsInput3 = 3;
-	if (static_cast<int>(DocPrinterProf.colorSpace()) == icSigRgbData)
+	if (DocPrinterProf.colorSpace() == ColorSpace_Rgb)
 			CMSSettings.ComponentsPrinter = 3;
-	if (static_cast<int>(DocPrinterProf.colorSpace()) == icSigCmykData)
+	if (DocPrinterProf.colorSpace() == ColorSpace_Cmyk)
 			CMSSettings.ComponentsPrinter = 4;
-	if (static_cast<int>(DocPrinterProf.colorSpace()) == icSigCmyData)
+	if (DocPrinterProf.colorSpace() == ColorSpace_Cmy)
 			CMSSettings.ComponentsPrinter = 3;
 
 	bool success  = (stdTransRGBMon && stdTransCMYKMon && stdProofImg  && stdProofImgCMYK &&
Index: scribus/scimgdataloader_tiff.cpp
===================================================================
--- scribus/scimgdataloader_tiff.cpp	(revision 14771)
+++ scribus/scimgdataloader_tiff.cpp	(revision 14772)
@@ -55,11 +55,11 @@
 			ScColorProfile tiffProf = engine.openProfileFromMem(profArray);
 			if (tiffProf)
 			{
-				if (static_cast<int>(tiffProf.colorSpace()) == icSigRgbData)
+				if (tiffProf.colorSpace() == ColorSpace_Rgb)
 					m_profileComponents = 3;
-				if (static_cast<int>(tiffProf.colorSpace()) == icSigCmykData)
+				if (tiffProf.colorSpace() == ColorSpace_Cmyk)
 					m_profileComponents = 4;
-				if (static_cast<int>(tiffProf.colorSpace()) == icSigGrayData)
+				if (tiffProf.colorSpace() == ColorSpace_Gray)
 					m_profileComponents = 1;
 				m_embeddedProfile = profArray;
 			}
Index: scribus/scdocoutput_ps2.cpp
===================================================================
--- scribus/scdocoutput_ps2.cpp	(revision 14771)
+++ scribus/scdocoutput_ps2.cpp	(revision 14772)
@@ -82,12 +82,12 @@
 		eColorFormat outputDataTypeImages = Format_Undefined;
 		ScColorMgmtEngine engine(m_doc->colorEngine);
 		m_options.hProfile = engine.openProfileFromFile(m_options.outputProfile);
-		if (static_cast<int>(m_options.hProfile.colorSpace()) == icSigRgbData)
+		if (m_options.hProfile.colorSpace() == ColorSpace_Rgb)
 		{
 			outputDataTypeColors = Format_RGB_16;
 			outputDataTypeImages = Format_ARGB_8;
 		}
-		else if (static_cast<int>(m_options.hProfile.colorSpace()) == icSigCmykData)
+		else if (m_options.hProfile.colorSpace() == ColorSpace_Cmyk)
 		{
 			outputDataTypeColors = Format_CMYK_16;
 			outputDataTypeImages = Format_CMYK_8;
Index: scribus/scimgdataloader_psd.cpp
===================================================================
--- scribus/scimgdataloader_psd.cpp	(revision 14771)
+++ scribus/scimgdataloader_psd.cpp	(revision 14772)
@@ -76,11 +76,11 @@
 				prof = engine.openProfileFromMem(m_embeddedProfile.data());
 				if (prof)
 				{
-					if (static_cast<int>(prof.colorSpace()) == icSigRgbData)
+					if (prof.colorSpace() == ColorSpace_Rgb)
 						m_profileComponents = 3;
-					if (static_cast<int>(prof.colorSpace()) == icSigCmykData)
+					if (prof.colorSpace() == ColorSpace_Cmyk)
 						m_profileComponents = 4;
-					if (static_cast<int>(prof.colorSpace()) == icSigGrayData)
+					if (prof.colorSpace() == ColorSpace_Gray)
 						m_profileComponents = 1;
 				}
 			}
Index: scribus/scimage.cpp
===================================================================
--- scribus/scimage.cpp	(revision 14771)
+++ scribus/scimage.cpp	(revision 14772)
@@ -1950,11 +1950,11 @@
 			prof = ScCore->defaultEngine.openProfileFromMem(embeddedProfile);
 			if (prof)
 			{
-				if (static_cast<int>(prof.colorSpace()) == icSigRgbData)
+				if (prof.colorSpace() == ColorSpace_Rgb)
 					*components = 3;
-				if (static_cast<int>(prof.colorSpace()) == icSigCmykData)
+				if (prof.colorSpace() == ColorSpace_Cmyk)
 					*components = 4;
-				if (static_cast<int>(prof.colorSpace()) == icSigGrayData)
+				if (prof.colorSpace() == ColorSpace_Gray)
 					*components = 1;
 				*profile = embeddedProfile;
 			}
@@ -2057,8 +2057,8 @@
 		ScColorProfile prof = cmSettings.outputProfile();
 		if (prof.isNull())
 			return false;
-		icColorSpaceSignature cspace = prof.colorSpace();
-		if (cspace != icSigRgbData && cspace != icSigCmykData)
+		eColorSpaceType cspace = prof.colorSpace();
+		if (cspace != ColorSpace_Rgb && cspace != ColorSpace_Cmyk)
 			return false;
 	}
 
@@ -2207,24 +2207,24 @@
 		bool  isPsdTiff = (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext));
 		eColorFormat inputProfFormat  = Format_BGRA_8;
 		eColorFormat outputProfFormat = Format_YMCK_8;
-		int inputProfColorSpace = static_cast<int>(inputProf.colorSpace());
-		if ( inputProfColorSpace == icSigRgbData )
+		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 == icSigCmykData ) && (isPsdTiff || pDataLoader->useRawImage()))
+		else if (( inputProfColorSpace == ColorSpace_Cmyk ) && (isPsdTiff || pDataLoader->useRawImage()))
 		{
 			if (pDataLoader->r_image.channels() == 5)
 				inputProfFormat = Format_CMYKA_8;
 			else
 				inputProfFormat = Format_CMYK_8;
 		}
-		else if ( inputProfColorSpace == icSigCmykData )
+		else if ( inputProfColorSpace == ColorSpace_Cmyk )
 			inputProfFormat = Format_YMCK_8;
-		else if ( inputProfColorSpace == icSigGrayData )
+		else if ( inputProfColorSpace == ColorSpace_Gray )
 			inputProfFormat = Format_GRAY_8;
-		int outputProfColorSpace = static_cast<int>(printerProf.colorSpace());
-		if ( outputProfColorSpace == icSigRgbData )
+		eColorSpaceType outputProfColorSpace = printerProf.colorSpace();
+		if ( outputProfColorSpace == ColorSpace_Rgb )
 			outputProfFormat = Format_BGRA_8;
-		else if ( outputProfColorSpace == icSigCmykData )
+		else if ( outputProfColorSpace == ColorSpace_Cmyk )
 			outputProfFormat = Format_YMCK_8;
 		if (cmSettings.useColorManagement() && cmSettings.doSoftProofing())
 		{
@@ -2241,7 +2241,7 @@
 		case CMYKData: // CMYK
 //			if ((!isCMYK && (outputProfColorSpace == icSigCmykData)) || (isCMYK && (outputProfColorSpace == icSigRgbData)) )
 				xform = engine.createTransform(inputProf, inputProfFormat, printerProf, outputProfFormat, cmSettings.imageRenderingIntent(), cmsFlags);
-			if (outputProfColorSpace != icSigCmykData )
+			if (outputProfColorSpace != ColorSpace_Cmyk )
 				*realCMYK = isCMYK = false;
 			break;
 		case Thumbnail:
@@ -2277,7 +2277,7 @@
 					// imgInfo = pDataLoader->imageInfoRecord();
 				}
 			}
-			outputProfColorSpace = icSigRgbData;
+			outputProfColorSpace = ColorSpace_Rgb;
 			break;
 		case RawData: // no Conversion just raw Data
 			xform = 0;
@@ -2295,13 +2295,13 @@
 			break;
 		case OutputProfile: // CMYK
 			ScColorProfile outputProfile = cmSettings.outputProfile();
-			outputProfColorSpace = static_cast<int>(outputProfile.colorSpace());
-			if ( outputProfColorSpace == icSigRgbData )
+			outputProfColorSpace = outputProfile.colorSpace();
+			if ( outputProfColorSpace == ColorSpace_Rgb )
 				outputProfFormat = Format_BGRA_8;
-			else if ( outputProfColorSpace == icSigCmykData )
+			else if ( outputProfColorSpace == ColorSpace_Cmyk )
 				outputProfFormat = Format_YMCK_8;
 			xform = engine.createTransform(inputProf, inputProfFormat, outputProfile, outputProfFormat, cmSettings.imageRenderingIntent(), cmsFlags);
-			isCMYK = (outputProfColorSpace == icSigCmykData);
+			isCMYK = (outputProfColorSpace == ColorSpace_Cmyk);
 			if (realCMYK)
 				*realCMYK = isCMYK;
 			break;
@@ -2325,7 +2325,7 @@
 				uchar* ptr = scanLine(i);
 				if (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext) || pDataLoader->useRawImage())
 					ptr2 = pDataLoader->r_image.scanLine(i);
-				if ( inputProfFormat == Format_GRAY_8 && (outputProfColorSpace != icSigCmykData) )
+				if ( inputProfFormat == Format_GRAY_8 && (outputProfColorSpace != ColorSpace_Cmyk) )
 				{
 					unsigned char* ucs = ptr2 ? (ptr2 + 1) : (ptr + 1);
 					unsigned char* uc = new unsigned char[width()];
@@ -2337,7 +2337,7 @@
 					xform.apply(uc, ptr, width());
 					delete[] uc;
 				}
-				else if ( inputProfFormat == Format_GRAY_8 && (outputProfColorSpace == icSigCmykData) )
+				else if ( inputProfFormat == Format_GRAY_8 && (outputProfColorSpace == ColorSpace_Cmyk) )
 				{
 					unsigned char  value;
 					unsigned char* ucs = ptr2 ? ptr2 : ptr;
@@ -2365,7 +2365,7 @@
 				{
 					QRgb alphaFF = qRgba(0,0,0,255);
 					QRgb *p;
-					if (isCMYK && outputProfColorSpace != icSigCmykData && !bilevel)
+					if (isCMYK && outputProfColorSpace != ColorSpace_Cmyk && !bilevel)
 					{
 						p = (QRgb *) ptr;
 						for (int j = 0; j < width(); j++, p++)
@@ -2375,7 +2375,7 @@
 				else
 				{
 					// This might fix Bug #6328, please test.
-					if (outputProfColorSpace != icSigCmykData && bilevel)
+					if (outputProfColorSpace != ColorSpace_Cmyk && bilevel)
 					{
 						QRgb alphaFF;
 						QRgb *p;
@@ -2387,7 +2387,7 @@
 							ptr2 += 4;
 						}
 					}
-					if (outputProfColorSpace != icSigCmykData && !bilevel)
+					if (outputProfColorSpace != ColorSpace_Cmyk && !bilevel)
 					{
 						if (pDataLoader->r_image.channels() == 5)
 						{
Index: scribus/scimgdataloader_jpeg.cpp
===================================================================
--- scribus/scimgdataloader_jpeg.cpp	(revision 14771)
+++ scribus/scimgdataloader_jpeg.cpp	(revision 14772)
@@ -80,11 +80,11 @@
 		ScColorProfile prof = ScCore->defaultEngine.openProfileFromMem(profArray);
 		if (prof)
 		{
-			if (static_cast<int>(prof.colorSpace()) == icSigRgbData)
+			if (prof.colorSpace() == ColorSpace_Rgb)
 				m_profileComponents = 3;
-			if (static_cast<int>(prof.colorSpace()) == icSigCmykData)
+			if (prof.colorSpace() == ColorSpace_Cmyk)
 				m_profileComponents = 4;
-			if (static_cast<int>(prof.colorSpace()) == icSigGrayData)
+			if (prof.colorSpace() == ColorSpace_Gray)
 				m_profileComponents = 1;
 			m_embeddedProfile = profArray;
 		}
Index: scribus/ui/pdfopts.cpp
===================================================================
--- scribus/ui/pdfopts.cpp	(revision 14771)
+++ scribus/ui/pdfopts.cpp	(revision 14772)
@@ -351,11 +351,11 @@
 				{
 					ScColorProfile hIn = doc->colorEngine.openProfileFromFile(  appPrinterProfiles[Opts.PrintProf] );
 					cmsDescriptorName = hIn.productDescription();
-					if (static_cast<int>(hIn.colorSpace()) == icSigRgbData)
+					if (hIn.colorSpace() == ColorSpace_Rgb)
 						components = 3;
-					if (static_cast<int>(hIn.colorSpace()) == icSigCmykData)
+					if (hIn.colorSpace() == ColorSpace_Cmyk)
 						components = 4;
-					if (static_cast<int>(hIn.colorSpace()) == icSigCmyData)
+					if (hIn.colorSpace() == ColorSpace_Cmy)
 						components = 3;
 					Opts.Info = Options->InfoString->text();
 					Opts.Encrypt = false;
Index: scribus/colormgmt/sccolortransformdata.h
===================================================================
--- scribus/colormgmt/sccolortransformdata.h	(revision 14771)
+++ scribus/colormgmt/sccolortransformdata.h	(revision 14772)
@@ -11,7 +11,6 @@
 #include <QByteArray>
 #include <QString>
 
-#include "icc34.h" //part of lcms1
 #include "sccolormgmtelem.h"
 #include "sccolormgmtstructs.h"
 
Index: scribus/colormgmt/sclcmscolormgmtengineimpl.cpp
===================================================================
--- scribus/colormgmt/sclcmscolormgmtengineimpl.cpp	(revision 14771)
+++ scribus/colormgmt/sclcmscolormgmtengineimpl.cpp	(revision 14772)
@@ -92,8 +92,8 @@
 					profileInfos.append(profileInfo);
 					continue;
 				}
-				profileInfo.colorSpace  = cmsGetColorSpace(hIn);
-				profileInfo.deviceClass = cmsGetDeviceClass(hIn);
+				profileInfo.colorSpace  = translateLcmsColorSpaceType( cmsGetColorSpace(hIn) );
+				profileInfo.deviceClass = translateLcmsProfileClass( cmsGetDeviceClass(hIn) );
 				profileInfos.append(profileInfo);
 				cmsCloseProfile(hIn);
 				hIn = NULL;
@@ -550,6 +550,54 @@
 	return lIntent;
 }
 
+eColorSpaceType ScLcmsColorMgmtEngineImpl::translateLcmsColorSpaceType(icColorSpaceSignature signature)
+{
+	eColorSpaceType colorSpaceType = ColorSpace_Unknown;
+    if (signature == icSigXYZData)
+		colorSpaceType = ColorSpace_XYZ;
+    if (signature == icSigLabData)
+		colorSpaceType = ColorSpace_Lab;
+    if (signature == icSigLuvData)
+		colorSpaceType = ColorSpace_Luv;
+    if (signature == icSigYCbCrData)
+		colorSpaceType = ColorSpace_YCbCr;
+    if (signature == icSigYxyData)
+		colorSpaceType = ColorSpace_Yxy;
+    if (signature == icSigRgbData)
+		colorSpaceType = ColorSpace_Rgb;
+    if (signature == icSigGrayData)
+		colorSpaceType = ColorSpace_Gray;
+    if (signature == icSigHsvData)
+		colorSpaceType = ColorSpace_Hsv;
+    if (signature == icSigHlsData)
+		colorSpaceType = ColorSpace_Hls;
+    if (signature == icSigCmykData)
+		colorSpaceType = ColorSpace_Cmyk;
+    if (signature == icSigCmyData)
+		colorSpaceType = ColorSpace_Cmy;
+	return colorSpaceType;
+}
+
+eProfileClass ScLcmsColorMgmtEngineImpl::translateLcmsProfileClass(icProfileClassSignature signature)
+{
+	eProfileClass profileClass = Class_Unknown;
+	if (signature == icSigInputClass)
+		profileClass = Class_Input;
+    if (signature == icSigDisplayClass)
+		profileClass = Class_Display;
+    if (signature == icSigOutputClass)
+		profileClass = Class_Output;
+    if (signature == icSigLinkClass)
+		profileClass = Class_Link;
+    if (signature == icSigAbstractClass)
+		profileClass = Class_Abstract;
+    if (signature == icSigColorSpaceClass)
+		profileClass = Class_ColorSpace;
+    if (signature == icSigNamedColorClass)
+		profileClass = Class_NamedColor;
+	return profileClass;
+}
+
 int ScLcmsColorMgmtEngineImpl::cmsErrorHandler(int /*ErrorCode*/, const char *ErrorText)
 {
 	std::string msg = std::string("Littlecms : ") + ErrorText;
Index: scribus/colormgmt/sccolorprofiledata.h
===================================================================
--- scribus/colormgmt/sccolorprofiledata.h	(revision 14771)
+++ scribus/colormgmt/sccolorprofiledata.h	(revision 14772)
@@ -11,8 +11,8 @@
 #include <QByteArray>
 #include <QString>
 
-#include "icc34.h" //part of lcms1
 #include "sccolormgmtelem.h"
+#include "sccolormgmtstructs.h"
 
 class ScColorProfileData : public ScColorMgmtElem
 {
@@ -29,8 +29,8 @@
 	QString path() const { return m_profilePath; }
 
 	virtual bool isNull() const = 0;
-	virtual icColorSpaceSignature   colorSpace()  const = 0;
-	virtual icProfileClassSignature deviceClass() const = 0;
+	virtual eColorSpaceType colorSpace()  const = 0;
+	virtual eProfileClass   deviceClass() const = 0;
 	virtual QString productDescription() const = 0;
 };
 
Index: scribus/colormgmt/sccolorprofile.cpp
===================================================================
--- scribus/colormgmt/sccolorprofile.cpp	(revision 14771)
+++ scribus/colormgmt/sccolorprofile.cpp	(revision 14772)
@@ -19,18 +19,18 @@
 {
 }
 
-icColorSpaceSignature ScColorProfile::colorSpace() const
+eColorSpaceType ScColorProfile::colorSpace() const
 {
 	if (m_data)
 		return m_data->colorSpace();
-	return ((icColorSpaceSignature) 0);
+	return ColorSpace_Unknown;
 }
 
-icProfileClassSignature ScColorProfile::deviceClass() const
+eProfileClass ScColorProfile::deviceClass() const
 {
 	if (m_data)
 		return m_data->deviceClass();
-	return ((icProfileClassSignature) 0);
+	return Class_Unknown;
 }
 
 QString ScColorProfile::profilePath() const
Index: scribus/colormgmt/sclcmscolormgmtengineimpl.h
===================================================================
--- scribus/colormgmt/sclcmscolormgmtengineimpl.h	(revision 14771)
+++ scribus/colormgmt/sclcmscolormgmtengineimpl.h	(revision 14772)
@@ -16,6 +16,7 @@
 
 class ScLcmsColorMgmtEngineImpl : public ScColorMgmtEngineData
 {
+	friend class ScLcmsColorProfileImpl;
 	friend class ScLcmsColorTransformImpl;
 
 public:
@@ -57,6 +58,8 @@
 	static DWORD translateFlagsToLcmsFlags(long flags);
 	static DWORD translateFormatToLcmsFormat(eColorFormat format);
 	static int translateIntentToLcmsIntent(eRenderIntent intent, eRenderIntent defaut = Intent_Relative_Colorimetric);
+	static eColorSpaceType translateLcmsColorSpaceType(icColorSpaceSignature);
+	static eProfileClass   translateLcmsProfileClass(icProfileClassSignature);
 
 	// Exception class thrown by cmsErrorHandler
 	class lcmsException : public std::runtime_error 
Index: scribus/colormgmt/sccolormgmtstructs.h
===================================================================
--- scribus/colormgmt/sccolormgmtstructs.h	(revision 14771)
+++ scribus/colormgmt/sccolormgmtstructs.h	(revision 14772)
@@ -8,7 +8,6 @@
 #ifndef SCCOLORMGMTSTRUCTS_H
 #define SCCOLORMGMTSTRUCTS_H
 
-#include "icc34.h" //part of lcms1
 #include <QString>
 
 // If you change that enum do not forget to update functions
@@ -61,6 +60,34 @@
 	Intent_Max = 4
 } eRenderIntent;
 
+typedef enum 
+{
+	ColorSpace_Unknown,
+    ColorSpace_XYZ,
+    ColorSpace_Lab,
+    ColorSpace_Luv,
+    ColorSpace_YCbCr,
+    ColorSpace_Yxy,
+    ColorSpace_Rgb,
+    ColorSpace_Gray,
+    ColorSpace_Hsv,
+    ColorSpace_Hls,
+    ColorSpace_Cmyk,
+    ColorSpace_Cmy
+} eColorSpaceType;
+
+typedef enum 
+{
+	Class_Unknown,
+    Class_Input,
+    Class_Display,
+    Class_Output,
+    Class_Link,
+    Class_Abstract,
+    Class_ColorSpace,
+    Class_NamedColor
+} eProfileClass;
+
 class ScColorMgmtStrategy
 {
 public:
@@ -78,8 +105,8 @@
 {
 	QString file;
 	QString description;
-	icColorSpaceSignature   colorSpace;
-	icProfileClassSignature deviceClass;
+	eColorSpaceType colorSpace;
+	eProfileClass   deviceClass;
 	QString debug;
 } ScColorProfileInfo;
 
Index: scribus/colormgmt/sclcmscolorprofileimpl.cpp
===================================================================
--- scribus/colormgmt/sclcmscolorprofileimpl.cpp	(revision 14771)
+++ scribus/colormgmt/sclcmscolorprofileimpl.cpp	(revision 14772)
@@ -6,6 +6,7 @@
 */
 
 #include "sclcmscolorprofileimpl.h"
+#include "sclcmscolormgmtengineimpl.h"
 
 ScLcmsColorProfileImpl::ScLcmsColorProfileImpl(ScColorMgmtEngine& engine, cmsHPROFILE lcmsProfile)
                       : ScColorProfileImplBase(engine), m_profileHandle(lcmsProfile)
@@ -23,18 +24,18 @@
 	return (m_profileHandle == NULL);
 }
 
-icColorSpaceSignature ScLcmsColorProfileImpl::colorSpace()  const
+eColorSpaceType ScLcmsColorProfileImpl::colorSpace()  const
 {
 	if (m_profileHandle)
-		return cmsGetColorSpace(m_profileHandle);
-	return ((icColorSpaceSignature) 0);
+		return ScLcmsColorMgmtEngineImpl::translateLcmsColorSpaceType( cmsGetColorSpace(m_profileHandle) );
+	return ColorSpace_Unknown;
 }
 
-icProfileClassSignature ScLcmsColorProfileImpl::deviceClass() const
+eProfileClass ScLcmsColorProfileImpl::deviceClass() const
 {
 	if (m_profileHandle)
-		return cmsGetDeviceClass(m_profileHandle);
-	return ((icProfileClassSignature) 0);
+		return ScLcmsColorMgmtEngineImpl::translateLcmsProfileClass( cmsGetDeviceClass(m_profileHandle) );
+	return Class_Unknown;
 }
 
 QString ScLcmsColorProfileImpl::productDescription() const
Index: scribus/colormgmt/sccolorprofile.h
===================================================================
--- scribus/colormgmt/sccolorprofile.h	(revision 14771)
+++ scribus/colormgmt/sccolorprofile.h	(revision 14772)
@@ -31,8 +31,8 @@
 	QString profilePath() const;
 	QString productDescription() const;
 	
-	icColorSpaceSignature   colorSpace()  const;
-	icProfileClassSignature deviceClass() const;
+	eColorSpaceType colorSpace()  const;
+	eProfileClass   deviceClass() const;
 	
 	const ScColorProfileData* data() const { return m_data.data(); }
 
Index: scribus/colormgmt/sclcmscolorprofileimpl.h
===================================================================
--- scribus/colormgmt/sclcmscolorprofileimpl.h	(revision 14771)
+++ scribus/colormgmt/sclcmscolorprofileimpl.h	(revision 14772)
@@ -24,9 +24,9 @@
 
 	virtual bool isNull() const;
 
-	virtual icColorSpaceSignature   colorSpace()  const;
-	virtual icProfileClassSignature deviceClass() const;
-	virtual QString                 productDescription() const;
+	virtual eColorSpaceType colorSpace()  const;
+	virtual eProfileClass   deviceClass() const;
+	virtual QString         productDescription() const;
 
 protected:
 	cmsHPROFILE     m_profileHandle;
Index: scribus/plugins/scriptplugin/objpdffile.cpp
===================================================================
--- scribus/plugins/scriptplugin/objpdffile.cpp	(revision 14771)
+++ scribus/plugins/scriptplugin/objpdffile.cpp	(revision 14772)
@@ -1109,11 +1109,11 @@
 				ScColorProfile profile;
 				profile = ScCore->defaultEngine.openProfileFromFile(ScCore->PrinterProfiles[ScCore->primaryMainWindow()->doc->PDF_Options.PrintProf]);
 				nam = profile.productDescription();
-				if (static_cast<int>(profile.colorSpace()) == icSigRgbData)
+				if (profile.colorSpace() == ColorSpace_Rgb)
 					Components = 3;
-				if (static_cast<int>(profile.colorSpace()) == icSigCmykData)
+				if (profile.colorSpace() == ColorSpace_Cmyk)
 					Components = 4;
-				if (static_cast<int>(profile.colorSpace()) == icSigCmyData)
+				if (profile.colorSpace() == ColorSpace_Cmy)
 					Components = 3;
 				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());




More information about the scribus-commit mailing list