Class WrappedBufferedImage

java.lang.Object
com.iragui.objects.GUIObject
com.iragui.objects.WrappedBufferedImage

public class WrappedBufferedImage extends GUIObject
A GUIObject that wraps a BufferedImage for use with IraGUI.

This class converts Java BufferedImage pixel data into GPU-friendly ByteBuffer objects. It supports both RGB and RGBA formats, and can optionally store directional variants of the same image for sprite animations or rotated rendering.

  • Constructor Details

    • WrappedBufferedImage

      public WrappedBufferedImage(String name, int layer, GUI gui, int x, int y, boolean nearestFilter, boolean rgba, BufferedImage image)
      Creates a new wrapped image without directional variants.
      Parameters:
      name - the name of the object
      layer - the rendering layer
      gui - the parent GUI
      x - the x position of this object
      y - the y position of this object
      nearestFilter - whether to use nearest-neighbor filtering
      rgba - true if the image should be stored with an alpha channel (RGBA)
      image - the BufferedImage to wrap
    • WrappedBufferedImage

      public WrappedBufferedImage(String name, int layer, GUI gui, int x, int y, boolean nearestFilter, boolean rgba, BufferedImage image, boolean directional)
      Creates a new wrapped image with directional variants.
      Parameters:
      name - the name of the object
      layer - the rendering layer
      gui - the parent GUI
      x - the x position of this object
      y - the y position of this object
      nearestFilter - whether to use nearest-neighbor filtering
      rgba - true if the image should be stored with an alpha channel (RGBA)
      image - the BufferedImage to wrap
      directional - whether to generate directional pixel buffers
  • Method Details

    • changeDirection

      public void changeDirection(int direction)
      Changes the active pixel buffer to match the given direction.

      Only works if directional is true. Directions are:

      Parameters:
      direction - the direction index (0–3)
    • getPixelBuffer

      public ByteBuffer getPixelBuffer()
      Returns the main pixel buffer for this image.
      Returns:
      the base ByteBuffer containing pixel data
    • update

      public void update(boolean showFrame)
      Description copied from class: GUIObject
      Update logic called each frame.
      Specified by:
      update in class GUIObject
    • sendKey

      public void sendKey(int key, int action)
      Description copied from class: GUIObject
      Handles key input events.
      Specified by:
      sendKey in class GUIObject
    • sendMousePos

      public void sendMousePos(long window, double xPos, double yPos)
      Description copied from class: GUIObject
      Handles mouse position updates.
      Specified by:
      sendMousePos in class GUIObject
    • sendMouseButton

      public void sendMouseButton(long window, int button, int action, int mods)
      Description copied from class: GUIObject
      Handles mouse button input.
      Specified by:
      sendMouseButton in class GUIObject
    • sendMouseScroll

      public void sendMouseScroll(long window, double xOffset, double yOffset)
      Description copied from class: GUIObject
      Handles mouse scroll input.
      Specified by:
      sendMouseScroll in class GUIObject