public class ImageRendererAdapter extends Object implements ImageRenderer
ImageRenderer
and override only the
methods of interest.Constructor and Description |
---|
ImageRendererAdapter() |
Modifier and Type | Method and Description |
---|---|
Image |
createImage(byte[] data,
URL baseURL,
double width,
SizeType widthType,
double height,
SizeType heightType,
boolean preserveAspectRatio,
boolean smooth)
Renders specified image data.
|
Image |
createImage(Element element,
double width,
SizeType widthType,
double height,
SizeType heightType,
boolean preserveAspectRatio,
boolean smooth)
Renders specified tree of XML nodes.
|
Image |
createImage(URL url,
double width,
SizeType widthType,
double height,
SizeType heightType,
boolean preserveAspectRatio,
boolean smooth)
Renders specified graphics file.
|
int[] |
getImageSize(byte[] data,
URL baseURL)
Returns the intrinsic dimension of the image contained in
specified image data, preferably without fully loading the image.
|
int[] |
getImageSize(Element element)
Returns the intrinsic dimension of the image contained in
specified tree of XML nodes, preferably without fully loading the image.
|
int[] |
getImageSize(URL url)
Returns the intrinsic dimension of the image contained in
specified graphics file, preferably without fully loading the image.
|
public Image createImage(URL url, double width, SizeType widthType, double height, SizeType heightType, boolean preserveAspectRatio, boolean smooth) throws Exception
null
(don't know how to render
specified URL).createImage
in interface ImageRenderer
url
- specifies the graphics filewidth
- specifies a width value which is interpreted using
widthTypewidthType
- specifies how to interpret widthheight
- specifies a height value which is interpreted using
heighTypeheightType
- specifies how to interpret heightpreserveAspectRatio
- if true
and if image is to be
fit in a rectangle (widthType and heightType are both
SizeType.FIT
or SizeType.MAX
), preserve its
aspect ratio. In all other cases, this argument is ignored
(rationale: how to preserve the aspect ratio if first 4 arguments are
100px, 200px and the intrinsic size of the image is 32x32?)smooth
- if true
and if image is to be rescaled,
favor quality over speedException
- if, for any reason, the image cannot be created
(do not return null
!)public Image createImage(byte[] data, URL baseURL, double width, SizeType widthType, double height, SizeType heightType, boolean preserveAspectRatio, boolean smooth) throws Exception
null
(don't know how to render
specified data).createImage
in interface ImageRenderer
data
- specifies the image databaseURL
- used to resolve relative URLs possibly found in
datawidth
- specifies a width value which is interpreted using
widthTypewidthType
- specifies how to interpret widthheight
- specifies a height value which is interpreted using
heighTypeheightType
- specifies how to interpret heightpreserveAspectRatio
- if true
and if image is to be
fit in a rectangle (widthType and heightType are both
SizeType.FIT
or SizeType.MAX
), preserve its
aspect ratio. In all other cases, this argument is ignored
(rationale: how to preserve the aspect ratio if first 4 arguments are
100px, 200px and the intrinsic size of the image is 32x32?)smooth
- if true
and if image is to be rescaled,
favor quality over speedException
- if, for any reason, the image cannot be created
(do not return null
!)public Image createImage(Element element, double width, SizeType widthType, double height, SizeType heightType, boolean preserveAspectRatio, boolean smooth) throws Exception
null
(don't know how to render
specified element).createImage
in interface ImageRenderer
element
- specifies the XML treewidth
- specifies a width value which is interpreted using
widthTypewidthType
- specifies how to interpret widthheight
- specifies a height value which is interpreted using
heighTypeheightType
- specifies how to interpret heightpreserveAspectRatio
- if true
and if image is to be
fit in a rectangle (widthType and heightType are both
SizeType.FIT
or SizeType.MAX
), preserve its
aspect ratio. In all other cases, this argument is ignored
(rationale: how to preserve the aspect ratio if first 4 arguments are
100px, 200px and the intrinsic size of the image is 32x32?)smooth
- if true
and if image is to be rescaled,
favor quality over speedException
- if, for any reason, the image cannot be created
(do not return null
!)public int[] getImageSize(URL url) throws Exception
getImageSize
in interface ImageRenderer
url
- specifies the graphics filenull
.
First element of the return array is the image width and the second
is the image height.Exception
- if, for any reason, the image dimension
cannot be determinedpublic int[] getImageSize(byte[] data, URL baseURL) throws Exception
getImageSize
in interface ImageRenderer
data
- specifies the image databaseURL
- used to resolve relative URLs possibly found in
datanull
.
First element of the return array is the image width and the second
is the image height.Exception
- if, for any reason, the image dimension
cannot be determinedpublic int[] getImageSize(Element element) throws Exception
getImageSize
in interface ImageRenderer
element
- specifies the XML treenull
.
First element of the return array is the image width and the second
is the image height.Exception
- if, for any reason, the image dimension
cannot be determined