Class SpriteSheet
- java.lang.Object
-
- nl.colorize.multimedialib.graphics.SpriteSheet
-
public class SpriteSheet extends java.lang.ObjectImage that contains the graphics for multiple sprites by including them as named regions witin the image.
-
-
Constructor Summary
Constructors Constructor Description SpriteSheet(Image image)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Imageget(java.lang.String name)Returns the image for the marked region with the specified name.java.util.List<Image>get(java.lang.String firstRegionName, java.lang.String secondRegionName, java.lang.String... rest)Returns a sequence of images that correspond to names regions.ImagegetImage()Deprecated.RectgetRegion(java.lang.String name)java.util.Set<java.lang.String>getRegionNames()ImagemarkRegion(java.lang.String name, Rect region)Marks a region within the sprite sheet and returns the corresponding sun-image.
-
-
-
Constructor Detail
-
SpriteSheet
public SpriteSheet(Image image)
-
-
Method Detail
-
markRegion
public Image markRegion(java.lang.String name, Rect region)
Marks a region within the sprite sheet and returns the corresponding sun-image. The sub-image can also be retrieved at a later time usingget(String).- Throws:
java.lang.IllegalArgumentException- if the region does not fit within the sprite sheet image, or if a region with the same name already exists.
-
get
public Image get(java.lang.String name)
Returns the image for the marked region with the specified name.- Throws:
java.lang.IllegalArgumentException- if no such region has been marked.
-
get
public java.util.List<Image> get(java.lang.String firstRegionName, java.lang.String secondRegionName, java.lang.String... rest)
Returns a sequence of images that correspond to names regions.- Throws:
java.lang.IllegalArgumentException- if no such region has been marked.
-
getRegion
public Rect getRegion(java.lang.String name)
-
getRegionNames
public java.util.Set<java.lang.String> getRegionNames()
-
getImage
@Deprecated public Image getImage()
Deprecated.
-
-