Package net.mtrop.doom.object
Interface GraphicObject
- All Known Implementing Classes:
Flat
,Picture
,PNGPicture
public interface GraphicObject
Interface for graphic data.
- Author:
- Matthew Tropiano
-
Method Details
-
getOffsetX
int getOffsetX()- Returns:
- the offset from the center, horizontally, in pixels.
-
getOffsetY
int getOffsetY()- Returns:
- the offset from the center, vertically, in pixels.
-
getWidth
int getWidth()- Returns:
- the width of this graphic in pixels.
-
getHeight
int getHeight()- Returns:
- the height of this graphic in pixels.
-
getPixel
int getPixel(int x, int y) Gets the pixel data at a location in the graphic.If this graphic is an indexed color graphic (i.e.
Flat
orPicture
), this will return a palette index value from 0 to 255, orPicture.PIXEL_TRANSLUCENT
if this graphic has translucent pixels.For full-color graphics, this returns an ARGB integer value representing the pixel color in RGB space (with Alpha).
- Parameters:
x
- graphic x-coordinate.y
- graphic y-coordinate.- Returns:
- a palette index value from 0 to 255,
Picture.PIXEL_TRANSLUCENT
if translucent, or an ARGB value. - Throws:
ArrayIndexOutOfBoundsException
- if the provided coordinates is outside the graphic.
-
setPixel
void setPixel(int x, int y, int value) Sets the pixel data at a location in the graphic.For indexed color graphics, valid values are in the range of -1 to 255, with 0 to 254 being palette indexes and
Picture.PIXEL_TRANSLUCENT
/ 255 being translucent pixels (if supported).For full-color graphics, the value is an ARGB integer value representing the pixel color in RGB space (with Alpha).
- Parameters:
x
- picture x-coordinate.y
- picture y-coordinate.value
- the value to set.- Throws:
IllegalArgumentException
- if the value is outside a valid range.ArrayIndexOutOfBoundsException
- if the provided coordinates is outside the graphic.
-