The vast and the sweeping. Modified the tile framework such that tiles no
longer provide access to their underlying image (they actually still do, but not in the normal course of affairs). This will allow us to use "trimmed" tiles which are trimmed to the smallest rectangle that contains the non-transparent pixels in a tile image, which will shrink up our components and other tiles a great deal. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1339 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
//
|
||||
// $Id: TileIcon.java,v 1.1 2002/05/06 18:08:32 mdb Exp $
|
||||
|
||||
package com.threerings.media.tile;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Graphics;
|
||||
|
||||
import javax.swing.Icon;
|
||||
|
||||
/**
|
||||
* Implements the icon interface, using a {@link Tile} to render the icon
|
||||
* image.
|
||||
*/
|
||||
public class TileIcon implements Icon
|
||||
{
|
||||
/**
|
||||
* Creates a tile icon that will use the supplied tile to render itself.
|
||||
*/
|
||||
public TileIcon (Tile tile)
|
||||
{
|
||||
_tile = tile;
|
||||
}
|
||||
|
||||
// documentation inherited from interface
|
||||
public void paintIcon (Component c, Graphics g, int x, int y)
|
||||
{
|
||||
_tile.paint(g, x, y);
|
||||
}
|
||||
|
||||
// documentation inherited from interface
|
||||
public int getIconWidth ()
|
||||
{
|
||||
return _tile.getWidth();
|
||||
}
|
||||
|
||||
// documentation inherited from interface
|
||||
public int getIconHeight ()
|
||||
{
|
||||
return _tile.getHeight();
|
||||
}
|
||||
|
||||
/** The tile used to render this icon. */
|
||||
protected Tile _tile;
|
||||
}
|
||||
Reference in New Issue
Block a user