Major media subsystem revamp:
- All images are loaded through the image manager - Architected to allow the use of prepared or unprepared images (and volatile images when the day comes that they support alpha) - Tunable caches for images and tiles - Resource manager caches unpacked resources on the filesystem - Various and sundry other cleanups git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2116 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
//
|
||||
// $Id: MultiFrameImage.java,v 1.3 2002/09/17 19:11:13 mdb Exp $
|
||||
// $Id: MultiFrameImage.java,v 1.4 2003/01/13 22:49:47 mdb Exp $
|
||||
|
||||
package com.threerings.media.util;
|
||||
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Image;
|
||||
import java.awt.Graphics2D;
|
||||
|
||||
/**
|
||||
* The multi-frame image interface provides encapsulated access to a set
|
||||
@@ -31,7 +30,7 @@ public interface MultiFrameImage
|
||||
* Renders the specified frame into the specified graphics object at
|
||||
* the specified coordinates.
|
||||
*/
|
||||
public void paintFrame (Graphics g, int index, int x, int y);
|
||||
public void paintFrame (Graphics2D g, int index, int x, int y);
|
||||
|
||||
/**
|
||||
* Returns true if the specified frame contains a non-transparent
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
//
|
||||
// $Id: MultiFrameImageImpl.java,v 1.4 2003/01/08 04:09:03 mdb Exp $
|
||||
// $Id: MultiFrameImageImpl.java,v 1.5 2003/01/13 22:49:47 mdb Exp $
|
||||
|
||||
package com.threerings.media.util;
|
||||
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Image;
|
||||
import java.awt.Graphics2D;
|
||||
|
||||
import com.threerings.media.image.ImageUtil;
|
||||
import com.threerings.media.image.Mirage;
|
||||
|
||||
/**
|
||||
* A basic implementation of the {@link MultiFrameImage} interface
|
||||
@@ -18,41 +17,41 @@ public class MultiFrameImageImpl implements MultiFrameImage
|
||||
/**
|
||||
* Constructs a multiple frame image object.
|
||||
*/
|
||||
public MultiFrameImageImpl (Image[] imgs)
|
||||
public MultiFrameImageImpl (Mirage[] mirages)
|
||||
{
|
||||
_imgs = imgs;
|
||||
_mirages = mirages;
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
public int getFrameCount ()
|
||||
{
|
||||
return _imgs.length;
|
||||
return _mirages.length;
|
||||
}
|
||||
|
||||
// documentation inherited from interface
|
||||
public int getWidth (int index)
|
||||
{
|
||||
return _imgs[index].getWidth(null);
|
||||
return _mirages[index].getWidth();
|
||||
}
|
||||
|
||||
// documentation inherited from interface
|
||||
public int getHeight (int index)
|
||||
{
|
||||
return _imgs[index].getHeight(null);
|
||||
return _mirages[index].getHeight();
|
||||
}
|
||||
|
||||
// documentation inherited from interface
|
||||
public void paintFrame (Graphics g, int index, int x, int y)
|
||||
public void paintFrame (Graphics2D g, int index, int x, int y)
|
||||
{
|
||||
g.drawImage(_imgs[index], x, y, null);
|
||||
_mirages[index].paint(g, x, y);
|
||||
}
|
||||
|
||||
// documentation inherited from interface
|
||||
public boolean hitTest (int index, int x, int y)
|
||||
{
|
||||
return ImageUtil.hitTest(_imgs[index], x, y);
|
||||
return _mirages[index].hitTest(x, y);
|
||||
}
|
||||
|
||||
/** The frame images. */
|
||||
protected Image _imgs[];
|
||||
protected Mirage[] _mirages;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
//
|
||||
// $Id: SingleFrameImageImpl.java,v 1.4 2003/01/08 04:09:03 mdb Exp $
|
||||
// $Id: SingleFrameImageImpl.java,v 1.5 2003/01/13 22:49:47 mdb Exp $
|
||||
|
||||
package com.threerings.media.util;
|
||||
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Image;
|
||||
import java.awt.Graphics2D;
|
||||
|
||||
import com.threerings.media.image.ImageUtil;
|
||||
import com.threerings.media.image.Mirage;
|
||||
|
||||
/**
|
||||
* The single frame image class is a basic implementation of the {@link
|
||||
@@ -18,9 +17,9 @@ public class SingleFrameImageImpl implements MultiFrameImage
|
||||
/**
|
||||
* Constructs a single frame image object.
|
||||
*/
|
||||
public SingleFrameImageImpl (Image img)
|
||||
public SingleFrameImageImpl (Mirage mirage)
|
||||
{
|
||||
_img = img;
|
||||
_mirage = mirage;
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
@@ -32,27 +31,27 @@ public class SingleFrameImageImpl implements MultiFrameImage
|
||||
// documentation inherited from interface
|
||||
public int getWidth (int index)
|
||||
{
|
||||
return _img.getWidth(null);
|
||||
return _mirage.getWidth();
|
||||
}
|
||||
|
||||
// documentation inherited from interface
|
||||
public int getHeight (int index)
|
||||
{
|
||||
return _img.getHeight(null);
|
||||
return _mirage.getHeight();
|
||||
}
|
||||
|
||||
// documentation inherited from interface
|
||||
public void paintFrame (Graphics g, int index, int x, int y)
|
||||
public void paintFrame (Graphics2D g, int index, int x, int y)
|
||||
{
|
||||
g.drawImage(_img, x, y, null);
|
||||
_mirage.paint(g, x, y);
|
||||
}
|
||||
|
||||
// documentation inherited from interface
|
||||
public boolean hitTest (int index, int x, int y)
|
||||
{
|
||||
return ImageUtil.hitTest(_img, x, y);
|
||||
return _mirage.hitTest(x, y);
|
||||
}
|
||||
|
||||
/** The frame image. */
|
||||
protected Image _img;
|
||||
protected Mirage _mirage;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
//
|
||||
// $Id: SingleTileImageImpl.java,v 1.1 2003/01/13 22:49:47 mdb Exp $
|
||||
|
||||
package com.threerings.media.util;
|
||||
|
||||
import java.awt.Graphics2D;
|
||||
|
||||
import com.threerings.media.tile.Tile;
|
||||
|
||||
/**
|
||||
* 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 tile image.
|
||||
*/
|
||||
public class SingleTileImageImpl implements MultiFrameImage
|
||||
{
|
||||
/**
|
||||
* Constructs a single frame image object.
|
||||
*/
|
||||
public SingleTileImageImpl (Tile tile)
|
||||
{
|
||||
_tile = tile;
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
public int getFrameCount ()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
// documentation inherited from interface
|
||||
public int getWidth (int index)
|
||||
{
|
||||
return _tile.getWidth();
|
||||
}
|
||||
|
||||
// documentation inherited from interface
|
||||
public int getHeight (int index)
|
||||
{
|
||||
return _tile.getHeight();
|
||||
}
|
||||
|
||||
// documentation inherited from interface
|
||||
public void paintFrame (Graphics2D g, int index, int x, int y)
|
||||
{
|
||||
_tile.paint(g, x, y);
|
||||
}
|
||||
|
||||
// documentation inherited from interface
|
||||
public boolean hitTest (int index, int x, int y)
|
||||
{
|
||||
return _tile.hitTest(x, y);
|
||||
}
|
||||
|
||||
/** The frame image. */
|
||||
protected Tile _tile;
|
||||
}
|
||||
Reference in New Issue
Block a user