Package games.stendhal.client.gui.j2d
Class BackgroundPainter
java.lang.Object
games.stendhal.client.gui.j2d.BackgroundPainter
A painter for a background image that consists of 9 tiles, with the
center tile being repeated. The rest of the tiles are the corners and borders
in natural order. The sides will be painted with preference to adhering to
painted area borders rather than trying to preserve the pattern. Therefore
the image should be such that it can tolerate miss tiling at the borders, if
the painted area dimensions can not be guaranteed to be multiples of the tile
dimensions.
-
Constructor Summary
ConstructorDescriptionBackgroundPainter(String image)
Create a new BackgroundPainter.BackgroundPainter(String image, int leftWidth, int centerWidth, int topHeight, int centerHeight)
Create a new BackgroundPainter. -
Method Summary
-
Constructor Details
-
BackgroundPainter
Create a new BackgroundPainter.- Parameters:
image
- image name. The image dimensions should be multiples of 3. The tiles used for painting will be the image divided uniformly to three in both vertical and horizontal directions
-
BackgroundPainter
public BackgroundPainter(String image, int leftWidth, int centerWidth, int topHeight, int centerHeight)Create a new BackgroundPainter. The tiles used for painting will be cut non-uniformly, so that the grid will be placed according to the given dimensions.- Parameters:
image
- image nameleftWidth
- width of the left tile rowcenterWidth
- width of the center tile rowtopHeight
- height of the top tile rowcenterHeight
- height of the center tile row
-
-
Method Details
-
paint
Paint an area with the image pattern.- Parameters:
g
- graphicswidth
- width of the painted areaheight
- height of the painted area
-