Changed MultiFrameImage around so that it retains total control over its

internal images and doesn't necessarily need to decode them into multiple
images or even have actual images at all. This cleans things up and paves
the way for our "trimmed" image support which is forthcoming.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1335 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-05-04 19:35:31 +00:00
parent 0492637aa0
commit 47e38b4fa8
4 changed files with 82 additions and 46 deletions
@@ -1,10 +1,13 @@
//
// $Id: SingleFrameImageImpl.java,v 1.1 2001/10/25 18:06:17 shaper Exp $
// $Id: SingleFrameImageImpl.java,v 1.2 2002/05/04 19:35:31 mdb Exp $
package com.threerings.media.sprite;
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
@@ -27,10 +30,28 @@ public class SingleFrameImageImpl implements MultiFrameImage
return 1;
}
// documentation inherited
public Image getFrame (int index)
// documentation inherited from interface
public int getWidth (int index)
{
return _img;
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. */