Class UnityImage

java.lang.Object
pl.edu.icm.unity.attr.UnityImage

public class UnityImage extends Object
Class providing Image related information and operations. Currently supports JPG, GIF and PNG image types.
Author:
R. Ledzinski
  • Constructor Details

  • Method Details

    • getImage

      public byte[] getImage()
    • getScaledDownImage

      public byte[] getScaledDownImage(int maxWidth, int maxHeight)
      Recreate the image to match given maximum width and height keeping current aspect ratio. If image already fits the size no action in taken. Method returns new byte array - current object is not modified.
      Parameters:
      maxWidth -
      maxHeight -
    • getBufferedImage

      public BufferedImage getBufferedImage()
    • getType

      public ImageType getType()
    • getWidth

      public int getWidth()
    • getHeight

      public int getHeight()
    • setImage

      public void setImage(byte[] image, ImageType type)
      Updates object's fields, if given buffer contains data that may be converted to image. If not possible to convert object remains unchanged.
      Parameters:
      image - Byte array containing image data.
    • scaleDown

      public void scaleDown(int maxWidth, int maxHeight)
      Recreate the image to match given maximum width and height keeping current aspect ratio. If image already fits the size no action in taken.
      Parameters:
      maxWidth -
      maxHeight -
    • serialize

      public String serialize()
    • deserialize

      public void deserialize(String stringRepresentation) throws IOException
      Throws:
      IOException