Package net.mtrop.doom.texture
Class TextureSet.Texture
java.lang.Object
net.mtrop.doom.texture.TextureSet.Texture
- All Implemented Interfaces:
Iterable<TextureSet.Patch>
,Sizable
- Enclosing class:
- TextureSet
public static class TextureSet.Texture
extends Object
implements Iterable<TextureSet.Patch>, Sizable
A class that represents a single composite Texture entry.
-
Method Summary
Modifier and TypeMethodDescriptioncopy()
createPatch
(String name) Adds a patch to this entry.int
getName()
getPatch
(int index) Returns a patch at a particular index.int
int
getWidth()
boolean
isEmpty()
Returns if this object contains no objects.iterator()
removePatch
(int index) Removes a patch at a particular index.void
setHeight
(int height) Sets the height of the texture in pixels.void
setWidth
(int width) Sets the width of the texture in pixels.void
shiftPatch
(int index, int newIndex) Shifts the ordering of a patch.int
size()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
copy
- Returns:
- a copy of this texture.
-
getName
- Returns:
- the texture entry name.
-
getWidth
public int getWidth()- Returns:
- the width of the texture in pixels.
-
setWidth
public void setWidth(int width) Sets the width of the texture in pixels.- Parameters:
width
- the new width.
-
getHeight
public int getHeight()- Returns:
- the height of the texture in pixels.
-
setHeight
public void setHeight(int height) Sets the height of the texture in pixels.- Parameters:
height
- the new height.
-
createPatch
Adds a patch to this entry.- Parameters:
name
- the name of the patch. Must be valid.- Returns:
- the created patch.
- Throws:
IllegalArgumentException
- if the patch name is empty or not a valid entry name.- See Also:
-
removePatch
Removes a patch at a particular index.- Parameters:
index
- the new index.- Returns:
- the corresponding removed patch, or
null
if no such patch at that index.
-
getPatch
Returns a patch at a particular index.- Parameters:
index
- the index to use.- Returns:
- the corresponding patch, or
null
if no such patch at that index.
-
shiftPatch
public void shiftPatch(int index, int newIndex) Shifts the ordering of a patch.- Parameters:
index
- the index to shift.newIndex
- the new index for the patch.
-
getPatchCount
public int getPatchCount()- Returns:
- how many patches are on this texture entry.
-
iterator
- Specified by:
iterator
in interfaceIterable<TextureSet.Patch>
-
size
public int size() -
isEmpty
public boolean isEmpty()Description copied from interface:Sizable
Returns if this object contains no objects. The general policy of this method is that this returns true if and only ifSizable.size()
returns 0.
-