public abstract class AbstractSpriteProvider extends Object implements SpriteProvider
Abstraction of the implementation of what is a SpriteProvider
.
Constructor and Description |
---|
AbstractSpriteProvider()
Builds a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addRegion(Region region,
String name)
Registers a new region in the image.
|
String |
convertAllowedName(String heapId,
String name)
Unified method to use to compute allowed name in sprite declaration.
|
protected ConvertibleNut |
getImage()
Gets the image.
|
protected Map<String,Region> |
getRegions()
Gets the regions.
|
void |
init(ConvertibleNut nut)
Initializes this provider with a new image.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getSprite
public void addRegion(Region region, String name)
Registers a new region in the image.
addRegion
in interface SpriteProvider
region
- the regionname
- the region namepublic void init(ConvertibleNut nut)
Initializes this provider with a new image. Previous regions will be cleared.
init
in interface SpriteProvider
nut
- the new imagepublic String convertAllowedName(String heapId, String name)
Unified method to use to compute allowed name in sprite declaration.
First of all, the heap ID is concatenated with the name separated by an underscore. The extension and parent path of the name will be removed. Finally, any character which is not a letter (in upper or lower case) will be replaced by an "underscore".
name
- the name to use in spriteprotected ConvertibleNut getImage()
Gets the image.
Copyright © 2012-2015. All Rights Reserved.