java.lang.Object
dev.prozilla.pine.common.system.resource.image.Image
All Implemented Interfaces:
Lifecycle, Resource

public class Image extends Object implements Resource, Lifecycle
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()
      Specified by:
      getPath in interface Resource
      Returns:
      The path to the file this resource was loaded from
    • destroy

      public void destroy()
      Description copied from interface: Resource
      Removes this resource from the resource pool and deletes it.
      Specified by:
      destroy in interface Lifecycle
      Specified by:
      destroy in interface Resource
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class 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)