public class ImageInfo extends java.lang.Object implements SymbolDimensionInfo
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
FormatJPG |
static java.lang.String |
FormatPNG |
| Modifier | Constructor and Description |
|---|---|
protected |
ImageInfo() |
|
ImageInfo(java.awt.image.BufferedImage image,
int x,
int y)
ImageInfo holds and image and holds the position at which the image
should be drawn.
|
|
ImageInfo(java.awt.image.BufferedImage image,
int x,
int y,
int symbolCenterX,
int symbolCenterY)
Deprecated.
|
|
ImageInfo(java.awt.image.BufferedImage image,
int x,
int y,
int symbolCenterX,
int symbolCenterY,
java.awt.geom.Rectangle2D symbolBounds)
ImageInfo holds and image and holds the position at which the image
should be drawn.
|
|
ImageInfo(java.awt.image.BufferedImage bi,
java.awt.geom.Point2D centerPoint,
java.awt.geom.Rectangle2D symbolBounds)
Creates a new ImageInfo object
|
| Modifier and Type | Method and Description |
|---|---|
static java.lang.Boolean |
CanWriteImageFormat(java.lang.String format)
Determines if you can write your desired format.
|
static java.awt.image.BufferedImage |
CenterImageOnPoint(java.awt.image.BufferedImage image,
java.awt.geom.Point2D point)
Takes an image and a center point and generates a new, bigger image
that has the symbol centered in it
|
java.awt.image.BufferedImage |
getImage()
The BufferedImage
|
byte[] |
getImageAsByteArray()
returns the image as a byte[] representing a PNG.
|
byte[] |
getImageAsByteArrayWithMetaInfo()
Unlike SaveImageToFile, this only writes to PNGs and it includes
positional metadata in the PNG.
|
java.awt.geom.Rectangle2D |
getImageBounds()
Dimension of the entire image.
|
java.awt.Point |
getPoint()
position of where the image should be drawn
|
static java.awt.image.BufferedImage |
getScaledInstance(java.awt.image.BufferedImage srcImage,
int targetWidth,
int targetHeight,
java.lang.Object hint,
boolean higherQuality,
boolean keepProportion)
Convenience method that returns a scaled instance of the
provided
BufferedImage. |
ImageInfo |
getSquareImageInfo()
Adds padding as needed to make the image a nice square.
|
java.awt.geom.Rectangle2D |
getSymbolBounds()
minimum bounding rectangle for the core symbol.
|
java.awt.Point |
getSymbolCenterPoint()
The point the image should be centered on or the "anchor point".
|
int |
getSymbolCenterX()
The x value the image should be centered on or the "anchor point".
|
int |
getSymbolCenterY()
The y value the image should be centered on or the "anchor point".
|
int |
getX()
X position of where the image should be drawn
|
int |
getY()
Y position of where the image should be drawn
|
java.lang.Boolean |
SaveImageToFile(java.lang.String filePath,
java.lang.String imageFormat)
Save image to a file as a PNG or JPG
|
java.lang.Boolean |
SaveImageToPNG(javax.imageio.stream.ImageOutputStream ios)
Unlike SaveImageToFile, this only writes to PNGs and it includes
positional metadata in the PNG.
|
public static final java.lang.String FormatPNG
public static final java.lang.String FormatJPG
protected ImageInfo()
public ImageInfo(java.awt.image.BufferedImage image,
int x,
int y)
image - BufferedImagex - position of where the image should be drawny - position of where the image should be drawnpublic ImageInfo(java.awt.image.BufferedImage bi,
java.awt.geom.Point2D centerPoint,
java.awt.geom.Rectangle2D symbolBounds)
bi - BufferedImagecenterPoint - can also be the anchor point of the symbol if it isn't the center of the image (action point)symbolBounds - Rectangle2Dpublic ImageInfo(java.awt.image.BufferedImage image,
int x,
int y,
int symbolCenterX,
int symbolCenterY)
image - BufferedImagex - position of where the image should be drawny - position of where the image should be drawnsymbolCenterX - center point of image may be different from the center
point of the symbol within the image. (single point graphics)symbolCenterY - center point of image may be different from the center
point of the symbol within the image. (single point graphics)public ImageInfo(java.awt.image.BufferedImage image,
int x,
int y,
int symbolCenterX,
int symbolCenterY,
java.awt.geom.Rectangle2D symbolBounds)
image - BufferedImagex - position of where the image should be drawny - position of where the image should be drawnsymbolCenterX - center point of image may be different center
point of the symbol within the image. (single point graphics)symbolCenterY - center point of image may be different center
point of the symbol within the image. (single point graphics)symbolBounds - minimum bounding rectangle for the core symbol. Does
not include modifiers, display or otherwise.public java.awt.image.BufferedImage getImage()
public int getX()
Integerpublic int getY()
Integerpublic java.awt.Point getPoint()
Pointpublic int getSymbolCenterX()
getSymbolCenterX in interface SymbolDimensionInfoIntegerpublic int getSymbolCenterY()
getSymbolCenterY in interface SymbolDimensionInfoIntegerpublic java.awt.Point getSymbolCenterPoint()
getSymbolCenterPoint in interface SymbolDimensionInfoPointpublic java.awt.geom.Rectangle2D getSymbolBounds()
getSymbolBounds in interface SymbolDimensionInfoRectangle2Dpublic java.awt.geom.Rectangle2D getImageBounds()
getImageBounds in interface SymbolDimensionInfoRectangle2Dpublic java.lang.Boolean SaveImageToFile(java.lang.String filePath,
java.lang.String imageFormat)
filePath - full path to the fileimageFormat - "jpg" or "png"public java.lang.Boolean SaveImageToPNG(javax.imageio.stream.ImageOutputStream ios)
ios - full path to the file. Usage Like FileOutputStream out =
new FileOutputStream(filePath);
SaveImageToPNG(ImageIO.createImageOutputStream(out));
OR
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
SaveImageToPNG(ImageIO.createImageOutputStream(bytes));
ImageOutputStream is closed before SaveImageToPNG exits.
Don't forget to close the streams when done.public byte[] getImageAsByteArray()
byte[]public byte[] getImageAsByteArrayWithMetaInfo()
byte[]public static java.awt.image.BufferedImage CenterImageOnPoint(java.awt.image.BufferedImage image,
java.awt.geom.Point2D point)
image - BufferedImagepoint - Point2DBufferedImagepublic static java.lang.Boolean CanWriteImageFormat(java.lang.String format)
format - "png", "jpg", "gif", etc...public static java.awt.image.BufferedImage getScaledInstance(java.awt.image.BufferedImage srcImage,
int targetWidth,
int targetHeight,
java.lang.Object hint,
boolean higherQuality,
boolean keepProportion)
BufferedImage. NEEDS WORK.
Alternate option is getScaledInstance off of the BufferedImage object.srcImage - The image to be scaled.targetWidth - the desired width of the scaled instance,
in pixelstargetHeight - the desired height of the scaled instance,
in pixelshint - one of the rendering hints that corresponds to
RenderingHints.KEY_INTERPOLATION (e.g.
RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR,
RenderingHints.VALUE_INTERPOLATION_BILINEAR,
RenderingHints.VALUE_INTERPOLATION_BICUBIC)higherQuality - if true, this method will use a multi-step
scaling technique that provides higher quality than the usual
one-step technique (only useful in downscaling cases, where
targetWidth or targetHeight is
smaller than the original dimensions, and generally only when
the BILINEAR hint is specified). NEEDS WORK.keepProportion - Don't stretch the original image to fit into the
target height/width.BufferedImage