|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.sciss.gui.TiledImage
public class TiledImage
An Image
wrapper
that generates a virtual grid of
sub images which are accessible
by x and y offset and paintable
through a custom paintTile
method.
Constructor Summary | |
---|---|
TiledImage(java.awt.Image img,
int tileWidth,
int tileHeight)
Creates a new TiledImage from an image applies a custom tiling grid. |
|
TiledImage(java.lang.String imagePath,
int tileWidth,
int tileHeight)
Creates a new TiledImage from an image file on harddisc and applies a custom tiling grid. |
|
TiledImage(java.net.URL imagePath,
int tileWidth,
int tileHeight)
Creates a new TiledImage from an image URL and applies a custom tiling grid. |
Method Summary | |
---|---|
de.sciss.gui.TiledImage.Icon |
createIcon(int col,
int row)
Creates a new Icon from
this TiledImage , using one
particular tile of this image. |
int |
getTileHeight()
Queries the tile height |
int |
getTileWidth()
Queries the tile width |
boolean |
paintTile(java.awt.Graphics g,
int x,
int y,
int tileX,
int tileY,
java.awt.image.ImageObserver o)
Paints a tile onto a graphics surface. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TiledImage(java.lang.String imagePath, int tileWidth, int tileHeight)
imagePath
- file name to the image
(can be relative to the
application path). allowed
image formats are GIF, PNG, JPGtileWidth
- horizontal width of each tile.
thus number of columns = image width / tile widthtileHeight
- vertical height of each tile.
thus number of rows = image height / tile heightToolkit.getDefaultToolkit()
,
Toolkit.getImage( String )
public TiledImage(java.net.URL imagePath, int tileWidth, int tileHeight)
imagePath
- URL
the image. allowed
image formats are GIF, PNG, JPGtileWidth
- horizontal width of each tile.
thus number of columns = image width / tile widthtileHeight
- vertical height of each tile.
thus number of rows = image height / tile heightpublic TiledImage(java.awt.Image img, int tileWidth, int tileHeight)
img
- the image to use.tileWidth
- horizontal width of each tile.
thus number of columns = image width / tile widthtileHeight
- vertical height of each tile.
thus number of rows = image height / tile heightMethod Detail |
---|
public int getTileWidth()
public int getTileHeight()
public boolean paintTile(java.awt.Graphics g, int x, int y, int tileX, int tileY, java.awt.image.ImageObserver o)
g
- Graphics
used to draw the imagex
- x offset in the graphics contexty
- y offset in the graphics contexttileX
- column index of the tile (starting at zero)tileY
- row index of the tile (starting at zero)o
- asynchronous image update notification receiver
true
if the current output representation
is complete; false
otherwise.Graphics.drawImage( Image, int, int, int, int, int, int, int, int, ImageObserver )
public de.sciss.gui.TiledImage.Icon createIcon(int col, int row)
Icon
from
this TiledImage
, using one
particular tile of this image. In this way
multiply icons can share the same image file
and just use bits of it.
col
- tile column index in the tiled image
(starting at zero)row
- tile row index in the tiled image
(starting at zero)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |