diff options
author | Andreas Beeker <kiwiwings@apache.org> | 2016-02-29 23:59:49 +0000 |
---|---|---|
committer | Andreas Beeker <kiwiwings@apache.org> | 2016-02-29 23:59:49 +0000 |
commit | 0423fae3b70d4db3d5121ffdf3992ed61af9eff0 (patch) | |
tree | bba3d70f61d257b78577eefd22a80a4081822cbb /src/scratchpad/testcases/org/apache/poi/hslf/usermodel | |
parent | 64e855f4ca643116e285f2f5891efbe0c194375d (diff) | |
download | poi-0423fae3b70d4db3d5121ffdf3992ed61af9eff0.tar.gz poi-0423fae3b70d4db3d5121ffdf3992ed61af9eff0.zip |
#59056 - Render individual slideshow shapes
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1732974 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/scratchpad/testcases/org/apache/poi/hslf/usermodel')
-rw-r--r-- | src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java | 24 | ||||
-rw-r--r-- | src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestPicture.java | 4 |
2 files changed, 27 insertions, 1 deletions
diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java index e3b2683e53..612c714810 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java @@ -24,6 +24,9 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.geom.Rectangle2D; +import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.io.OutputStream; @@ -52,6 +55,7 @@ import org.apache.poi.hslf.record.SlideListWithText; import org.apache.poi.hslf.record.SlideListWithText.SlideAtomsSet; import org.apache.poi.hslf.record.TextHeaderAtom; import org.apache.poi.hssf.usermodel.DummyGraphics2d; +import org.apache.poi.sl.draw.DrawFactory; import org.apache.poi.sl.draw.DrawPaint; import org.apache.poi.sl.draw.DrawTextParagraph; import org.apache.poi.sl.usermodel.PaintStyle; @@ -879,6 +883,26 @@ public final class TestBugs { ppt.close(); } + + @Test + public void bug59056() throws IOException { + HSLFSlideShow ppt = open("54541_cropped_bitmap.ppt"); + + for (HSLFShape shape : ppt.getSlides().get(0).getShapes()) { + BufferedImage img = new BufferedImage(500, 300, BufferedImage.TYPE_INT_ARGB); + Graphics2D graphics = img.createGraphics(); + Rectangle2D box = new Rectangle2D.Double(50,50,300,100); + graphics.setPaint(Color.red); + graphics.fill(box); + box = new Rectangle2D.Double(box.getX()+1,box.getY()+1,box.getWidth()-2,box.getHeight()-2); + DrawFactory.getInstance(graphics).drawShape(graphics, shape, box); + graphics.dispose(); + // ImageIO.write(img, "png", new File("bla"+shape.getShapeId()+".png")); + } + + ppt.close(); + + } private static HSLFSlideShow open(String fileName) throws IOException { File sample = HSLFTestDataSamples.getSampleFile(fileName); diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestPicture.java b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestPicture.java index 08d6c64211..7a7a7b452d 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestPicture.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestPicture.java @@ -27,6 +27,7 @@ import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Rectangle; +import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; import java.io.File; @@ -106,13 +107,14 @@ public final class TestPicture { HSLFPictureData pd = HSLFPictureData.create(PictureType.PNG); HSLFPictureShape pict = new HSLFPictureShape(pd); //index to non-existing picture data + pict.setAnchor(new Rectangle2D.Double(50,50,100,100)); pict.setSheet(slide); HSLFPictureData data = pict.getPictureData(); assertNull(data); BufferedImage img = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB); Graphics2D graphics = img.createGraphics(); - pict.draw(graphics); + pict.draw(graphics, null); ppt.close(); } |