Package sec.web.renderer.utilities
Class PNGInfo
java.lang.Object
sec.web.renderer.utilities.PNGInfo
- Author:
- michael.spinelli
-
Constructor Summary
ConstructorsConstructorDescriptionPNGInfo(ISinglePointInfo spi) PNGInfo(ArmyC2.C2SD.Utilities.ImageInfo ii) PNGInfo(BufferedImage image, Point2D centerPoint, Rectangle2D symbolBounds) -
Method Summary
Modifier and TypeMethodDescriptionTakes an image and a center point and generates a new, bigger image that has the symbol centered in itfitImage(int eWidth, int eHeight, int ecX, int ecY, int buffer) Center point of the symbol within the image.getImage()byte[]returns the image as a byte[] representing a PNG.byte[]Unlike SaveImageToFile, this only writes to PNGs and it includes positional metadata in the PNG.minimum bounding rectangle for the core symbol.saveImageToFile(String filePath) Save image to a file as a PNGReturns an image with empty space as needed to make sure the size represents a square.toSVG(int drawMode)
-
Constructor Details
-
PNGInfo
public PNGInfo(ArmyC2.C2SD.Utilities.ImageInfo ii) -
PNGInfo
-
PNGInfo
-
-
Method Details
-
getCenterPoint
Center point of the symbol within the image. With the exception of HQ where the symbol is centered on the bottom of the staff.- Returns:
-
getSymbolBounds
minimum bounding rectangle for the core symbol. Does not include modifiers, display or otherwise.- Returns:
-
getImage
-
getImageAsByteArray
public byte[] getImageAsByteArray()returns the image as a byte[] representing a PNG.- Returns:
-
saveImageToFile
Save image to a file as a PNG- Parameters:
filePath- full path to the file- Returns:
- true on success.
-
getImageAsByteArrayWithMetaInfo
public byte[] getImageAsByteArrayWithMetaInfo()Unlike SaveImageToFile, this only writes to PNGs and it includes positional metadata in the PNG. Entered as tEXtEntry elements of tEXt metadata keywords are "centerPoint" and "bounds". Values formatted as "x=#,y=#" and "x=#,y=#,width=#,height=#" Bounds is the MBR of the symbol and does not include any modifiers.- Parameters:
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.- Returns:
- true on success.
-
centerImage
Takes an image and a center point and generates a new, bigger image that has the symbol centered in it- Returns:
-
squareImage
Returns an image with empty space as needed to make sure the size represents a square.- Returns:
-
fitImage
- Parameters:
eWidth-eHeight-buffer-- Returns:
-
toSVG
- Parameters:
drawMode- 0 - normal, 1 - center, 2 - square- Returns:
-