fr.umlv.lawrence
Class AbstractImageProvider<E,S>
java.lang.Object
fr.umlv.lawrence.ImageProvider<E>
fr.umlv.lawrence.AbstractImageProvider<E,S>
- Type Parameters:
E - type of the elementsS - type of the sprites
- Direct Known Subclasses:
- BitmapImageProvider, SVGImageProvider
public abstract class AbstractImageProvider<E,S>
- extends ImageProvider<E>
Abstract Image provider, which does image scaling
- Author:
- Julien Cervelle
|
Method Summary |
protected abstract S |
parse(URL source)
|
void |
registerImage(E element,
S sprite)
Registers a sprite for an element. |
void |
registerImage(E element,
URL spriteSource)
Registers a sprite for an element has to be read from an URL. |
protected abstract Image |
render(S original,
int tileWidth,
int tileHeight)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractImageProvider
public AbstractImageProvider()
render
protected abstract Image render(S original,
int tileWidth,
int tileHeight)
parse
protected abstract S parse(URL source)
throws IOException
- Throws:
IOException
registerImage
public void registerImage(E element,
URL spriteSource)
- Description copied from class:
ImageProvider
- Registers a sprite for an element has to be read from an URL.
- Specified by:
registerImage in class ImageProvider<E>
- Parameters:
element - the object corresponding to the spritespriteSource - the source of the sprite- See Also:
Class.getResource(String)
registerImage
public void registerImage(E element,
S sprite)
- Registers a sprite for an element.
It is not possible to register different sprites for the same element.
- Parameters:
element - the object corresponding to the spritesprite - the sprite
- Throws:
IllegalArgumentException - if a sprite is already registered for the element
or if the image provider is in use.