Package org.apache.poi.sl.draw
Class BitmapImageRenderer
java.lang.Object
org.apache.poi.sl.draw.BitmapImageRenderer
- All Implemented Interfaces:
ImageRenderer
For now this class renders only images supported by the javax.imageio.ImageIO framework.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermines if this image renderer implementation supports the given contentTypebooleandrawImage(Graphics2D graphics, Rectangle2D anchor) Render picture data into the supplied graphicsbooleandrawImage(Graphics2D graphics, Rectangle2D anchor, Insets clip) Render picture data into the supplied graphicsbyte[]getImage()getImage(Dimension2D dim) voidLoad and buffer the imagevoidloadImage(InputStream data, String contentType) Load and buffer the imagevoidsetAlpha(double alpha) static BufferedImagesetAlpha(BufferedImage image, double alpha) voidsetCacheInput(boolean enable) Dis-/Enables caching of input data for later retrieval.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.poi.sl.draw.ImageRenderer
getDimension, getGenericRecord, setDefaultCharset
-
Constructor Details
-
BitmapImageRenderer
public BitmapImageRenderer()
-
-
Method Details
-
canRender
Description copied from interface:ImageRendererDetermines if this image renderer implementation supports the given contentType- Specified by:
canRenderin interfaceImageRenderer- Parameters:
contentType- the image content type- Returns:
- if the content type is supported
-
loadImage
Description copied from interface:ImageRendererLoad and buffer the image- Specified by:
loadImagein interfaceImageRenderer- Parameters:
data- the raw image streamcontentType- the content type- Throws:
IOException
-
loadImage
Description copied from interface:ImageRendererLoad and buffer the image- Specified by:
loadImagein interfaceImageRenderer- Parameters:
data- the raw image bytescontentType- the content type- Throws:
IOException
-
getImage
- Specified by:
getImagein interfaceImageRenderer- Returns:
- the image as buffered image or null if image could not be loaded
-
getImage
- Specified by:
getImagein interfaceImageRenderer- Parameters:
dim- the dimension in pixels of the returned image- Returns:
- the image as buffered image or null if image could not be loaded
-
getBounds
- Specified by:
getBoundsin interfaceImageRenderer- Returns:
- the bounds of the buffered image in pixel
-
setAlpha
public void setAlpha(double alpha) - Specified by:
setAlphain interfaceImageRenderer- Parameters:
alpha- the alpha [0..1] to be added to the image (possibly already containing an alpha channel)
-
setAlpha
-
drawImage
Description copied from interface:ImageRendererRender picture data into the supplied graphics- Specified by:
drawImagein interfaceImageRenderer- Returns:
- true if the picture data was successfully rendered
-
drawImage
Description copied from interface:ImageRendererRender picture data into the supplied graphics- Specified by:
drawImagein interfaceImageRenderer- Returns:
- true if the picture data was successfully rendered
-
getNativeBounds
- Specified by:
getNativeBoundsin interfaceImageRenderer- Returns:
- the format-specific / not-normalized bounds of the image
-
setCacheInput
public void setCacheInput(boolean enable) Description copied from interface:ImageRendererDis-/Enables caching of input data for later retrieval. Opposed toImageRenderer.getImage(), which returns aBufferedImage, the cached image can be later used to embedded the original, unmodified data- Specified by:
setCacheInputin interfaceImageRenderer- Parameters:
enable- dis-/enables caching - this is an optional operation.falseremoves already cached data
-
getCachedImage
public byte[] getCachedImage()- Specified by:
getCachedImagein interfaceImageRenderer- Returns:
- the cached image data
-
getCachedContentType
- Specified by:
getCachedContentTypein interfaceImageRenderer- Returns:
- the cached content type
-