com.alienfactory.javamappy.viewer.render
Class J2SE14Renderer

java.lang.Object
  extended by com.alienfactory.javamappy.viewer.render.J2SE14Renderer
All Implemented Interfaces:
Renderer

public class J2SE14Renderer
extends java.lang.Object

This Renderer has been optimised for use in Java2 SE 1.4 JVMs or later.

Author:
Steve Eynon

Field Summary
protected  int blockHeight
           
protected  int blockWidth
           
protected  java.awt.Image[] opaqueImages
           
protected  java.awt.Image[] transparentImages
           
 
Fields inherited from interface com.alienfactory.javamappy.viewer.render.Renderer
DRAW_LEFT_SIDE_ONLY, DRAW_RIGHT_SIDE_ONLY, NONE
 
Constructor Summary
J2SE14Renderer(Map map)
          Uses the raw pixel data and colour map from the given Map to create images in a JDK specific manner.
J2SE14Renderer(Map map, java.io.InputStream tileSheet, boolean block0included)
          Loads the tile sheet image from the given Input Stream (which is not closed).
 
Method Summary
 void drawImage(java.lang.Object objGFX, int imageIndex, int dstPixX, int dstPixY, boolean transparency, int modification)
          Draws an image as given by imageIndex 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

opaqueImages

protected java.awt.Image[] opaqueImages

transparentImages

protected java.awt.Image[] transparentImages

blockWidth

protected final int blockWidth

blockHeight

protected final int blockHeight
Constructor Detail

J2SE14Renderer

public J2SE14Renderer(Map map)
               throws java.lang.IllegalArgumentException
Uses the raw pixel data and colour map from the given Map to create images in a JDK specific manner.

Parameters:
map - the Map containing the image data to be rendered
Throws:
java.lang.IllegalArgumentException - if Map is null

J2SE14Renderer

public J2SE14Renderer(Map map,
                      java.io.InputStream tileSheet,
                      boolean block0included)
               throws java.io.IOException,
                      java.lang.IllegalArgumentException
Loads the tile sheet image from the given Input Stream (which is not closed). The image can be of the usual formats, .BMP, .GIF, .PNG, .JPG, etc.

Useful when working with .fma files so the same tile sheet can be used with multiple maps.

Parameters:
map - the Map containing the image data to be rendered
tileSheet - the input stream to load the tile image from
block0included - set to true if the tile image includes block 0
Throws:
java.lang.IllegalArgumentException - if input parameter is null
java.io.IOException
Method Detail

setClip

public void setClip(java.lang.Object objGFX,
                    int x,
                    int y,
                    int width,
                    int height)
             throws java.lang.IllegalArgumentException
Description copied from interface: Renderer
This is called just before a Layer is drawn to allow the Renderer to set the desired clipping region.

Specified by:
setClip in interface Renderer
Parameters:
objGFX - the gfx object specific to the Renderer
x - the start coordinate of the clipping region
y - the start coordinate of the clipping region
width - the width of the clipping region
height - the height of the clipping region
Throws:
java.lang.IllegalArgumentException - if objGFX is null

restoreClip

public void restoreClip(java.lang.Object objGFX)
                 throws java.lang.IllegalArgumentException
Description copied from interface: Renderer
This is called after a Layer is drawn to restore the clipping region to what it used to be.

Specified by:
restoreClip in interface Renderer
Parameters:
objGFX - the gfx object specific to the Renderer
Throws:
java.lang.IllegalArgumentException - if objGFX is null

drawImage

public final void drawImage(java.lang.Object objGFX,
                            int imageIndex,
                            int dstPixX,
                            int dstPixY,
                            boolean transparency,
                            int modification)
                     throws java.lang.IllegalArgumentException
Description copied from interface: Renderer
Draws an image as given by imageIndex at the given coordinates.

Specified by:
drawImage in interface Renderer
Parameters:
objGFX - the gfx object specific to the Renderer
imageIndex - the index of the image to draw - see Map.getImageData()
dstPixX - the coordinate of where the image should be rendered
dstPixY - the coordinate of where the image should be rendered
transparency - whether or not the image should rendered honouring it's transparent pixels.
modification - any modification style should be applied to the image
Throws:
java.lang.IllegalArgumentException - if objGFX is null


Copyright © 2001-2009 Alien-Factory Ltd. All Rights Reserved.