public final class BitmapImage extends Object implements Disposable
| Modifier and Type | Field and Description |
|---|---|
protected String |
filePath |
protected Texture |
image |
protected Pixmap |
pixmap |
protected TextureRegion |
tRegion |
| Constructor and Description |
|---|
BitmapImage(String file) |
| Modifier and Type | Method and Description |
|---|---|
void |
dispose()
Release the resources allocated by this
BitmapImage, normally
should be called automatically |
protected void |
finalize() |
Color |
getColor(int x,
int y)
Returns the current color of an image
|
Texture |
getImage()
Should normally not be used directly, use at your own risk
|
TextureRegion |
getRegion()
Should normally not be used directly, use at your own risk
|
boolean |
isContained(int x,
int y)
Is a given pixel position contained in the image or not
The pixel is given in image space (width x height)
|
boolean |
isContained(Vector2 p) |
void |
mirrorLeftRight()
Mirrors the image left <-> right
|
void |
mirrorUpDown()
Mirrors the image up <-> down
|
Vector2 |
pixelInScreenSpace(Vector2 pixelPosition,
Vector2 imagePosition)
To get the color of a pixel in an image, we
must get translate screen coordinates to image coordinates
This is the role of the following function.
|
protected Texture image
protected TextureRegion tRegion
protected String filePath
protected Pixmap pixmap
public BitmapImage(String file)
public Texture getImage()
public TextureRegion getRegion()
public void mirrorLeftRight()
public void mirrorUpDown()
public boolean isContained(Vector2 p)
p - The pixel position, in image spaceisContained(int, int)public boolean isContained(int x,
int y)
x - x-position of the pixely - y-position of the pixelpublic Vector2 pixelInScreenSpace(Vector2 pixelPosition, Vector2 imagePosition)
pixelPosition - The pixel we want to read, in screen coordinatesimagePosition - The current position of the image, in screen coordinatespublic Color getColor(int x, int y)
x - The x position we want to ready - The y position we want to readpublic void dispose()
BitmapImage, normally
should be called automaticallydispose in interface DisposableCopyright © 2014-2016 gdx2d - https://github.com/hevs-isi/gdx2d