libgdx API

com.badlogic.gdx.graphics.g2d
Class TextureAtlas.AtlasRegion

java.lang.Object
  extended by com.badlogic.gdx.graphics.g2d.TextureRegion
      extended by 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
 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.
 java.lang.String name
          The name of the original image file, up to the first underscore.
 float offsetX
          The offset from the left of the original image to the left of the packed image, after whitespace was removed for packing.
 float offsetY
          The offset from the bottom of the original image to the bottom of the packed image, after whitespace was removed for packing.
 int originalHeight
          The height of the image, before whitespace was removed for packing.
 int originalWidth
          The width of the image, before whitespace was removed for packing.
 int packedHeight
          The height of the image, after whitespace was removed for packing.
 int packedWidth
          The width of the image, after whitespace was removed for packing.
 boolean rotate
          If true, the region has been rotated 90 degrees counter clockwise.
 
Constructor Summary
TextureAtlas.AtlasRegion(TextureAtlas.AtlasRegion region)
           
TextureAtlas.AtlasRegion(Texture texture, int x, int y, int width, int height)
           
 
Method Summary
 void flip(boolean x, boolean y)
          Flips the region, adjusting the offset so the image appears to be flipped as if no whitespace has been removed for packing.
 
Methods inherited from class com.badlogic.gdx.graphics.g2d.TextureRegion
getRegionHeight, getRegionWidth, getRegionX, getRegionY, getTexture, getU, getU2, getV, getV2, scroll, setRegion, setRegion, setRegion, setRegion, setRegion, setRegionHeight, setRegionWidth, setRegionX, setRegionY, setTexture, setU, setU2, setV, setV2, split, split
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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, up to the first underscore. 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 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.

Constructor Detail

TextureAtlas.AtlasRegion

public TextureAtlas.AtlasRegion(Texture texture,
                                int x,
                                int y,
                                int width,
                                int height)

TextureAtlas.AtlasRegion

public TextureAtlas.AtlasRegion(TextureAtlas.AtlasRegion region)
Method Detail

flip

public void flip(boolean x,
                 boolean y)
Flips the region, adjusting the offset so the image appears to be flipped as if no whitespace has been removed for packing.

Overrides:
flip in class TextureRegion

libgdx API

Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)