r17007 by fschmid - Fixed Bug 10291: "add warning to the preflight verifier when PNG image with transparency is inservted in PDF 1.3"

scribus-commit scribus-commit at lists.scribus.net
Tue Nov 22 11:12:24 UTC 2011


Author: fschmid
Date: Tue Nov 22 11:12:24 2011
New Revision: 17007

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17007
Log:
Fixed Bug 10291: "add warning to the preflight verifier when PNG image with transparency is inservted in PDF 1.3"

Modified:
    trunk/Scribus/scribus/documentchecker.cpp
    trunk/Scribus/scribus/scimage.cpp
    trunk/Scribus/scribus/scimage.h

Modified: trunk/Scribus/scribus/documentchecker.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17007&path=/trunk/Scribus/scribus/documentchecker.cpp
==============================================================================
--- trunk/Scribus/scribus/documentchecker.cpp (original)
+++ trunk/Scribus/scribus/documentchecker.cpp Tue Nov 22 11:12:24 2011
@@ -204,6 +204,11 @@
 					itemError.insert(MissingImage, 0);
 				else
 				{
+					if (currItem->PictureIsAvailable)
+					{
+						if (checkerSettings.checkTransparency && currItem->pixm.hasSmoothAlpha())
+							itemError.insert(Transparency, 0);
+					}
 					if  (((qRound(72.0 / currItem->imageXScale()) < checkerSettings.minResolution) || (qRound(72.0 / currItem->imageYScale()) < checkerSettings.minResolution))
 							&& (currItem->isRaster) && (checkerSettings.checkResolution))
 						itemError.insert(ImageDPITooLow, 0);
@@ -490,6 +495,11 @@
 					itemError.insert(MissingImage, 0);
 				else
 				{
+					if (currItem->PictureIsAvailable)
+					{
+						if (checkerSettings.checkTransparency && currItem->pixm.hasSmoothAlpha())
+							itemError.insert(Transparency, 0);
+					}
 					if  (((qRound(72.0 / currItem->imageXScale()) < checkerSettings.minResolution) || (qRound(72.0 / currItem->imageYScale()) < checkerSettings.minResolution))
 							&& (currItem->isRaster) && (checkerSettings.checkResolution))
 						itemError.insert(ImageDPITooLow, 0);

Modified: trunk/Scribus/scribus/scimage.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17007&path=/trunk/Scribus/scribus/scimage.cpp
==============================================================================
--- trunk/Scribus/scribus/scimage.cpp (original)
+++ trunk/Scribus/scribus/scimage.cpp Tue Nov 22 11:12:24 2011
@@ -2444,3 +2444,23 @@
 	}
 	return true;
 }
+
+bool ScImage::hasSmoothAlpha()
+{
+	int h = height();
+	int w = width();
+	QSet<int> alpha;
+	QRgb *s, r;
+	for( int yi=0; yi < h; ++yi )
+	{
+		s = (QRgb*)(scanLine( yi ));
+		for( int xi=0; xi < w; ++xi )
+		{
+			r = *s++;
+			alpha.insert(qAlpha(r));
+			if (alpha.count() > 2)
+				return true;
+		}
+	}
+	return (alpha.count() > 2);
+}

Modified: trunk/Scribus/scribus/scimage.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17007&path=/trunk/Scribus/scribus/scimage.h
==============================================================================
--- trunk/Scribus/scribus/scimage.h (original)
+++ trunk/Scribus/scribus/scimage.h Tue Nov 22 11:12:24 2011
@@ -76,6 +76,7 @@
 	int height() const { return QImage::height(); }
 	int width() const { return QImage::width(); }
 	bool hasAlpha() const { return QImage::hasAlphaChannel(); }
+	bool hasSmoothAlpha();
 	
 	// Routines for PDF/PS output of images
 	QByteArray ImageToArray();




More information about the scribus-commit mailing list