diff options
| author | Thomas Holder <thomas@thomas-holder.de> | 2018-09-12 14:43:47 +0000 |
|---|---|---|
| committer | Thomas Holder <thomas@thomas-holder.de> | 2018-09-12 14:43:47 +0000 |
| commit | 1fa0c72b664afa4803dffd463ed11ce01632ab76 (patch) | |
| tree | c1f746d4e8f7a5d65541cf6c05d3cdc79b3f9c10 /src/helper/png-write.cpp | |
| parent | Fix preferences crash (diff) | |
| download | inkscape-1fa0c72b664afa4803dffd463ed11ce01632ab76.tar.gz inkscape-1fa0c72b664afa4803dffd463ed11ce01632ab76.zip | |
New option to invert y-axis
Replaces all hard coded or implicit desktop coordinate usage with
doc2dt multiplication.
New global preference: Interface > Origin at upper left
https://bugs.launchpad.net/inkscape/+bug/170049
Diffstat (limited to 'src/helper/png-write.cpp')
| -rw-r--r-- | src/helper/png-write.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/helper/png-write.cpp b/src/helper/png-write.cpp index 92fdc3648..fe5412c4e 100644 --- a/src/helper/png-write.cpp +++ b/src/helper/png-write.cpp @@ -31,6 +31,8 @@ #include "rdf.h" #include "util/units.h" +#include "inkscape.h" + #include "object/sp-item.h" #include "object/sp-root.h" #include "object/sp-defs.h" @@ -425,8 +427,13 @@ ExportResult sp_export_png_file(SPDocument *doc, gchar const *filename, doc->ensureUpToDate(); + Geom::Affine dt2doc; + if (SP_ACTIVE_DESKTOP) { + dt2doc = SP_ACTIVE_DESKTOP->dt2doc(); + } + /* Calculate translation by transforming to document coordinates (flipping Y)*/ - Geom::Point translation = Geom::Point(-area[Geom::X][0], area[Geom::Y][1] - doc->getHeight().value("px")); + Geom::Point translation = -(area * dt2doc).min(); /* 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 |
