java.lang.Object
dev.prozilla.pine.common.asset.image.Image
All Implemented Interfaces:
Asset, Cloneable<Image>, Destructible

public class Image extends Object implements Asset, Cloneable<Image>
Represents an STB image with a width and a height.
  • Field Details

    • id

      public final int id
  • Constructor Details

    • Image

      public Image(String path, ByteBuffer pixels, int width, int height, int channels)
  • Method Details

    • getFlippedImage

      public ByteBuffer getFlippedImage()
    • getPremultipliedImage

      public ByteBuffer getPremultipliedImage()
    • getPixels

      public ByteBuffer getPixels()
    • getWidth

      public int getWidth()
    • getHeight

      public int getHeight()
    • getChannels

      public int getChannels()
    • getPath

      public String getPath()
      Description copied from interface: Asset
      Returns the path to the file this asset was loaded from.
      Specified by:
      getPath in interface Asset
      Returns:
      The path of this asset.
    • destroy

      public void destroy()
      Description copied from interface: Asset
      Removes this asset from the asset pool and deletes it.
      Specified by:
      destroy in interface Asset
      Specified by:
      destroy in interface Destructible
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object
    • equals

      public boolean equals(Image image)
      Description copied from interface: Cloneable
      Checks if the given object is equal to this object.
      Specified by:
      equals in interface Cloneable<Image>
      Parameters:
      image - Other object
      Returns:
      true if both objects are equal.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • clone

      public Image clone()
      Description copied from interface: Cloneable
      Returns a new object that is equal to this object.
      Specified by:
      clone in interface Cloneable<Image>
      Overrides:
      clone in class Object
      Returns:
      Clone of this object
    • toGLFWImage

      public GLFWImage toGLFWImage()
    • premultiplyAlpha

      public static ByteBuffer premultiplyAlpha(ByteBuffer image, int width, int height, int channels)
    • flipImageVertically

      public static ByteBuffer flipImageVertically(ByteBuffer image, int width, int height, int channels)