|
![]() |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.siemens.mp.misc.NativeMem
com.siemens.mp.game.GraphicObject
com.siemens.mp.game.TiledBackground
The TiledBackground class implements tiled pictures for the display background. For setting a tiled background for display, the user must first define 8x8 pixel tiles and, optionally, their masks; then create a map with tiles indexes. This map defines how tiles will be placed on the background; if the map size is less than the display size, it will be repeated throughout all the display.
The map may contain both user-defined tiles and predefined (0 = transparent, 1 = white and 2 = black) tiles. The user-defined tile indexes in a map start from 3 (3 for the first user tile, 4 for the second, etc.)
Because the TiledBackground class is a subclass of GraphicObject
,
it has no direct drawing capability available for the user. Instead,
when included into a GraphicObjectManager
collection, a tiled background will be drawn in proper order by the
GraphicObjectManager.paint
method call.
GraphicObject
,
GraphicObjectManager
Constructor Summary | |
TiledBackground(byte[] tilePixels,
byte[] tileMask,
byte[] map,
int widthInTiles,
int heightInTiles)
Creates tiled background using tiles from a bytearray. |
|
TiledBackground(ExtendedImage tilePixels,
ExtendedImage tileMask,
byte[] map,
int widthInTiles,
int heightInTiles)
Creates tiled background using tiles from an ExtendedImage object.
|
|
TiledBackground(Image tilePixels,
Image tileMask,
byte[] map,
int widthInTiles,
int heightInTiles)
Creates a tiled background using tiles from an Image object.
|
Method Summary | |
void |
setPositionInMap(int x,
int y)
Sets the point in the tiles map that will correspond to the drawing area starting point. |
Methods inherited from class com.siemens.mp.game.GraphicObject |
getVisible, setVisible |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TiledBackground(Image tilePixels, Image tileMask, byte[] map, int widthInTiles, int heightInTiles) throws IllegalArgumentException
Image
object.
The tilePixels image width must be 8 (all tiles in one column), its
height is (tiles count)*8.
The tileMask image size must be equal to the tilePixels image size. It defines
tiles transparency (like the Sprite
mask).
This parameter may be null.
The map contains tile indexes (one byte per tile). There are 3 predefined tiles: tile 0 is a transparent tile, tile 1 is a white tile, tile 2 is a black tile. User-defined tiles start at 3 (3 for the first user tile, 4 for the second, etc.)
tilePixels
- a standard Image
containing tiles (8x8); the width of the image must be 8tileMask
- a standard Image
containing tile masks (8x8); the width of the image must be 8.
This parameter may be null.map
- a byte array with the map for the tiles (one byte per tile)widthInTiles
- the map width in tilesheightInTiles
- the map height in tiles
IllegalArgumentException
- if the width of the image/mask is not 8
public TiledBackground(ExtendedImage tilePixels, ExtendedImage tileMask, byte[] map, int widthInTiles, int heightInTiles) throws IllegalArgumentException
ExtendedImage
object.
The tilePixels image width must be 8 (all tiles in one column), its
height is (tiles count)*8.
The tileMask image size must be equal to the tilePixels image size. It defines
tiles transparency (like the Sprite
mask).
This parameter may be null.
The map contains tile indexes (one byte per tile). There are 3 predefined tiles: tile 0 is a transparent tile, tile 1 is a white tile, tile 2 is a black tile. User-defined tiles start at 3 (3 for the first user tile, 4 for the second, etc.)
tilePixels
- an ExtendedImage
with the tiles (8x8); the width of the image must be 8tileMask
- an ExtendedImage
with the tile masks (8x8); the width of the image must be 8.
This parameter may be null.map
- a byte array with the map for the tiles (one byte per tile)widthInTiles
- the map width in tilesheightInTiles
- the map height in tiles
IllegalArgumentException
- if the width of the image/mask is not 8
public TiledBackground(byte[] tilePixels, byte[] tileMask, byte[] map, int widthInTiles, int heightInTiles) throws IllegalArgumentException
The tileMasks bytearray contains tile masks in one-bit-per-pixel (1bpp)
format. Its' size must be equal to the tilePixels array size. It defines
tiles transparency (like the Sprite
mask).
This parameter may be null.
The map contains tile indexes (one byte per tile). There are 3 predefined tiles: tile 0 is a transparent tile, tile 1 is a white tile, tile 2 is a black tile. User-defined tiles start at 3 (3 for the first user tile, 4 for the second, etc.)
tilePixels
- a bytearray with the tiles (8x8) (1bpp)tileMask
- a bytearray with the masks of the tiles (8x8) (1bpp).
This parameter may be null.map
- a byte array with the map for the tiles (one byte per tile)widthInTiles
- the map width in tilesheightInTiles
- the map height in tiles
IllegalArgumentException
- if the size of the tiles/mask array is not a multiple of 8
GraphicObjectManager.createTextureBits
Method Detail |
public void setPositionInMap(int x, int y)
x
- the x coordinate of the point on the map, in pixelsy
- the y coordinate of the point on the map, in pixelsGraphicObjectManager.paint
|
![]() |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Generated on 2003-10-17 | For further information and updates, please visit Siemens mobile Developer Portal |