Package com.badlogic.gdx.graphics.g2d
Class TextureAtlas.AtlasRegion
- java.lang.Object
-
- com.badlogic.gdx.graphics.g2d.TextureRegion
-
- com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion
-
- Enclosing class:
- TextureAtlas
public static class TextureAtlas.AtlasRegion extends TextureRegion
Describes the region of a packed image and provides information about the original image before it was packed.
-
-
Field Summary
Fields Modifier and Type Field Description intdegreesThe degrees the region has been rotated, counter clockwise between 0 and 359.intindexThe number at the end of the original image file name, or -1 if none.
When sprites are packed, if the original file name ends with a number, it is stored as the index and is not considered as part of the sprite's name.java.lang.StringnameThe name of the original image file, without the file's extension.
If the name ends with an underscore followed by only numbers, that part is excluded: underscores denote special instructions to the texture packer.java.lang.String[]namesNames for name/value pairs other than the fields provided on this class, each entry corresponding tovalues.floatoffsetXThe offset from the left of the original image to the left of the packed image, after whitespace was removed for packing.floatoffsetYThe offset from the bottom of the original image to the bottom of the packed image, after whitespace was removed for packing.intoriginalHeightThe height of the image, before whitespace was removed for packing.intoriginalWidthThe width of the image, before whitespace was removed and rotation was applied for packing.intpackedHeightThe height of the image, after whitespace was removed for packing.intpackedWidthThe width of the image, after whitespace was removed for packing.booleanrotateIf true, the region has been rotated 90 degrees counter clockwise.int[][]valuesValues for name/value pairs other than the fields provided on this class, each entry corresponding tonames.
-
Constructor Summary
Constructors Constructor Description AtlasRegion(TextureAtlas.AtlasRegion region)AtlasRegion(TextureRegion region)AtlasRegion(Texture texture, int x, int y, int width, int height)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int[]findValue(java.lang.String name)voidflip(boolean x, boolean y)floatgetRotatedPackedHeight()Returns the packed height considering therotatevalue, if it is true then it returns the packedWidth, otherwise it returns the packedHeight.floatgetRotatedPackedWidth()Returns the packed width considering therotatevalue, if it is true then it returns the packedHeight, otherwise it returns the packedWidth.java.lang.StringtoString()-
Methods inherited from class com.badlogic.gdx.graphics.g2d.TextureRegion
getRegionHeight, getRegionWidth, getRegionX, getRegionY, getTexture, getU, getU2, getV, getV2, isFlipX, isFlipY, scroll, setRegion, setRegion, setRegion, setRegion, setRegion, setRegionHeight, setRegionWidth, setRegionX, setRegionY, setTexture, setU, setU2, setV, setV2, split, split
-
-
-
-
Field Detail
-
index
public int index
The number at the end of the original image file name, or -1 if none.
When sprites are packed, if the original file name ends with a number, it is stored as the index and is not considered as part of the sprite's name. This is useful for keeping animation frames in order.- See Also:
TextureAtlas.findRegions(String)
-
name
public java.lang.String name
The name of the original image file, without the file's extension.
If the name ends with an underscore followed by only numbers, that part is excluded: underscores denote special instructions to the texture packer.
-
offsetX
public float offsetX
The offset from the left of the original image to the left of the packed image, after whitespace was removed for packing.
-
offsetY
public float offsetY
The offset from the bottom of the original image to the bottom of the packed image, after whitespace was removed for packing.
-
packedWidth
public int packedWidth
The width of the image, after whitespace was removed for packing.
-
packedHeight
public int packedHeight
The height of the image, after whitespace was removed for packing.
-
originalWidth
public int originalWidth
The width of the image, before whitespace was removed and rotation was applied for packing.
-
originalHeight
public int originalHeight
The height of the image, before whitespace was removed for packing.
-
rotate
public boolean rotate
If true, the region has been rotated 90 degrees counter clockwise.
-
degrees
public int degrees
The degrees the region has been rotated, counter clockwise between 0 and 359. Most atlas region handling deals only with 0 or 90 degree rotation (enough to handle rectangles). More advanced texture packing may support other rotations (eg, for tightly packing polygons).
-
names
@Null public java.lang.String[] names
Names for name/value pairs other than the fields provided on this class, each entry corresponding tovalues.
-
-
Constructor Detail
-
AtlasRegion
public AtlasRegion(Texture texture, int x, int y, int width, int height)
-
AtlasRegion
public AtlasRegion(TextureAtlas.AtlasRegion region)
-
AtlasRegion
public AtlasRegion(TextureRegion region)
-
-
Method Detail
-
flip
public void flip(boolean x, boolean y)- Overrides:
flipin classTextureRegion
-
getRotatedPackedWidth
public float getRotatedPackedWidth()
Returns the packed width considering therotatevalue, if it is true then it returns the packedHeight, otherwise it returns the packedWidth.
-
getRotatedPackedHeight
public float getRotatedPackedHeight()
Returns the packed height considering therotatevalue, if it is true then it returns the packedWidth, otherwise it returns the packedHeight.
-
findValue
@Null public int[] findValue(java.lang.String name)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-