r23515 by jghali - Some preparation work targetted at handling sRGB colorspace info in PNGs

scribus-commit scribus-commit at lists.scribus.net
Thu Mar 19 11:08:06 UTC 2020


Author: jghali
Date: Thu Mar 19 11:08:06 2020
New Revision: 23515

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23515
Log:
Some preparation work targetted at handling sRGB colorspace info in PNGs

Modified:
    trunk/Scribus/scribus/colormgmt/sccolorprofile.cpp
    trunk/Scribus/scribus/colormgmt/sccolorprofile.h
    trunk/Scribus/scribus/colormgmt/sccolorprofiledata.h
    trunk/Scribus/scribus/colormgmt/sclcms2colorprofileimpl.cpp
    trunk/Scribus/scribus/colormgmt/sclcms2colorprofileimpl.h

Modified: trunk/Scribus/scribus/colormgmt/sccolorprofile.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23515&path=/trunk/Scribus/scribus/colormgmt/sccolorprofile.cpp
==============================================================================
--- trunk/Scribus/scribus/colormgmt/sccolorprofile.cpp	(original)
+++ trunk/Scribus/scribus/colormgmt/sccolorprofile.cpp	Thu Mar 19 11:08:06 2020
@@ -61,6 +61,13 @@
 	return QString();
 }
 
+bool ScColorProfile::save(QByteArray& profileData) const
+{
+	if (m_data)
+		return m_data->save(profileData);
+	return false;
+}
+
 bool ScColorProfile::operator==(const ScColorProfile& other) const
 {
 	return m_data == other.m_data;

Modified: trunk/Scribus/scribus/colormgmt/sccolorprofile.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23515&path=/trunk/Scribus/scribus/colormgmt/sccolorprofile.h
==============================================================================
--- trunk/Scribus/scribus/colormgmt/sccolorprofile.h	(original)
+++ trunk/Scribus/scribus/colormgmt/sccolorprofile.h	Thu Mar 19 11:08:06 2020
@@ -40,6 +40,8 @@
 	const ScColorProfileData* data() const { return m_data.data(); }
 	QString dataHash() const;
 
+	bool save(QByteArray& profileData) const;
+
 	bool operator==(const ScColorProfile& prof) const;
 	
 protected:

Modified: trunk/Scribus/scribus/colormgmt/sccolorprofiledata.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23515&path=/trunk/Scribus/scribus/colormgmt/sccolorprofiledata.h
==============================================================================
--- trunk/Scribus/scribus/colormgmt/sccolorprofiledata.h	(original)
+++ trunk/Scribus/scribus/colormgmt/sccolorprofiledata.h	Thu Mar 19 11:08:06 2020
@@ -33,6 +33,7 @@
 	virtual eProfileClass   deviceClass() const = 0;
 	virtual bool    isSuitableForOutput() const = 0;
 	virtual QString productDescription() const = 0;
+	virtual bool    save(QByteArray& profileData) const = 0;
 };
 
 #endif

Modified: trunk/Scribus/scribus/colormgmt/sclcms2colorprofileimpl.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23515&path=/trunk/Scribus/scribus/colormgmt/sclcms2colorprofileimpl.cpp
==============================================================================
--- trunk/Scribus/scribus/colormgmt/sclcms2colorprofileimpl.cpp	(original)
+++ trunk/Scribus/scribus/colormgmt/sclcms2colorprofileimpl.cpp	Thu Mar 19 11:08:06 2020
@@ -106,3 +106,24 @@
 		m_profileHandle = nullptr;
 	}
 }
+
+bool ScLcms2ColorProfileImpl::save(QByteArray& profileData) const
+{
+	if (!m_profileHandle)
+		return false;
+	profileData.clear();
+
+	// First retrieve profile size
+	cmsUInt32Number bytesNeeded = 0;
+	bool done = cmsSaveProfileToMem(m_profileHandle, 0, &bytesNeeded);
+	if (!done)
+		return false;
+
+	// Allocate array for profile data
+	profileData.resize(bytesNeeded);
+	if (profileData.size() != bytesNeeded)
+		return false;
+	done = cmsSaveProfileToMem(m_profileHandle, profileData.data(), &bytesNeeded);
+
+	return done;
+}

Modified: trunk/Scribus/scribus/colormgmt/sclcms2colorprofileimpl.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23515&path=/trunk/Scribus/scribus/colormgmt/sclcms2colorprofileimpl.h
==============================================================================
--- trunk/Scribus/scribus/colormgmt/sclcms2colorprofileimpl.h	(original)
+++ trunk/Scribus/scribus/colormgmt/sclcms2colorprofileimpl.h	Thu Mar 19 11:08:06 2020
@@ -28,6 +28,7 @@
 	virtual eProfileClass   deviceClass() const;
 	virtual bool            isSuitableForOutput() const;
 	virtual QString         productDescription() const;
+	virtual bool            save(QByteArray& profileData) const;
 
 protected:
 	cmsHPROFILE     m_profileHandle;




More information about the scribus-commit mailing list