Class TextureAtlas.AtlasRegion
java.lang.Object
gaiasky.util.gdx.g2d.TextureRegion
gaiasky.util.gdx.g2d.TextureAtlas.AtlasRegion
- Enclosing class:
TextureAtlas
Describes the region of a packed image and provides information about the original image before it was packed.
-
Field Summary
FieldsModifier and TypeFieldDescriptionintThe 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.The name of the original image file, up to the first underscore.floatThe offset from the left of the original image to the left of the packed image, after whitespace was removed for packing.floatThe offset from the bottom of the original image to the bottom of the packed image, after whitespace was removed for packing.intThe height of the image, before whitespace was removed for packing.intThe width of the image, before whitespace was removed and rotation was applied for packing.intThe height of the image, after whitespace was removed for packing.intThe width of the image, after whitespace was removed for packing.int[]The nine-patch pads, or null if not a nine-patch or the has no padding.booleanIf true, the region has been rotated 90 degrees counter-clockwise.int[]The nine-patch splits, or null if not a nine-patch. -
Constructor Summary
ConstructorsConstructorDescriptionAtlasRegion(com.badlogic.gdx.graphics.Texture texture, int x, int y, int width, int height) AtlasRegion(TextureAtlas.AtlasRegion region) -
Method Summary
Modifier and TypeMethodDescriptionvoidflip(boolean x, boolean y) Flips the region, adjusting the offset so the image appears to be flip as if no whitespace has been removed for packing.floatReturns the packed height considering the rotate value, if it is true then it returns the packedWidth, otherwise it returns the packedHeight.floatReturns the packed width considering the rotate value, if it is true then it returns the packedHeight, otherwise it returns the packedWidth.toString()Methods inherited from class 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 Details
-
index
public int indexThe 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:
-
name
The name of the original image file, up to the first underscore. Underscores denote special instructions to the texture packer. -
offsetX
public float offsetXThe offset from the left of the original image to the left of the packed image, after whitespace was removed for packing. -
offsetY
public float offsetYThe offset from the bottom of the original image to the bottom of the packed image, after whitespace was removed for packing. -
packedWidth
public int packedWidthThe width of the image, after whitespace was removed for packing. -
packedHeight
public int packedHeightThe height of the image, after whitespace was removed for packing. -
originalWidth
public int originalWidthThe width of the image, before whitespace was removed and rotation was applied for packing. -
originalHeight
public int originalHeightThe height of the image, before whitespace was removed for packing. -
rotate
public boolean rotateIf true, the region has been rotated 90 degrees counter-clockwise. -
splits
public int[] splitsThe nine-patch splits, or null if not a nine-patch. Has 4 elements: left, right, top, bottom. -
pads
public int[] padsThe nine-patch pads, or null if not a nine-patch or the has no padding. Has 4 elements: left, right, top, bottom.
-
-
Constructor Details
-
AtlasRegion
public AtlasRegion(com.badlogic.gdx.graphics.Texture texture, int x, int y, int width, int height) -
AtlasRegion
-
-
Method Details
-
flip
public void flip(boolean x, boolean y) Flips the region, adjusting the offset so the image appears to be flip as if no whitespace has been removed for packing.- Overrides:
flipin classTextureRegion
-
getRotatedPackedWidth
public float getRotatedPackedWidth()Returns the packed width considering the rotate value, if it is true then it returns the packedHeight, otherwise it returns the packedWidth. -
getRotatedPackedHeight
public float getRotatedPackedHeight()Returns the packed height considering the rotate value, if it is true then it returns the packedWidth, otherwise it returns the packedHeight. -
toString
-