Package nl.colorize.multimedialib.stage
Interface Image
public interface Image
Describes image data for an image that has been loaded by the renderer. It
is not possible to add
Image
instances directly to the stage. This
class represents the image contents, a Sprite
can then be used to
add an instance of the image to the stage.
Instances of this class can represent either the entire underlying image, or a rectangular region within the source image. This class allows both situations to be used interchangeably.
-
Method Summary
Modifier and TypeMethodDescriptionextractRegion
(Region subRegion) Returns a newImage
instance that is based on the same source image, but only contains the specified rectangular region within the source image.int
getAlpha
(int x, int y) Returns the alpha of a pixel within the image.getColor
(int x, int y) Returns the RGB color value of a pixel within the image.default int
default int
getWidth()
-
Method Details
-
getRegion
Region getRegion() -
getWidth
default int getWidth() -
getHeight
default int getHeight() -
extractRegion
Returns a newImage
instance that is based on the same source image, but only contains the specified rectangular region within the source image. If thisImage
is itself a region, the coordinates in theregion
parameter will be interpreted relative to this image's region.- Throws:
IllegalArgumentException
- ifregion
is located partially or entirely outside of this image.
-
getColor
Returns the RGB color value of a pixel within the image. This does not include the pixel's alpha value even if the image does support transparency. The returned color does not include an alpha channel. The alpha value of transparent or translucent pixels in the image can be obtained usinggetAlpha(int, int)
.- Throws:
IllegalArgumentException
- If the X or Y coordinate is located outside the image bounds.
-
getAlpha
int getAlpha(int x, int y) Returns the alpha of a pixel within the image. The returned value is between 0 (fully transparent) and 100 (fully opaque).- Throws:
IllegalArgumentException
- If the X or Y coordinate is located outside the image bounds.
-