r13906 by fschmid - WPG-Import: Correct scaling and placement of Bitmaps.

scribus-commit scribus-commit at lists.scribus.net
Wed Aug 26 06:11:33 CEST 2009


Revision: 13906
Author: fschmid
Date: 2009-08-24T11:15:51.633808Z
Commit message: WPG-Import: Correct scaling and placement of Bitmaps.

Changeset: 
M  /trunk/Scribus/scribus/plugins/wpgimplugin/wpg/libwpg_utils.h
M  /trunk/Scribus/scribus/plugins/wpgimplugin/importwpg.cpp

Diffs:
Index: scribus/plugins/wpgimplugin/importwpg.cpp
===================================================================
--- scribus/plugins/wpgimplugin/importwpg.cpp	(revision 13905)
+++ scribus/plugins/wpgimplugin/importwpg.cpp	(revision 13906)
@@ -411,7 +411,9 @@
 			image.setPixel(x, y, qRgb(color.red, color.green, color.blue));
 		}
 	}
-	int z = m_Doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, bitmap.rect.x1+baseX, bitmap.rect.y1+baseY, bitmap.width() / hres * 72.0, bitmap.height() / vres * 72.0, 1, m_Doc->toolSettings.dBrushPict, CommonStrings::None, true);
+	double w = (bitmap.rect.x2 - bitmap.rect.x1) * 72.0;
+	double h = (bitmap.rect.y2 - bitmap.rect.y1) * 72.0;
+	int z = m_Doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, bitmap.rect.x1 * 72 + baseX, bitmap.rect.y1 * 72 + baseY, w, h, 1, m_Doc->toolSettings.dBrushPict, CommonStrings::None, true);
 	PageItem *ite = m_Doc->Items->at(z);
 	ite->tempImageFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_svg_XXXXXX.png");
 	ite->tempImageFile->open();
@@ -422,6 +424,8 @@
 	image.setDotsPerMeterY ((int) (vres / 0.0254));
 	image.save(fileName, "PNG");
 	m_Doc->LoadPict(fileName, z);
+	ite->setImageScalingMode(false, false);
+	ite->moveBy(m_Doc->currentPage()->xOffset(), m_Doc->currentPage()->yOffset());
 	finishItem(ite);
 }
 
Index: scribus/plugins/wpgimplugin/wpg/libwpg_utils.h
===================================================================
--- scribus/plugins/wpgimplugin/wpg/libwpg_utils.h	(revision 13905)
+++ scribus/plugins/wpgimplugin/wpg/libwpg_utils.h	(revision 13906)
@@ -28,7 +28,7 @@
 
 #include <stdio.h>
 
-// #define DEBUG // FIXME !
+//#define DEBUG // FIXME !
 
 // debug message includes source file and line number
 //#define VERBOSE_DEBUG 1




More information about the scribus-commit mailing list