r14501 by fschmid - CGM Importer: fixed 16bit color reading

scribus-commit scribus-commit at lists.scribus.net
Fri Jan 8 10:10:22 CET 2010


Revision: 14501
Author: fschmid
Date: 2010-01-07T19:59:59.591256Z
Commit message: CGM Importer: fixed 16bit color reading

Changeset: 
M  /trunk/Scribus/scribus/plugins/import/cgm/importcgm.cpp

Diffs:
Index: scribus/plugins/import/cgm/importcgm.cpp
===================================================================
--- scribus/plugins/import/cgm/importcgm.cpp	(revision 14500)
+++ scribus/plugins/import/cgm/importcgm.cpp	(revision 14501)
@@ -1808,9 +1808,9 @@
 			uint r = ri;
 			uint g = gi;
 			uint b = bi;
-			r = qRound(r * (maxColor - minColor) / static_cast<double>(maxColor));
-			g = qRound(g * (maxColor - minColor) / static_cast<double>(maxColor));
-			b = qRound(b * (maxColor - minColor) / static_cast<double>(maxColor));
+			r = qRound((r * (maxColor - minColor) / static_cast<double>(maxColor)) / 65535.0 * 255.0);
+			g = qRound((g * (maxColor - minColor) / static_cast<double>(maxColor)) / 65535.0 * 255.0);
+			b = qRound((b * (maxColor - minColor) / static_cast<double>(maxColor)) / 65535.0 * 255.0);
 			ret = ScColor(r, g, b);
 		}
 	}
@@ -1838,10 +1838,10 @@
 			uint m = mi;
 			uint y = yi;
 			uint k = ki;
-			c = qRound(c * (maxColor - minColor) / static_cast<double>(maxColor));
-			m = qRound(m * (maxColor - minColor) / static_cast<double>(maxColor));
-			y = qRound(y * (maxColor - minColor) / static_cast<double>(maxColor));
-			k = qRound(k * (maxColor - minColor) / static_cast<double>(maxColor));
+			c = qRound((c * (maxColor - minColor) / static_cast<double>(maxColor)) / 65535.0 * 255.0);
+			m = qRound((m * (maxColor - minColor) / static_cast<double>(maxColor)) / 65535.0 * 255.0);
+			y = qRound((y * (maxColor - minColor) / static_cast<double>(maxColor)) / 65535.0 * 255.0);
+			k = qRound((k * (maxColor - minColor) / static_cast<double>(maxColor)) / 65535.0 * 255.0);
 			ret = ScColor(c, m, y, k);
 		}
 	}




More information about the scribus-commit mailing list