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.
- Author:
- Matthew Tropiano
-
Method Summary
Modifier and TypeMethodDescriptioncopy()createPatch(String name) Adds a patch to this entry.intgetName()getPatch(int index) Returns a patch at a particular index.intintgetWidth()booleanisEmpty()Returns if this object contains no objects.iterator()removePatch(int index) Removes a patch at a particular index.voidsetHeight(int height) Sets the height of the texture in pixels.voidsetWidth(int width) Sets the width of the texture in pixels.voidshiftPatch(int index, int newIndex) Shifts the ordering of a patch.intsize()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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
nullif 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
nullif 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:
iteratorin interfaceIterable<TextureSet.Patch>
-
size
-
isEmpty
public boolean isEmpty()Description copied from interface:SizableReturns if this object contains no objects. The general policy of this method is that this returns true if and only ifSizable.size()returns 0.
-