com.croftsoft.core.animation.painter
Class TilePainter

java.lang.Object
  extended by com.croftsoft.core.animation.painter.TilePainter
All Implemented Interfaces:
ComponentPainter

public final class TilePainter
extends Object
implements ComponentPainter

Tiles the Icon across the Component.

Supports a palette of up to 256 different icons.

Since:
2002-02-14
Version:
2003-07-11
Author:
David Wallace Croft

Constructor Summary
TilePainter(Icon icon)
          Convenience constructor.
TilePainter(int offsetX, int offsetY, Icon[] tileIcons, byte[][] tileMap, Dimension tileSize, Shape tileShape)
          Main constructor.
TilePainter(int offsetX, int offsetY, Icon icon, Shape tileShape)
          Convenience constructor.
 
Method Summary
 int getOffsetX()
           
 int getOffsetY()
           
 int getTileColumn(Point mousePoint)
           
 int getTileColumns()
           
 int getTileHeight()
           
 int getTileRow(Point mousePoint)
           
 int getTileRows()
           
 int getTileWidth()
           
 void paint(JComponent component, Graphics2D graphics)
           
 void setOffsetX(int offsetX)
           
 void setOffsetY(int offsetY)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TilePainter

public TilePainter(int offsetX,
                   int offsetY,
                   Icon[] tileIcons,
                   byte[][] tileMap,
                   Dimension tileSize,
                   Shape tileShape)
Main constructor.

Parameters:
offsetX - Shifts the tile pattern horizontally. When there is only one tile icon that is being repeated, reasonable values are between 0 and the icon width less 1. Example: values of 0 to 39 for an icon width of 40.
offsetY - Shifts the tile pattern vertically. When there is only one tile icon that is being repeated, reasonable values are between 0 and the icon height less 1. Example: values of 0 to 39 for an icon height of 40.
tileShape - The area of the Component where the tiles will be painted. If the tileShape is null, component.getBounds() will be used.

TilePainter

public TilePainter(int offsetX,
                   int offsetY,
                   Icon icon,
                   Shape tileShape)
Convenience constructor.


TilePainter

public TilePainter(Icon icon)
Convenience constructor.

this ( 0, 0, icon, null );

Method Detail

getOffsetX

public int getOffsetX()

getOffsetY

public int getOffsetY()

getTileWidth

public int getTileWidth()

getTileHeight

public int getTileHeight()

getTileRows

public int getTileRows()

getTileColumns

public int getTileColumns()

setOffsetX

public void setOffsetX(int offsetX)

setOffsetY

public void setOffsetY(int offsetY)

getTileRow

public int getTileRow(Point mousePoint)

getTileColumn

public int getTileColumn(Point mousePoint)

paint

public void paint(JComponent component,
                  Graphics2D graphics)
Specified by:
paint in interface ComponentPainter

CroftSoft Javadoc

CroftSoft Core Javadoc (2008-09-28 20:58:02)