Package gov.nasa.worldwind.util
Class TextureAtlas.Entry
- java.lang.Object
-
- gov.nasa.worldwind.util.TextureAtlas.Entry
-
- All Implemented Interfaces:
java.lang.Comparable<TextureAtlas.Entry>
- Enclosing class:
- TextureAtlas
protected static class TextureAtlas.Entry extends java.lang.Object implements java.lang.Comparable<TextureAtlas.Entry>
Represents an image element in a texture atlas. Each entry indicates the element's key, the image's rectangle in the backing image, the actual image's offset within that rectangle, the image's actual width and height, and a timestamp indicating the last time the element was used. Implements theComparable
interface by comparing the lastUsed timestamp, ordered from least recently used to most recently used.
-
-
Field Summary
Fields Modifier and Type Field Description int
imageHeight
Indicates the element's image height.int
imageOffsetX
Indicates the element's image X offset withing the bounding rectangle.int
imageOffsetY
Indicates the element's image Y offset withing the bounding rectangle.int
imageWidth
Indicates the element's image width.java.lang.Object
key
Indicates the element's key.long
lastUsed
Indicates the last time this entry was used.com.jogamp.opengl.util.packrect.Rect
rect
Indicates the element's bounding rectangle within the texture atlas.
-
Constructor Summary
Constructors Constructor Description Entry(java.lang.Object key, com.jogamp.opengl.util.packrect.Rect rect, int imageOffsetX, int imageOffsetY, int imageWidth, int imageHeight)
Constructs a texture atlas entry corresponding with a texture atlas element with the specified key, bounding rectangle, and image offsets within the bounding rectangle.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(TextureAtlas.Entry that)
Compares this texture atlas entry's last used timestamp to that of the specified entry.
-
-
-
Field Detail
-
key
public final java.lang.Object key
Indicates the element's key. Initialized during construction.
-
rect
public com.jogamp.opengl.util.packrect.Rect rect
Indicates the element's bounding rectangle within the texture atlas. Initialized during construction.
-
imageOffsetX
public int imageOffsetX
Indicates the element's image X offset withing the bounding rectangle. Initialized during construction.
-
imageOffsetY
public int imageOffsetY
Indicates the element's image Y offset withing the bounding rectangle. Initialized during construction.
-
imageWidth
public int imageWidth
Indicates the element's image width. May be smaller than the bounding rectangle's width. Initialized during construction.
-
imageHeight
public int imageHeight
Indicates the element's image height. May be smaller than the bounding rectangle's height. Initialized during construction.
-
lastUsed
public long lastUsed
Indicates the last time this entry was used.
-
-
Constructor Detail
-
Entry
public Entry(java.lang.Object key, com.jogamp.opengl.util.packrect.Rect rect, int imageOffsetX, int imageOffsetY, int imageWidth, int imageHeight)
Constructs a texture atlas entry corresponding with a texture atlas element with the specified key, bounding rectangle, and image offsets within the bounding rectangle.- Parameters:
key
- the element's key.rect
- the element's bounding rectangle within the texture atlas.imageOffsetX
- the element's image X offset withing the bounding rectangle.imageOffsetY
- the element's image Y offset withing the bounding rectangle.imageWidth
- the element's image width. May be smaller than the bounding rectangle's width.imageHeight
- the element's image height. May be smaller than the bounding rectangle's height.
-
-
Method Detail
-
compareTo
public int compareTo(TextureAtlas.Entry that)
Compares this texture atlas entry's last used timestamp to that of the specified entry. This returns -1 if this entry's last used time is earlier than the specified entry's, 0 if the two entries have the same last used time, and 1 if this entry's last used time is later than the specified entry's.- Specified by:
compareTo
in interfacejava.lang.Comparable<TextureAtlas.Entry>
- Parameters:
that
- the texture atlas entry this entry is compared to.- Returns:
- -1, 0, or 1 if this entry's last used time is earlier than, the same as, or later than the specified entry's last used time.
- Throws:
java.lang.IllegalArgumentException
- if the specified entry isnull
.
-
-