380fa50610
because they'll be used for both sprites and animations. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1692 542714f4-19e9-0310-aa3c-eee0fc999fb1
59 lines
1.3 KiB
Java
59 lines
1.3 KiB
Java
//
|
|
// $Id: SingleFrameImageImpl.java,v 1.3 2002/09/17 19:11:13 mdb Exp $
|
|
|
|
package com.threerings.media.util;
|
|
|
|
import java.awt.Graphics;
|
|
import java.awt.Image;
|
|
|
|
import com.threerings.media.util.ImageUtil;
|
|
|
|
/**
|
|
* The single frame image class is a basic implementation of the {@link
|
|
* MultiFrameImage} interface intended to facilitate the creation of MFIs
|
|
* whose display frames consist of only a single image.
|
|
*/
|
|
public class SingleFrameImageImpl implements MultiFrameImage
|
|
{
|
|
/**
|
|
* Constructs a single frame image object.
|
|
*/
|
|
public SingleFrameImageImpl (Image img)
|
|
{
|
|
_img = img;
|
|
}
|
|
|
|
// documentation inherited
|
|
public int getFrameCount ()
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
// documentation inherited from interface
|
|
public int getWidth (int index)
|
|
{
|
|
return _img.getWidth(null);
|
|
}
|
|
|
|
// documentation inherited from interface
|
|
public int getHeight (int index)
|
|
{
|
|
return _img.getHeight(null);
|
|
}
|
|
|
|
// documentation inherited from interface
|
|
public void paintFrame (Graphics g, int index, int x, int y)
|
|
{
|
|
g.drawImage(_img, x, y, null);
|
|
}
|
|
|
|
// documentation inherited from interface
|
|
public boolean hitTest (int index, int x, int y)
|
|
{
|
|
return ImageUtil.hitTest(_img, x, y);
|
|
}
|
|
|
|
/** The frame image. */
|
|
protected Image _img;
|
|
}
|