Class PNGInfo

java.lang.Object
sec.web.renderer.utilities.PNGInfo

public class PNGInfo extends Object
Author:
michael.spinelli
  • Constructor Details

  • Method Details

    • getCenterPoint

      public Point2D 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

      public Rectangle2D getSymbolBounds()
      minimum bounding rectangle for the core symbol. Does not include modifiers, display or otherwise.
      Returns:
    • getImage

      public BufferedImage getImage()
    • getImageAsByteArray

      public byte[] getImageAsByteArray()
      returns the image as a byte[] representing a PNG.
      Returns:
    • saveImageToFile

      public Boolean saveImageToFile(String filePath)
      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

      public PNGInfo centerImage()
      Takes an image and a center point and generates a new, bigger image that has the symbol centered in it
      Returns:
    • squareImage

      public PNGInfo squareImage()
      Returns an image with empty space as needed to make sure the size represents a square.
      Returns:
    • fitImage

      public PNGInfo fitImage(int eWidth, int eHeight, int ecX, int ecY, int buffer)
      Parameters:
      eWidth -
      eHeight -
      buffer -
      Returns:
    • toSVG

      public String toSVG(int drawMode)
      Parameters:
      drawMode - 0 - normal, 1 - center, 2 - square
      Returns: