com.threerings.media.util
Class BackgroundTiler

java.lang.Object
  extended by com.threerings.media.util.BackgroundTiler

public class BackgroundTiler
extends Object

Used to tile a background image into regions of various sizes. The source image is divided into nine quadrants (of mostly equal size) which are tiled accordingly to fill whatever size background image is desired.


Field Summary
protected  int _ch3
          The size of the center chunk of our subdivided images.
protected  int _cw3
          The size of the center chunk of our subdivided images.
protected  int _h3
          One third of width/height of our source image.
protected  BufferedImage[] _tiles
          Our nine sub-divided images.
protected  int _w3
          One third of width/height of our source image.
 
Constructor Summary
BackgroundTiler(BufferedImage src)
          Creates a background tiler with the specified source image.
 
Method Summary
 int getNaturalHeight()
          Returns the "natural" height of the image being used to tile the background.
 int getNaturalWidth()
          Returns the "natural" width of the image being used to tile the background.
 void paint(Graphics g, int x, int y, int width, int height)
          Fills the requested region with the background defined by our source image.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_tiles

protected BufferedImage[] _tiles
Our nine sub-divided images.


_w3

protected int _w3
One third of width/height of our source image.


_h3

protected int _h3
One third of width/height of our source image.


_cw3

protected int _cw3
The size of the center chunk of our subdivided images.


_ch3

protected int _ch3
The size of the center chunk of our subdivided images.

Constructor Detail

BackgroundTiler

public BackgroundTiler(BufferedImage src)
Creates a background tiler with the specified source image.

Method Detail

getNaturalWidth

public int getNaturalWidth()
Returns the "natural" width of the image being used to tile the background.


getNaturalHeight

public int getNaturalHeight()
Returns the "natural" height of the image being used to tile the background.


paint

public void paint(Graphics g,
                  int x,
                  int y,
                  int width,
                  int height)
Fills the requested region with the background defined by our source image.