public abstract class Image extends TileSource implements Canvas.Drawable, Closeable
| Modifier and Type | Class and Description |
|---|---|
static interface |
Image.BitmapTransformer
|
static class |
Image.Region
|
Closeable.Set, Closeable.Util| Modifier and Type | Field and Description |
|---|---|
RFuture<Image> |
state
Reports the asynchronous loading of this image.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Disposes this image's default texture, if it has been already created.
|
abstract Pattern |
createPattern(boolean repeatX,
boolean repeatY)
Creates a pattern from this image which can be used to fill a canvas.
|
Texture |
createTexture(Texture.Config config)
Creates a texture with this image's bitmap data using
config. |
abstract void |
getRgb(int startX,
int startY,
int width,
int height,
int[] rgbArray,
int offset,
int scanSize)
Extracts pixel data from a rectangular area of this image.
|
float |
height()
This image's height in display units.
|
boolean |
isLoaded()
Returns whether this image is successfully loaded.
|
abstract int |
pixelHeight()
Returns the height of this image in physical pixels.
|
abstract int |
pixelWidth()
Returns the width of this image in physical pixels.
|
Image.Region |
region(float rx,
float ry,
float rwidth,
float rheight)
Returns a region of this image which can be drawn independently.
|
abstract Scale |
scale()
Returns the scale of resolution independent pixels to actual pixels for this image.
|
Image |
setConfig(Texture.Config config)
Sets the texture config used when creating this image's default texture.
|
abstract void |
setRgb(int startX,
int startY,
int width,
int height,
int[] rgbArray,
int offset,
int scanSize)
Sets pixel data for a rectangular area of this image.
|
Texture |
texture()
Returns, creating if necessary, this image's default texture.
|
RFuture<Texture> |
textureAsync()
Returns a future which will deliver the default texture for this image once its loading has
completed.
|
Tile |
tile()
Returns the tile provided by this source.
|
RFuture<Tile> |
tileAsync()
Delivers the tile provided by this source once the source is loaded.
|
abstract Image |
transform(Image.BitmapTransformer xform)
Generates a new image from this image's bitmap, using a transformer created for the platform
in use.
|
Texture |
updateTexture()
Updates this image's default texture with the current contents of the image, and returns the
texture.
|
float |
width()
This image's width in display units.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdraw, drawpublic boolean isLoaded()
false will be returned. In general you'll want to react to state, but this
method is useful when you need to assert that something is only allowed on a fully loaded
image.isLoaded in class TileSourcepublic abstract Scale scale()
Scale.ONE unless HiDPI images are being used.public float width()
state.width in interface Canvas.Drawablepublic float height()
state.height in interface Canvas.Drawablepublic abstract int pixelWidth()
state.public abstract int pixelHeight()
state.public abstract void getRgb(int startX,
int startY,
int width,
int height,
int[] rgbArray,
int offset,
int scanSize)
(alpha << 24 | red << 16 | green << 8 | blue), where
alpha, red, green and blue are the corresponding channel values, ranging from 0 to 255
inclusive.startX - x-coordinate of the upper left corner of the area.startY - y-coordinate of the upper left corner of the area.width - width of the area.height - height of the area.rgbArray - will be filled with the pixel data from the areaoffset - fill start offset in rgbArray.scanSize - number of pixels in a row in rgbArray.public abstract void setRgb(int startX,
int startY,
int width,
int height,
int[] rgbArray,
int offset,
int scanSize)
Graphics.createCanvas(float, float).
The pixel format is (alpha << 24 | red << 16 | green << 8 | blue), where alpha, red,
green and blue are the corresponding channel values, ranging from 0 to 255 inclusive.startX - x-coordinate of the upper left corner of the area.startY - y-coordinate of the upper left corner of the area.width - width of the area.height - height of the area.rgbArray - will be filled with the pixel data from the areaoffset - fill start offset in rgbArray.scanSize - number of pixels in a row in rgbArray.public abstract Pattern createPattern(boolean repeatX, boolean repeatY)
public Image setConfig(Texture.Config config)
texture so that it is configured before the default
texture is created and cached.public Texture texture()
Texture.Config set via setConfig(playn.core.Texture.Config). If an image's default texture
is Texture.close()d, a subsequent call to this method will create a new default texture.public Texture updateTexture()
Canvas, or if you have used setRgb(int, int, int, int, int[], int, int) to change the contents of this image.public RFuture<Texture> textureAsync()
texture to create the texture.public Texture createTexture(Texture.Config config)
config. NOTE: this creates a new
texture with every call. This is generally only needed if you plan to create multiple textures
from the same bitmap, with different configurations. Otherwise just use texture to
create the image's "default" texture which will be shared by all callers.public void close()
public Image.Region region(float rx, float ry, float rwidth, float rheight)
public abstract Image transform(Image.BitmapTransformer xform)
JavaBitmapTransformer for example.public Tile tile()
TileSourcetile in class TileSourcepublic RFuture<Tile> tileAsync()
TileSourcetileAsync in class TileSourceCopyright © 2018. All Rights Reserved.