Package org.apache.poi.hwmf.draw
Class HwmfImageRenderer
java.lang.Object
org.apache.poi.hwmf.draw.HwmfImageRenderer
- All Implemented Interfaces:
EmbeddedExtractor
,ImageRenderer
Helper class which is instantiated by
DrawPictureShape
via reflection-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.poi.sl.draw.EmbeddedExtractor
EmbeddedExtractor.EmbeddedPart
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Determines if this image renderer implementation supports the given contentTypeboolean
drawImage
(Graphics2D graphics, Rectangle2D anchor) Render picture data into the supplied graphicsboolean
drawImage
(Graphics2D graphics, Rectangle2D anchor, Insets clip) Render picture data into the supplied graphicsgetEmbeddings
(Iterable<HwmfEmbedded> embs) getImage()
getImage
(Dimension2D dim) static Rectangle2D
getOuterBounds
(Rectangle2D anchor, Insets clip) void
Load and buffer the imagevoid
loadImage
(InputStream data, String contentType) Load and buffer the imagevoid
setAlpha
(double alpha) void
setDefaultCharset
(Charset defaultCharset) Sets the default charset to render text elements.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.poi.sl.draw.ImageRenderer
getCachedContentType, getCachedImage, setCacheInput
-
Constructor Details
-
HwmfImageRenderer
public HwmfImageRenderer()
-
-
Method Details
-
canRender
Description copied from interface:ImageRenderer
Determines if this image renderer implementation supports the given contentType- Specified by:
canRender
in interfaceImageRenderer
- Parameters:
contentType
- the image content type- Returns:
- if the content type is supported
-
loadImage
Description copied from interface:ImageRenderer
Load and buffer the image- Specified by:
loadImage
in interfaceImageRenderer
- Parameters:
data
- the raw image streamcontentType
- the content type- Throws:
IOException
-
loadImage
Description copied from interface:ImageRenderer
Load and buffer the image- Specified by:
loadImage
in interfaceImageRenderer
- Parameters:
data
- the raw image bytescontentType
- the content type- Throws:
IOException
-
getDimension
- Specified by:
getDimension
in interfaceImageRenderer
- Returns:
- the dimension of the buffered image in pixel
-
setAlpha
public void setAlpha(double alpha) - Specified by:
setAlpha
in interfaceImageRenderer
- Parameters:
alpha
- the alpha [0..1] to be added to the image (possibly already containing an alpha channel)
-
getImage
- Specified by:
getImage
in interfaceImageRenderer
- Returns:
- the image as buffered image or null if image could not be loaded
-
getImage
- Specified by:
getImage
in 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
-
drawImage
Description copied from interface:ImageRenderer
Render picture data into the supplied graphics- Specified by:
drawImage
in interfaceImageRenderer
- Returns:
- true if the picture data was successfully rendered
-
drawImage
Description copied from interface:ImageRenderer
Render picture data into the supplied graphics- Specified by:
drawImage
in interfaceImageRenderer
- Returns:
- true if the picture data was successfully rendered
-
getOuterBounds
-
getGenericRecord
- Specified by:
getGenericRecord
in interfaceImageRenderer
-
getEmbeddings
- Specified by:
getEmbeddings
in interfaceEmbeddedExtractor
-
getEmbeddings
@Internal public static Iterable<EmbeddedExtractor.EmbeddedPart> getEmbeddings(Iterable<HwmfEmbedded> embs) -
getNativeBounds
- Specified by:
getNativeBounds
in interfaceImageRenderer
- Returns:
- the format-specific / not-normalized bounds of the image
-
getBounds
- Specified by:
getBounds
in interfaceImageRenderer
- Returns:
- the bounds of the buffered image in pixel
-
setDefaultCharset
Description copied from interface:ImageRenderer
Sets the default charset to render text elements. Opposed to other windows libraries in POI this simply defaults to Windows-1252.- Specified by:
setDefaultCharset
in interfaceImageRenderer
- Parameters:
defaultCharset
- the default charset
-