ASF Bugzilla – Attachment 30902 Details for
Bug 53176
[PATCH] Auto shapes render problem in pptx files
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
[patch] Bug 53176 - scale to bounding box after/in XSLFShape.applyTransform
bug53176-bbox-resize.diff (text/plain), 2.82 KB, created by
Andreas Beeker
on 2013-10-02 22:01:33 UTC
(
hide
)
Description:
[patch] Bug 53176 - scale to bounding box after/in XSLFShape.applyTransform
Filename:
MIME Type:
Creator:
Andreas Beeker
Created:
2013-10-02 22:01:33 UTC
Size:
2.82 KB
patch
obsolete
>Index: src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShape.java >=================================================================== >--- src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShape.java (revision 1528637) >+++ src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShape.java (working copy) >@@ -137,16 +137,23 @@ > anchor = tx.createTransformedShape(anchor).getBounds2D(); > } > >+ // PowerPoint rotates shapes relative to the geometric center >+ double centerX = anchor.getCenterX(); >+ double centerY = anchor.getCenterY(); >+ >+ AffineTransform txs = new AffineTransform(tx); >+ Rectangle2D anchor1 = graphics.getTransform().createTransformedShape(anchor).getBounds2D(); >+ > // rotation > double rotation = getRotation(); > if (rotation != 0.) { >- // PowerPoint rotates shapes relative to the geometric center >- double centerX = anchor.getX() + anchor.getWidth() / 2; >- double centerY = anchor.getY() + anchor.getHeight() / 2; >- > graphics.translate(centerX, centerY); > graphics.rotate(Math.toRadians(rotation)); > graphics.translate(-centerX, -centerY); >+ >+ txs.translate(centerX, centerY); >+ txs.rotate(Math.toRadians(rotation)); >+ txs.translate(-centerX, -centerY); > } > > //flip horizontal >@@ -154,6 +161,10 @@ > graphics.translate(anchor.getX() + anchor.getWidth(), anchor.getY()); > graphics.scale(-1, 1); > graphics.translate(-anchor.getX(), -anchor.getY()); >+ >+ txs.translate(anchor.getX() + anchor.getWidth(), anchor.getY()); >+ txs.scale(-1, 1); >+ txs.translate(-anchor.getX(), -anchor.getY()); > } > > //flip vertical >@@ -161,7 +172,22 @@ > graphics.translate(anchor.getX(), anchor.getY() + anchor.getHeight()); > graphics.scale(1, -1); > graphics.translate(-anchor.getX(), -anchor.getY()); >+ >+ txs.translate(anchor.getX(), anchor.getY() + anchor.getHeight()); >+ txs.scale(1, -1); >+ txs.translate(-anchor.getX(), -anchor.getY()); > } >+ >+ // scale to bounding box (bug #53176) >+ Rectangle2D anchor2 = txs.createTransformedShape(getAnchor()).getBounds2D(); >+ anchor2 = graphics.getTransform().createTransformedShape(anchor2).getBounds2D(); >+ >+ double scaleX2 = anchor1.getWidth() == 0. ? 1.0 : anchor2.getWidth() / anchor1.getWidth(); >+ double scaleY2 = anchor1.getHeight() == 0. ? 1.0 : anchor2.getHeight() / anchor1.getHeight(); >+ >+ graphics.translate(centerX, centerY); >+ graphics.scale(scaleX2, scaleY2); >+ graphics.translate(-centerX, -centerY); > } > > /**
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 53176
:
28707
|
28716
|
30902
|
30919