org.apache.poi.xslf.usermodel
Class XSLFImageRenderer
- java.lang.Object
-
- org.apache.poi.xslf.usermodel.XSLFImageRenderer
-
@Beta public class XSLFImageRenderer extends java.lang.Object
For now this class renders only images supported by the javax.imageio.ImageIO framework. Subclasses can override this class to support other formats, for example, Use Apache batik to render WMF:
and then pass this class to your instance of java.awt.Graphics2D:public class MyImageRendener extends XSLFImageRendener{ public boolean drawImage(Graphics2D graphics, XSLFPictureData data, Rectangle2D anchor){ boolean ok = super.drawImage(graphics, data, anchor); if(!ok){ // see what type of image we are String contentType = data.getPackagePart().getContentType(); if(contentType.equals("image/wmf")){ // use Apache Batik to handle WMF // see http://xmlgraphics.apache.org/batik/ } } return ok; } }graphics.setRenderingHint(XSLFRenderingHint.IMAGE_RENDERER, new MyImageRendener());
-
-
Constructor Summary
Constructors Constructor and Description XSLFImageRenderer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleandrawImage(java.awt.Graphics2D graphics, XSLFPictureData data, java.awt.geom.Rectangle2D anchor)Render picture data into the supplied graphicsbooleandrawImage(java.awt.Graphics2D graphics, XSLFPictureData data, java.awt.geom.Rectangle2D anchor, java.awt.Insets clip)Render picture data into the supplied graphicsjava.awt.image.BufferedImagereadImage(PackagePart packagePart)Create a buffered image from the supplied package part.
-
-
-
Method Detail
-
drawImage
public boolean drawImage(java.awt.Graphics2D graphics, XSLFPictureData data, java.awt.geom.Rectangle2D anchor)Render picture data into the supplied graphics- Returns:
- true if the picture data was successfully rendered
-
drawImage
public boolean drawImage(java.awt.Graphics2D graphics, XSLFPictureData data, java.awt.geom.Rectangle2D anchor, java.awt.Insets clip)Render picture data into the supplied graphics- Returns:
- true if the picture data was successfully rendered
-
readImage
public java.awt.image.BufferedImage readImage(PackagePart packagePart) throws java.io.IOException
Create a buffered image from the supplied package part. This method is called to create texture paints.- Returns:
- a
BufferedImagecontaining the decoded contents of the input, ornull. - Throws:
java.io.IOException
-
-
DataMelt 3.0 © DataMelt by jWork.ORG