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 Details

    • copy

      public TextureSet.Texture copy()
      Returns:
      a copy of this texture.
    • getName

      public String 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

      public TextureSet.Patch createPatch(String name)
      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

      public TextureSet.Patch removePatch(int index)
      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

      public TextureSet.Patch getPatch(int index)
      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

      public Iterator<TextureSet.Patch> iterator()
      Specified by:
      iterator in interface Iterable<TextureSet.Patch>
    • size

      public int size()
      Specified by:
      size in interface Sizable
      Returns:
      the amount of individual objects that this object contains.
    • 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 if Sizable.size() returns 0.
      Specified by:
      isEmpty in interface Sizable
      Returns:
      true if so, false otherwise.