|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.poi.xslf.usermodel.XSLFImageRenderer
@Beta public class XSLFImageRenderer
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:
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;
}
}
and then pass this class to your instance of java.awt.Graphics2D:
graphics.setRenderingHint(XSLFRenderingHint.IMAGE_RENDERER, new MyImageRendener());
Constructor Summary | |
---|---|
XSLFImageRenderer()
|
Method Summary | |
---|---|
boolean |
drawImage(java.awt.Graphics2D graphics,
XSLFPictureData data,
java.awt.geom.Rectangle2D anchor)
Render picture data into the supplied graphics |
boolean |
drawImage(java.awt.Graphics2D graphics,
XSLFPictureData data,
java.awt.geom.Rectangle2D anchor,
java.awt.Insets clip)
Render picture data into the supplied graphics |
java.awt.image.BufferedImage |
readImage(PackagePart packagePart)
Create a buffered image from the supplied package part. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XSLFImageRenderer()
Method Detail |
---|
public boolean drawImage(java.awt.Graphics2D graphics, XSLFPictureData data, java.awt.geom.Rectangle2D anchor)
public boolean drawImage(java.awt.Graphics2D graphics, XSLFPictureData data, java.awt.geom.Rectangle2D anchor, java.awt.Insets clip)
public java.awt.image.BufferedImage readImage(PackagePart packagePart) throws java.io.IOException
BufferedImage
containing the decoded
contents of the input, or null
.
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |