public class Atlas extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Atlas.Entry
Represents a bitmap packed in the atlas.
|
static class |
Atlas.Type
Each type defines a different packing algorithm that can
be used by an
Atlas . |
Modifier and Type | Field and Description |
---|---|
static int |
FLAG_ADD_PADDING
This flag indicates whether the packing algorithm should leave
an empty 1 pixel wide border around each bitmap.
|
static int |
FLAG_DEFAULTS
Default flags: allow rotations and add padding.
|
Constructor and Description |
---|
Atlas(Atlas.Type type,
int width,
int height)
Creates a new atlas with the specified algorithm and dimensions
in pixels.
|
Atlas(Atlas.Type type,
int width,
int height,
int flags)
Creates a new atlas with the specified algorithm and dimensions
in pixels.
|
Modifier and Type | Method and Description |
---|---|
Atlas.Entry |
pack(int width,
int height)
Packs a rectangle of the specified dimensions in this atlas.
|
Atlas.Entry |
pack(int width,
int height,
Atlas.Entry entry)
Packs a rectangle of the specified dimensions in this atlas.
|
public static final int FLAG_ADD_PADDING
public static final int FLAG_DEFAULTS
public Atlas(Atlas.Type type, int width, int height)
Atlas(Atlas.Type, int, int, int)
with FLAG_DEFAULTS
.type
- The algorithm to use to pack rectangles in the atlaswidth
- The width of the atlas in pixelsheight
- The height of the atlas in pixelsAtlas(Atlas.Type, int, int, int)
public Atlas(Atlas.Type type, int width, int height, int flags)
type
- The algorithm to use to pack rectangles in the atlaswidth
- The width of the atlas in pixelsheight
- The height of the atlas in pixelsflags
- Optional flags to control the behavior of the atlas:
FLAG_ADD_PADDING
, #FLAG_ALLOW_ROTATIONS
Atlas(Atlas.Type, int, int)
public Atlas.Entry pack(int width, int height)
width
- The width of the rectangle to pack in the atlasheight
- The height of the rectangle to pack in the atlasAtlas.Entry
instance if the rectangle was packed in
the atlas, or null if the rectangle could not fitpack(int, int, Atlas.Entry)
public Atlas.Entry pack(int width, int height, Atlas.Entry entry)
width
- The width of the rectangle to pack in the atlasheight
- The height of the rectangle to pack in the atlasentry
- Out parameter that will be filled in with the location
and attributes of the packed rectangle, can be nullAtlas.Entry
instance if the rectangle was packed in
the atlas, or null if the rectangle could not fitpack(int, int)