Class WrappedBufferedImage
java.lang.Object
com.iragui.objects.GUIObject
com.iragui.objects.WrappedBufferedImage
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.
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionWrappedBufferedImage
(String name, int layer, GUI gui, int x, int y, boolean nearestFilter, boolean rgba, BufferedImage image) Creates a new wrapped image without directional variants.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. -
Method Summary
Modifier and TypeMethodDescriptionvoid
changeDirection
(int direction) Changes the active pixel buffer to match the given direction.Returns the main pixel buffer for this image.void
sendKey
(int key, int action) Handles key input events.void
sendMouseButton
(long window, int button, int action, int mods) Handles mouse button input.void
sendMousePos
(long window, double xPos, double yPos) Handles mouse position updates.void
sendMouseScroll
(long window, double xOffset, double yOffset) Handles mouse scroll input.void
update
(boolean showFrame) Update logic called each frame.Methods inherited from class com.iragui.objects.GUIObject
allowReTexture, destroyObject, focus, getGlPixelInt, getHFlip, getLayer, getLimitX, getLimitY, getMinX, getMinY, getRotation, getScale, getSizeX, getSizeY, getTextureID, getVFlip, getVisible, getWinLimitX, getWinLimitY, getWinMinX, getWinMinY, getX, getY, hide, includesKeyCallback, includesMouseCallback, interactionInVisibleBounds, isDestroyed, isFocused, isNearestFilter, render, resetTextureID, setAll, setAll, setHFlip, setLayer, setLimitX, setLimitY, setMinX, setMinY, setNearestFilter, setPixel, setPreserveTextureIDOverride, setRotation, setScale, setTextureID, setVFlip, setVisible, setWinLimitX, setWinLimitY, setWinMinX, setWinMinY, setX, setY, unfocus, updates
-
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 objectlayer
- the rendering layergui
- the parentGUI
x
- the x position of this objecty
- the y position of this objectnearestFilter
- whether to use nearest-neighbor filteringrgba
- true if the image should be stored with an alpha channel (RGBA)image
- theBufferedImage
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 objectlayer
- the rendering layergui
- the parentGUI
x
- the x position of this objecty
- the y position of this objectnearestFilter
- whether to use nearest-neighbor filteringrgba
- true if the image should be stored with an alpha channel (RGBA)image
- theBufferedImage
to wrapdirectional
- 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
Returns the main pixel buffer for this image.- Returns:
- the base
ByteBuffer
containing pixel data
-
update
-
sendKey
-
sendMousePos
public void sendMousePos(long window, double xPos, double yPos) Description copied from class:GUIObject
Handles mouse position updates.- Specified by:
sendMousePos
in classGUIObject
-
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 classGUIObject
-
sendMouseScroll
public void sendMouseScroll(long window, double xOffset, double yOffset) Description copied from class:GUIObject
Handles mouse scroll input.- Specified by:
sendMouseScroll
in classGUIObject
-