summaryrefslogtreecommitdiffstats
path: root/src/helper
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2010-04-06 14:11:54 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2010-04-06 14:11:54 +0000
commit95a0c8412e84f5e0cc1d9a63fce2be75f9fa517e (patch)
tree12ea4d0d88ad2a94be630f6634aef3b88460748f /src/helper
parentFixed use of dialogs in more than one window, and tile problem with selection... (diff)
downloadinkscape-95a0c8412e84f5e0cc1d9a63fce2be75f9fa517e.tar.gz
inkscape-95a0c8412e84f5e0cc1d9a63fce2be75f9fa517e.zip
Revert the inverted coordinate system fix. 3D Boxes and guides
require an XML-level backwards compatibility mechanism to fix properly, and it's too late in the 0.48 cycle to introduce it. (bzr r9298)
Diffstat (limited to 'src/helper')
-rw-r--r--src/helper/pixbuf-ops.cpp2
-rw-r--r--src/helper/png-write.cpp21
2 files changed, 19 insertions, 4 deletions
diff --git a/src/helper/pixbuf-ops.cpp b/src/helper/pixbuf-ops.cpp
index c26d55b8b..3be63aa68 100644
--- a/src/helper/pixbuf-ops.cpp
+++ b/src/helper/pixbuf-ops.cpp
@@ -113,7 +113,7 @@ sp_generate_internal_bitmap(SPDocument *doc, gchar const */*filename*/,
double padding = 1.0;
Geom::Point origin(screen.min()[Geom::X],
- screen.min()[Geom::Y]);
+ sp_document_height(doc) - screen[Geom::Y].extent() - screen.min()[Geom::Y]);
origin[Geom::X] = origin[Geom::X] + (screen[Geom::X].extent() * ((1 - padding) / 2));
origin[Geom::Y] = origin[Geom::Y] + (screen[Geom::Y].extent() * ((1 - padding) / 2));
diff --git a/src/helper/png-write.cpp b/src/helper/png-write.cpp
index 8eb9e27bf..b1c135db0 100644
--- a/src/helper/png-write.cpp
+++ b/src/helper/png-write.cpp
@@ -424,9 +424,24 @@ sp_export_png_file(SPDocument *doc, gchar const *filename,
sp_document_ensure_up_to_date(doc);
- /* Calculate translation */
- Geom::Point translation = Geom::Point(-area[Geom::X][0], -area[Geom::Y][0]);
-
+ /* Calculate translation by transforming to document coordinates (flipping Y)*/
+ Geom::Point translation = Geom::Point(-area[Geom::X][0], area[Geom::Y][1] - sp_document_height(doc));
+
+ /* This calculation is only valid when assumed that (x0,y0)= area.corner(0) and (x1,y1) = area.corner(2)
+ * 1) a[0] * x0 + a[2] * y1 + a[4] = 0.0
+ * 2) a[1] * x0 + a[3] * y1 + a[5] = 0.0
+ * 3) a[0] * x1 + a[2] * y1 + a[4] = width
+ * 4) a[1] * x0 + a[3] * y0 + a[5] = height
+ * 5) a[1] = 0.0;
+ * 6) a[2] = 0.0;
+ *
+ * (1,3) a[0] * x1 - a[0] * x0 = width
+ * a[0] = width / (x1 - x0)
+ * (2,4) a[3] * y0 - a[3] * y1 = height
+ * a[3] = height / (y0 - y1)
+ * (1) a[4] = -a[0] * x0
+ * (2) a[5] = -a[3] * y1
+ */
Geom::Matrix const affine(Geom::Translate(translation)
* Geom::Scale(width / area.width(),