|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.alienfactory.javamappy.viewer.render.NokiaRenderer
public class NokiaRenderer
This Renderer
references Nokia's own J2ME API which, unlike the
MIDP 1.0 specification, supports full alpha transparency.
If your tile map image is being loaded from a .png then I would recommend the
MIDP 1.0 renderer as it still renderers transparent .pngs but is 3 to 5 times
faster (as tested on my own N-Gage).
Field Summary | |
---|---|
protected int |
blockHeight
|
protected int |
blockWidth
|
protected int |
halfBlockWidth
|
Fields inherited from interface com.alienfactory.javamappy.viewer.render.Renderer |
---|
DRAW_LEFT_SIDE_ONLY, DRAW_RIGHT_SIDE_ONLY, NONE |
Constructor Summary | |
---|---|
NokiaRenderer(Map map)
Uses the raw pixel data and colour map from the given Map to
create the tilemap image. |
|
NokiaRenderer(Map map,
java.lang.String fileName,
boolean block0included)
Initialises itself from the given tileset image. |
Method Summary | |
---|---|
void |
drawImage(java.lang.Object objGFX,
int imageIndex,
int dstPixX,
int dstPixY,
boolean transparency,
int modification)
Renders a tile image at the given coordinates. |
void |
restoreClip(java.lang.Object objGFX)
This is called after a Layer is drawn to restore the
clipping region to what it used to be. |
void |
setClip(java.lang.Object objGFX,
int x,
int y,
int width,
int height)
This is called just before a Layer is drawn to allow the
Renderer to set the desired clipping region. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final int blockWidth
protected final int blockHeight
protected final int halfBlockWidth
Constructor Detail |
---|
public NokiaRenderer(Map map) throws java.lang.IllegalArgumentException
Map
to
create the tilemap image. PixelData
and Colours
objects in the given
Map
.
map
- the Map
containing the image data to be rendered
java.lang.IllegalArgumentException
- if Map
is null
public NokiaRenderer(Map map, java.lang.String fileName, boolean block0included) throws java.io.IOException, java.lang.IllegalArgumentException
map
- data from the Map
is used to generate the individual imagesfileName
- the fileName of the image to load - should start with a leading '/'block0included
- set to true
if the image includes block 0
java.io.IOException
java.lang.IllegalArgumentException
Method Detail |
---|
public final void drawImage(java.lang.Object objGFX, int imageIndex, int dstPixX, int dstPixY, boolean transparency, int modification) throws java.lang.IllegalArgumentException
final
as a compiler optimisation.
objGFX
- an instance of javax.microedition.lcdui.Graphics
transparency
- is ignoredimageIndex
- the index of the image to draw - see Map.getImageData()
dstPixX
- the coordinate of where the image should be rendereddstPixY
- the coordinate of where the image should be renderedmodification
- any modification style should be applied to the image
java.lang.IllegalArgumentException
- if objGFX
is null
public void setClip(java.lang.Object objGFX, int x, int y, int width, int height) throws java.lang.IllegalArgumentException
Renderer
Layer
is drawn to allow the
Renderer
to set the desired clipping region.
setClip
in interface Renderer
objGFX
- the gfx object specific to the Renderer
x
- the start coordinate of the clipping regiony
- the start coordinate of the clipping regionwidth
- the width of the clipping regionheight
- the height of the clipping region
java.lang.IllegalArgumentException
- if objGFX
is null
public void restoreClip(java.lang.Object objGFX) throws java.lang.IllegalArgumentException
Renderer
Layer
is drawn to restore the
clipping region to what it used to be.
restoreClip
in interface Renderer
objGFX
- the gfx object specific to the Renderer
java.lang.IllegalArgumentException
- if objGFX
is null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |