diff options
| author | Thomas Holder <thomas@thomas-holder.de> | 2018-09-23 16:17:50 +0000 |
|---|---|---|
| committer | Thomas Holder <thomas@thomas-holder.de> | 2018-09-23 16:17:50 +0000 |
| commit | 72be775b99d281e93610f3d8db719ec63e27e8f7 (patch) | |
| tree | e275ea152a6aa3edf808dd7c258681f2b65763a2 /src | |
| parent | fix "Arrange" dialog with inverted y-axis (diff) | |
| download | inkscape-72be775b99d281e93610f3d8db719ec63e27e8f7.tar.gz inkscape-72be775b99d281e93610f3d8db719ec63e27e8f7.zip | |
fix .odg and .fx export with inverted y-axis
Diffstat (limited to 'src')
| -rw-r--r-- | src/extension/internal/javafx-out.cpp | 6 | ||||
| -rw-r--r-- | src/extension/internal/odf.cpp | 24 |
2 files changed, 11 insertions, 19 deletions
diff --git a/src/extension/internal/javafx-out.cpp b/src/extension/internal/javafx-out.cpp index ffe50bc7d..29cfb4795 100644 --- a/src/extension/internal/javafx-out.cpp +++ b/src/extension/internal/javafx-out.cpp @@ -492,8 +492,7 @@ bool JavaFXOutput::doCurve(SPItem *item, const String &id) } // convert the path to only lineto's and cubic curveto's: - Geom::Scale yflip(1.0, -1.0); /// @fixme hardcoded desktop transform! - Geom::Affine tf = item->i2dt_affine() * yflip; + Geom::Affine tf = item->i2doc_affine(); Geom::PathVector pathv = pathv_to_linear_and_cubic_beziers( shape->_curve->get_pathvector() * tf ); //Count the NR_CURVETOs/LINETOs (including closing line segment) @@ -632,8 +631,7 @@ bool JavaFXOutput::doCurve(SPItem *item, const String &id) } // convert the path to only lineto's and cubic curveto's: - Geom::Scale yflip(1.0, -1.0); /// @fixme hardcoded desktop transform - Geom::Affine tf = item->i2dt_affine() * yflip; + Geom::Affine tf = item->i2doc_affine(); Geom::PathVector pathv = pathv_to_linear_and_cubic_beziers( curve->get_pathvector() * tf ); //Count the NR_CURVETOs/LINETOs (including closing line segment) diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp index bd036da05..7d18196c9 100644 --- a/src/extension/internal/odf.cpp +++ b/src/extension/internal/odf.cpp @@ -67,6 +67,7 @@ #include "object/sp-stop.h" #include "object/sp-linear-gradient.h" #include "object/sp-radial-gradient.h" +#include "object/sp-root.h" #include "object/sp-path.h" #include "object/sp-text.h" #include "object/sp-flowtext.h" @@ -935,12 +936,7 @@ static Glib::ustring formatTransform(Geom::Affine &tf) static Geom::Affine getODFTransform(const SPItem *item) { //### Get SVG-to-ODF transform - Geom::Affine tf (item->i2dt_affine()); - //Flip Y into document coordinates - double doc_height = SP_ACTIVE_DOCUMENT->getHeight().value("px"); - Geom::Affine doc2dt_tf = Geom::Affine(Geom::Scale(1.0, -1.0)); /// @fixme hardcoded desktop transform - doc2dt_tf = doc2dt_tf * Geom::Affine(Geom::Translate(0, doc_height)); - tf = tf * doc2dt_tf; + Geom::Affine tf (item->i2doc_affine()); tf = tf * Geom::Affine(Geom::Scale(pxToCm)); return tf; } @@ -962,14 +958,13 @@ static Geom::OptRect getODFBoundingBox(const SPItem *item) /** - * Get the transform for an item, correcting for - * handedness reversal + * Get the transform for an item, including parents, but without + * root viewBox transformation. */ static Geom::Affine getODFItemTransform(const SPItem *item) { - Geom::Affine itemTransform (Geom::Scale(1, -1)); /// @fixme hardcoded doc2dt transform? - itemTransform = itemTransform * (Geom::Affine)item->transform; - itemTransform = itemTransform * Geom::Scale(1, -1); + Geom::Affine itemTransform (item->i2doc_affine() * + SP_ACTIVE_DOCUMENT->getRoot()->c2p.inverse()); return itemTransform; } @@ -1720,10 +1715,9 @@ bool OdfOutput::writeTree(Writer &couts, Writer &souts, double iwidth = img->width.value; double iheight = img->height.value; - Geom::Rect ibbox(Geom::Point(ix, iy), Geom::Point(ix+iwidth, iy+iheight)); - ibbox = ibbox * tf; - ix = ibbox.min()[Geom::X]; - iy = ibbox.min()[Geom::Y]; + Geom::Point ibbox_min = Geom::Point(ix, iy) * tf; + ix = ibbox_min.x(); + iy = ibbox_min.y(); iwidth = xscale * iwidth; iheight = yscale * iheight; |
