org.apache.poi.sl.draw
Class BitmapImageRenderer

java.lang.Object
  extended by org.apache.poi.sl.draw.BitmapImageRenderer
All Implemented Interfaces:
ImageRenderer

public class BitmapImageRenderer
extends java.lang.Object
implements ImageRenderer

For now this class renders only images supported by the javax.imageio.ImageIO framework.


Field Summary
protected  java.awt.image.BufferedImage img
           
 
Constructor Summary
BitmapImageRenderer()
           
 
Method Summary
 boolean drawImage(java.awt.Graphics2D graphics, java.awt.geom.Rectangle2D anchor)
          Render picture data into the supplied graphics
 boolean drawImage(java.awt.Graphics2D graphics, java.awt.geom.Rectangle2D anchor, java.awt.Insets clip)
          Render picture data into the supplied graphics
 java.awt.Dimension getDimension()
           
 java.awt.image.BufferedImage getImage()
           
 java.awt.image.BufferedImage getImage(java.awt.Dimension dim)
           
 void loadImage(byte[] data, java.lang.String contentType)
          Load and buffer the image
 void loadImage(java.io.InputStream data, java.lang.String contentType)
          Load and buffer the image
 void setAlpha(double alpha)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

img

protected java.awt.image.BufferedImage img
Constructor Detail

BitmapImageRenderer

public BitmapImageRenderer()
Method Detail

loadImage

public void loadImage(java.io.InputStream data,
                      java.lang.String contentType)
               throws java.io.IOException
Description copied from interface: ImageRenderer
Load and buffer the image

Specified by:
loadImage in interface ImageRenderer
Parameters:
data - the raw image stream
contentType - the content type
Throws:
java.io.IOException

loadImage

public void loadImage(byte[] data,
                      java.lang.String contentType)
               throws java.io.IOException
Description copied from interface: ImageRenderer
Load and buffer the image

Specified by:
loadImage in interface ImageRenderer
Parameters:
data - the raw image bytes
contentType - the content type
Throws:
java.io.IOException

getImage

public java.awt.image.BufferedImage getImage()
Specified by:
getImage in interface ImageRenderer
Returns:
the image as buffered image

getImage

public java.awt.image.BufferedImage getImage(java.awt.Dimension dim)
Specified by:
getImage in interface ImageRenderer
Parameters:
dim - the dimension in pixels of the returned image
Returns:
the image as buffered image

getDimension

public java.awt.Dimension getDimension()
Specified by:
getDimension in interface ImageRenderer
Returns:
the dimension of the buffered image

setAlpha

public void setAlpha(double alpha)
Specified by:
setAlpha in interface ImageRenderer
Parameters:
alpha - the alpha [0..1] to be added to the image (possibly already containing an alpha channel)

drawImage

public boolean drawImage(java.awt.Graphics2D graphics,
                         java.awt.geom.Rectangle2D anchor)
Description copied from interface: ImageRenderer
Render picture data into the supplied graphics

Specified by:
drawImage in interface ImageRenderer
Returns:
true if the picture data was successfully rendered

drawImage

public boolean drawImage(java.awt.Graphics2D graphics,
                         java.awt.geom.Rectangle2D anchor,
                         java.awt.Insets clip)
Description copied from interface: ImageRenderer
Render picture data into the supplied graphics

Specified by:
drawImage in interface ImageRenderer
Returns:
true if the picture data was successfully rendered