|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectt3.hrd.state.OrderedElement
t3.hrd.state.Tile
public class Tile
A Tile is a rectangular image with a width and height that is drawn on the desk with a specific width, height and orientation, and at a specific location. Create new Tiles by calling the appropriate method on the a StateManager object. A Tile can be backed, split or unbacked.
A backed tile is the simplest tile. It has a BufferedImage that stores its contents.
An unbacked tile has no BufferedImage, and if you call the method to get the image then the system will create an empty bufferedimage, call callback_repaintUnbackedTile to paint into the empty image, and then return the result. You can set up the StateManager to always produce unbacked tiles rather than backed tiles.
A split tile is created if you create a tile with a large number of pixels (depending on how you set up your StateManager). It has no bufferedImage itself but refers to several smaller backed tiles.
A Tile uses the bufferedimage format TYPE_INT_ARGB (i.e. 32 bits per pixel) by default but you can specify a flag to change this to TYPE_USHORT_565RGB (i.e. 16 bits per pixel). Pixel data is sent to the graphics card via OpenGL in the same format as the BufferedImage.
When stored as a texture for rendering, the texture has format RGBA8 (i.e. 32 bits per pixel) by default but you can specify a flag to change this to RGB4 (i.e. 12 bits per pixel).
TILE space is a 2D homogenous coordinate space corresponding to the coordinate space of the tile's image. There are methods to obtain the corner points, outline and bounding box of the tile in TILE space and also in DESK space (i.e. once the tile has been affine-transformed).
Threading notes: this class is not thread-safe. You must use some kind of locking scheme if you use it in a multithreaded environment.
Field Summary | |
---|---|
static int |
FLAG_BI_USHORT565RGB_NOT_INTARGB
|
static int |
FLAG_NO_TRANSFORM
Tile not transformed - draw texture pixel for pixel into frame buffer |
static int |
FLAG_TEXTUREALWAYSRESIDENTEVENWHENTILEINVISIBLE
|
static int |
FLAG_TEXTUREALWAYSRESIDENTWHENTILEVISIBLE
|
int |
flags
|
int |
imageH
As imageW |
int |
imageW
Width of the tile's buffered image in pixels. |
int |
tileHeight
Height of the usable tile image in pixels. |
static boolean |
TILEtoDESKflipsHoriz
|
static boolean |
TILEtoDESKflipsVert
|
int |
tileType
|
static int |
TILETYPE_BACKED
|
static int |
TILETYPE_SPLIT
|
static int |
TILETYPE_UNBACKED
|
int |
tileWidth
Width of the usable tile image in pixels. |
java.util.List<UnwarpedRect> |
unwarpedRectsLinesReadOnly
UnwarpedRects associated with this tile, for reading only. |
java.util.List<UnwarpedRect> |
unwarpedRectsWordsReadOnly
|
Fields inherited from class t3.hrd.state.OrderedElement |
---|
elementId, stateManager |
Method Summary | |
---|---|
java.awt.image.BufferedImage |
createCompatibleBufferedImage(int w,
int h)
Creates a BufferedImage compatible with the tile's image. |
java.awt.Graphics2D |
createGraphics2DForTileUpdate(java.awt.Rectangle r,
java.awt.image.BufferedImage tileUpdateImage)
Creates a Graphics2D from a Rectangle and a BufferedImage such that (r.x,r.y) in Graphics2D corresponds to (0,0) in the BufferedImage and the clip area of the Graphics2D is exactly the size of the BufferedImage. |
double |
getDESKcentreX()
|
double |
getDESKcentreY()
|
double |
getDESKheight()
|
double |
getDESKwidth()
|
java.awt.geom.GeneralPath |
getGpDESKoutline()
|
java.awt.image.BufferedImage |
getImageForReadingOnlyNoPainting()
For a backed tile only. |
java.awt.image.BufferedImage |
getImageForReadingOnlyPaintIfNecessary()
For a backed tile, this returns the backed tile's BufferedImage that contains the tile's pixel data. |
boolean |
getIntegerTileSpaceCoordsFromDESK(int[] intTileSpaceCoords,
double[] dDESK)
Translates DESK space coordinates into TILE space coordinates and then rounds to integers. |
Jama.Matrix[] |
getmDESKcornersClockwise()
|
Jama.Matrix |
getmDESKtoTILE()
|
Jama.Matrix[] |
getmTILEcornersClockwise()
|
Jama.Matrix |
getmTILEtoDESK()
|
java.awt.geom.Rectangle2D |
getrDESKboundingBox()
|
Tile[][] |
getSplitComponentsPackedByColForReadOnly()
For a split tile, this returns its component backed Tiles, packed by column. |
double |
getTILEtoDESKrotationClockwise()
|
boolean |
isDestroyed()
|
boolean |
isFlagSet(int f)
|
boolean |
isVisible()
|
void |
opCreateUnwarpedRect(UnwarpedRect r)
Creates a new unwarped rectangle. |
void |
opDestroyAllUnwarpedRectsIntersecting(java.awt.Rectangle r)
Destroys all unwarped rectangles intersecting a specified rectangle. |
void |
opSetAff(double DESKcentreX,
double DESKcentreY,
double DESKwidth,
double DESKheight,
double thetaClockwise)
Sets the centre, width, height and rotation of the tile on the display surface. |
void |
opSetVisibility(boolean v)
Set tile visibility. |
void |
opUpdateContents(int x,
int y,
java.awt.image.BufferedImage update,
int compressionHint)
Pastes a supplied image into part of the tile's contents. |
void |
opUpdateContentsByCopyingFromOtherTile(int sx,
int sy,
int dx,
int dy,
int w,
int h,
Tile source)
Updates the contents of this tile by copying data from another tile. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int FLAG_NO_TRANSFORM
public static final int FLAG_BI_USHORT565RGB_NOT_INTARGB
public static final int FLAG_TEXTUREALWAYSRESIDENTWHENTILEVISIBLE
public static final int FLAG_TEXTUREALWAYSRESIDENTEVENWHENTILEINVISIBLE
public static final boolean TILEtoDESKflipsVert
public static final boolean TILEtoDESKflipsHoriz
public static final int TILETYPE_BACKED
public static final int TILETYPE_SPLIT
public static final int TILETYPE_UNBACKED
public final int tileWidth
public final int tileHeight
public final int imageW
public final int imageH
public final int flags
public final int tileType
public final java.util.List<UnwarpedRect> unwarpedRectsLinesReadOnly
public final java.util.List<UnwarpedRect> unwarpedRectsWordsReadOnly
Method Detail |
---|
public boolean isVisible()
public boolean isFlagSet(int f)
public double getTILEtoDESKrotationClockwise()
public double getDESKcentreX()
public double getDESKcentreY()
public double getDESKwidth()
public double getDESKheight()
public Jama.Matrix[] getmTILEcornersClockwise()
public Jama.Matrix[] getmDESKcornersClockwise()
public java.awt.geom.Rectangle2D getrDESKboundingBox()
public Jama.Matrix getmTILEtoDESK()
public Jama.Matrix getmDESKtoTILE()
public boolean isDestroyed()
public java.awt.geom.GeneralPath getGpDESKoutline()
public Tile[][] getSplitComponentsPackedByColForReadOnly()
public java.awt.image.BufferedImage getImageForReadingOnlyNoPainting()
public java.awt.image.BufferedImage getImageForReadingOnlyPaintIfNecessary()
For an unbacked tile, this creates a new empty BufferedImage, calls callback_repaintUnbackedTile to paint into the empty image and returns the result.
For a split tile this results in an IllegalStateException.
public void opSetAff(double DESKcentreX, double DESKcentreY, double DESKwidth, double DESKheight, double thetaClockwise)
DESKcentreX
- DESKcentreY
- DESKwidth
- DESKheight
- thetaClockwise
- public void opSetVisibility(boolean v)
v
- public java.awt.image.BufferedImage createCompatibleBufferedImage(int w, int h)
w
- h
-
public java.awt.Graphics2D createGraphics2DForTileUpdate(java.awt.Rectangle r, java.awt.image.BufferedImage tileUpdateImage)
r
- tileUpdateImage
-
public void opUpdateContentsByCopyingFromOtherTile(int sx, int sy, int dx, int dy, int w, int h, Tile source)
sx
- sy
- dx
- dy
- w
- h
- source
- public void opUpdateContents(int x, int y, java.awt.image.BufferedImage update, int compressionHint)
Typical usage: Say you want to update an area r of the tile. Create a new BufferedImage with same dimensions as r using createCompatibleBufferedImage. Create a Graphics2D using createGraphics2DForTileUpdate. Now draw into the Graphics2D. (0,0) will correspond to the origin in TILE space, but only things that you draw into the area of r will appear in the update. Now call opUpdateContents.
x
- x coordinate of update in TILEy
- y coordinate of update in TILEupdate
- contents of updatepublic void opCreateUnwarpedRect(UnwarpedRect r)
public void opDestroyAllUnwarpedRectsIntersecting(java.awt.Rectangle r)
r
- public boolean getIntegerTileSpaceCoordsFromDESK(int[] intTileSpaceCoords, double[] dDESK)
intTileSpaceCoords
- array of two ints, which are set to the x and y integer coordinates.dDESK
- array of three doubles, the DESK space coordinates.
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |