r23831 by jghali - Allow Black and White color to be defined using a RGB model

scribus-commit scribus-commit at lists.scribus.net
Mon May 25 23:56:54 UTC 2020


Author: jghali
Date: Mon May 25 23:56:54 2020
New Revision: 23831

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23831
Log:
Allow Black and White color to be defined using a RGB model

Modified:
    trunk/Scribus/scribus/sccolor.cpp

Modified: trunk/Scribus/scribus/sccolor.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23831&path=/trunk/Scribus/scribus/sccolor.cpp
==============================================================================
--- trunk/Scribus/scribus/sccolor.cpp	(original)
+++ trunk/Scribus/scribus/sccolor.cpp	Mon May 25 23:56:54 2020
@@ -162,7 +162,7 @@
 	}
 }
 
-void  ScColor::getRawRGBColor(RGBColorF* rgb) const
+void ScColor::getRawRGBColor(RGBColorF* rgb) const
 {
 	if (m_Model == colorModelRGB)
 	{
@@ -469,10 +469,19 @@
 		colorModel model = black.getColorModel();
 		if (model == colorModelCMYK)
 		{
-			int c, m, y, k;
+			double c, m, y, k;
 			black.getCMYK(&c, &m, &y, &k);
-			if (c == 0 && m == 0 && y == 0 && k == 255)
-				addBlack = false;
+			if (c != 0.0 || m != 0.0 || y != 0.0 || k != 1.0)
+				black.setCmykColorF(0.0, 0.0, 0.0, 1.0);
+			addBlack = false;
+		}
+		else if (model == colorModelRGB)
+		{
+			double r, g, b;
+			black.getRGB(&r, &g, &b);
+			if (r != 0.0 || g != 0.0 || b != 0.0)
+				black.setRgbColorF(0.0, 0.0, 0.0);
+			addBlack = false;
 		}
 	}
 	if (addBlack)
@@ -489,10 +498,19 @@
 		colorModel model = white.getColorModel();
 		if (model == colorModelCMYK)
 		{
-			int c, m, y, k;
+			double c, m, y, k;
 			white.getCMYK(&c, &m, &y, &k);
-			if (c == 0 && m == 0 && y == 0 && k == 0)
-				addWhite = false;
+			if (c != 0.0 || m != 0.0 || y != 0.0 || k != 0.0)
+				white.setCmykColorF(0.0, 0.0, 0.0, 0.0);
+			addWhite = false;
+		}
+		else if (model == colorModelRGB)
+		{
+			double r, g, b;
+			white.getRGB(&r, &g, &b);
+			if (r != 1.0 || g != 1.0 || b != 1.0)
+				white.setRgbColorF(1.0, 1.0, 1.0);
+			addWhite = false;
 		}
 	}
 	if (addWhite)




More information about the scribus-commit mailing list