Author: kiwiwings
Date: Wed Aug 5 23:24:13 2015
New Revision: 1694373
URL: http://svn.apache.org/r1694373
Log:
#57786 - XSLFFreeformShape ignores quadratic bezier curves
Modified:
poi/site/src/documentation/content/xdocs/status.xml
poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFFreeformShape.java
Modified: poi/site/src/documentation/content/xdocs/status.xml
URL:
http://svn.apache.org/viewvc/poi/site/src/documentation/content/xdocs/status.xml?rev=1694373&r1=1694372&r2=1694373&view=diff
==============================================================================
--- poi/site/src/documentation/content/xdocs/status.xml (original)
+++ poi/site/src/documentation/content/xdocs/status.xml Wed Aug 5 23:24:13 2015
@@ -39,6 +39,7 @@
</devs>
<release version="3.13-beta2" date="2015-10-??">
+ <action dev="PD" type="fix" fixes-bug="57786">XSLFFreeformShape
ignores quadratic bezier curves</action>
<action dev="PD" type="fix" fixes-bug="58206">provide a mechanism to
find slide layouts by name</action>
<action dev="PD" type="fix" fixes-bug="58204">STYLE: ShapeContainer
interface makes internal getShapesList() redundant</action>
<action dev="PD" type="add" fixes-bug="58190">The current picture
handling uses raw integers for types and index, replace with enum and
reference</action>
Modified:
poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFFreeformShape.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFFreeformShape.java?rev=1694373&r1=1694372&r2=1694373&view=diff
==============================================================================
---
poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFFreeformShape.java
(original)
+++
poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFFreeformShape.java
Wed Aug 5 23:24:13 2015
@@ -37,6 +37,7 @@ import org.openxmlformats.schemas.drawin
import org.openxmlformats.schemas.drawingml.x2006.main.CTPath2DCubicBezierTo;
import org.openxmlformats.schemas.drawingml.x2006.main.CTPath2DLineTo;
import org.openxmlformats.schemas.drawingml.x2006.main.CTPath2DMoveTo;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTPath2DQuadBezierTo;
import org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties;
import org.openxmlformats.schemas.presentationml.x2006.main.CTShape;
import org.openxmlformats.schemas.presentationml.x2006.main.CTShapeNonVisual;
@@ -81,6 +82,16 @@ public class XSLFFreeformShape extends X
ln.setY(Units.toEMU(vals[1]) - y0);
numPoints++;
break;
+ case PathIterator.SEG_QUADTO:
+ CTPath2DQuadBezierTo qbez = ctPath.addNewQuadBezTo();
+ CTAdjPoint2D qp1 = qbez.addNewPt();
+ qp1.setX(Units.toEMU(vals[0]) - x0);
+ qp1.setY(Units.toEMU(vals[1]) - y0);
+ CTAdjPoint2D qp2 = qbez.addNewPt();
+ qp2.setX(Units.toEMU(vals[2]) - x0);
+ qp2.setY(Units.toEMU(vals[3]) - y0);
+ numPoints += 2;
+ break;
case PathIterator.SEG_CUBICTO:
CTPath2DCubicBezierTo bez = ctPath.addNewCubicBezTo();
CTAdjPoint2D p1 = bez.addNewPt();
@@ -126,6 +137,15 @@ public class XSLFFreeformShape extends X
CTAdjPoint2D pt = ((CTPath2DLineTo)ch).getPt();
path.lineTo((float)Units.toPoints((Long)pt.getX()),
(float)Units.toPoints((Long)pt.getY()));
+ } else if (ch instanceof CTPath2DQuadBezierTo){
+ CTPath2DQuadBezierTo bez = ((CTPath2DQuadBezierTo)ch);
+ CTAdjPoint2D pt1 = bez.getPtArray(0);
+ CTAdjPoint2D pt2 = bez.getPtArray(1);
+ path.quadTo(
+ (float) (Units.toPoints((Long) pt1.getX()) *
scaleW),
+ (float) (Units.toPoints((Long) pt1.getY()) *
scaleH),
+ (float) (Units.toPoints((Long) pt2.getX()) *
scaleW),
+ (float) (Units.toPoints((Long) pt2.getY()) *
scaleH));
} else if (ch instanceof CTPath2DCubicBezierTo){
CTPath2DCubicBezierTo bez = ((CTPath2DCubicBezierTo)ch);
CTAdjPoint2D pt1 = bez.getPtArray(0);
@@ -137,8 +157,7 @@ public class XSLFFreeformShape extends X
(float) (Units.toPoints((Long) pt2.getX()) *
scaleW),
(float) (Units.toPoints((Long) pt2.getY()) *
scaleH),
(float) (Units.toPoints((Long) pt3.getX()) *
scaleW),
- (float) (Units.toPoints((Long) pt3.getY()) *
scaleH) );
-
+ (float) (Units.toPoints((Long) pt3.getY()) *
scaleH));
} else if (ch instanceof CTPath2DClose){
path.closePath();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]