Class UnityImage


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

      • 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 -
      • 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()