r13997 by fschmid - Mac Pict Importer: support for images with 5 bits per RGB component added.

scribus-commit scribus-commit at lists.scribus.net
Fri Sep 18 11:35:17 CEST 2009


Revision: 13997
Author: fschmid
Date: 2009-09-18T09:30:18.812487Z
Commit message: Mac Pict Importer: support for images with 5 bits per RGB component added.

Changeset: 
M  /trunk/Scribus/scribus/plugins/pctimplugin/importpct.cpp

Diffs:
Index: scribus/plugins/pctimplugin/importpct.cpp
===================================================================
--- scribus/plugins/pctimplugin/importpct.cpp	(revision 13996)
+++ scribus/plugins/pctimplugin/importpct.cpp	(revision 13997)
@@ -1487,11 +1487,25 @@
 			}
 			else if ((opCode == 0x009A) || (opCode == 0x009B))
 			{
-				if (component_size == 8)
+				if (component_size == 5)
 				{
 					QRgb *q = (QRgb*)(image.scanLine(rr));
+					int imgDcount = 0;
 					for (quint16 xx = 0; xx < pixCols; xx++)
 					{
+						uchar i = img[imgDcount++];
+						uchar j = img[imgDcount++];
+						quint16 r = (i & 0x7c) << 1;
+						quint16 g = ((i & 0x03) << 6) | ((j & 0xe0) >> 2);
+						quint16 b = (j & 0x1f) << 3;
+						*q++ = qRgba(r, g, b, 255);
+					}
+				}
+				else if (component_size == 8)
+				{
+					QRgb *q = (QRgb*)(image.scanLine(rr));
+					for (quint16 xx = 0; xx < pixCols; xx++)
+					{
 						uchar r, g, b;
 						uchar a = 255;
 						r = img[xx];
@@ -1517,7 +1531,7 @@
 		imgRows = dstRect.height();
 		imgCols = dstRect.width();
 	}
-	if ((component_size == 8) || (component_size == 1))
+	if ((component_size == 8) || (component_size == 1) || (component_size == 5))
 	{
 		image = image.convertToFormat(QImage::Format_ARGB32);
 		if (!isPixmap)




More information about the scribus-commit mailing list