r20043 by fschmid - Fixed Bug #11561: IDML Import : problem with some images

scribus-commit scribus-commit at lists.scribus.net
Fri May 1 09:32:39 UTC 2015


Author: fschmid
Date: Fri May  1 09:32:39 2015
New Revision: 20043

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=20043
Log:
Fixed Bug #11561: IDML Import : problem with some images

Modified:
    trunk/Scribus/scribus/imagedataloaders/scimgdataloader_pdf.cpp
    trunk/Scribus/scribus/plugins/import/idml/importidml.cpp
    trunk/Scribus/scribus/util_formats.cpp

Modified: trunk/Scribus/scribus/imagedataloaders/scimgdataloader_pdf.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20043&path=/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_pdf.cpp
==============================================================================
--- trunk/Scribus/scribus/imagedataloaders/scimgdataloader_pdf.cpp (original)
+++ trunk/Scribus/scribus/imagedataloaders/scimgdataloader_pdf.cpp Fri May  1 09:32:39 2015
@@ -75,7 +75,7 @@
 	args.append("-sOutputFile="+tmpFile);
 	args.append("-dFirstPage=" + QString::number(qMax(1, page)));
 	args.append("-dLastPage=" + QString::number(qMax(1, page)));
-	args.append("-dUseCropBox");
+	args.append("-dUseArtBox");
 	args.append(picFile);
 //	qDebug() << "scimgdataloader_pdf:" << args;
 	int retg = callGS(args);
@@ -129,7 +129,7 @@
 	args.append("-sOutputFile="+tmpFile);
 	args.append("-dFirstPage=" + QString::number(qMax(1, page)));
 	args.append("-dLastPage=" + QString::number(qMax(1, page)));
-	args.append("-dUseCropBox");
+	args.append("-dUseArtBox");
 //	args.append("\""+picFile+"\"");
 	args.append(picFile);
 //	qDebug() << "scimgdataloader_pdf(alpha):" << args;

Modified: trunk/Scribus/scribus/plugins/import/idml/importidml.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20043&path=/trunk/Scribus/scribus/plugins/import/idml/importidml.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/idml/importidml.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/idml/importidml.cpp Fri May  1 09:32:39 2015
@@ -1863,6 +1863,8 @@
 	QByteArray imageData = "";
 	QString imageFileName = "";
 	QTransform imageTransform;
+	double imageDX = 0;
+	double imageDY = 0;
 	QString storyForPath = "";
 	int pathTextType = 0;
 	double pathTextStart = 0;
@@ -1990,6 +1992,10 @@
 		{
 			if (ite.hasAttribute("FittingOnEmptyFrame"))
 				imageFit = ite.attribute("FittingOnEmptyFrame");
+			if (ite.hasAttribute("LeftCrop"))
+				imageDX = ite.attribute("LeftCrop").toDouble();
+			if (ite.hasAttribute("TopCrop"))
+				imageDY = ite.attribute("TopCrop").toDouble();
 		}
 		else if (ite.tagName() == "TransparencySetting")
 		{
@@ -2066,7 +2072,7 @@
 			ScTextStream list(&imageTrans, QIODevice::ReadOnly);
 			double a, b, c, d, e, f;
 			list >> a >> b >> c >> d >> e >> f;
-			imageTransform = QTransform(a, b, c, d, e, f);
+			imageTransform = QTransform(a, b, c, d, e, f) * transformation;
 			for(QDomNode itp = ite.firstChild(); !itp.isNull(); itp = itp.nextSibling() )
 			{
 				QDomElement itpg = itp.toElement();
@@ -2605,8 +2611,8 @@
 								item->AspectRatio = false;
 							}
 							m_Doc->loadPict(fileName, item);
-							item->setImageXYOffset(dxi - grOffset.x(), dyi - grOffset.y());
 							item->setImageXYScale(scXi / item->pixm.imgInfo.xres * 72, scYi / item->pixm.imgInfo.xres * 72);
+							item->setImageXYOffset(-imageDX * scXi / item->imageXScale(), -imageDY * scXi / item->imageYScale());
 							item->setImageRotation(-roti);
 							item->AdjustPictScale();
 						}
@@ -2641,7 +2647,7 @@
 					}
 					m_Doc->loadPict(QUrl::fromPercentEncoding(fileName), item);
 					item->setImageXYScale(scXi / item->pixm.imgInfo.xres * 72, scYi / item->pixm.imgInfo.xres * 72);
-					item->setImageXYOffset((dxi - grOffset.x()) / item->imageXScale(), (dyi - grOffset.y()) / item->imageYScale());
+					item->setImageXYOffset(-imageDX * scXi / item->imageXScale(), -imageDY * scXi / item->imageYScale());
 					item->setImageRotation(-roti);
 					if (imageFit != "None")
 						item->AdjustPictScale();

Modified: trunk/Scribus/scribus/util_formats.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20043&path=/trunk/Scribus/scribus/util_formats.cpp
==============================================================================
--- trunk/Scribus/scribus/util_formats.cpp (original)
+++ trunk/Scribus/scribus/util_formats.cpp Fri May  1 09:32:39 2015
@@ -321,10 +321,10 @@
 
 bool extensionIndicatesPDF(const QString &ext)
 {
-// 	QStringList strl;
-// 	strl << "pdf";
-// 	return strl.contains(ext, Qt::CaseInsensitive);
-	return (QString::compare("pdf", ext, Qt::CaseInsensitive) == 0);
+	QStringList strl;
+	strl << "ai" << "pdf";
+	return strl.contains(ext, Qt::CaseInsensitive);
+//	return (QString::compare("pdf", ext, Qt::CaseInsensitive) == 0);
 }
 
 bool extensionIndicatesEPS(const QString &ext)




More information about the scribus-commit mailing list