FileDocCategorySizeDatePackage
Atlas.javaAPI DocAndroid 5.1 API15770Thu Mar 12 22:22:30 GMT 2015android.graphics

Atlas

public class Atlas extends Object
hide

Fields Summary
public static final int
FLAG_ALLOW_ROTATIONS
This flag indicates whether the packing algorithm will attempt to rotate entries to make them fit better in the atlas.
public static final int
FLAG_ADD_PADDING
This flag indicates whether the packing algorithm should leave an empty 1 pixel wide border around each bitmap. This border can be useful if the content of the atlas will be used in OpenGL using bilinear filtering.
public static final int
FLAG_DEFAULTS
Default flags: allow rotations and add padding.
private final Policy
mPolicy
Constructors Summary
public Atlas(Type type, int width, int height)
Creates a new atlas with the specified algorithm and dimensions in pixels. Calling this constructor is equivalent to calling {@link #Atlas(Atlas.Type, int, int, int)} with {@link #FLAG_DEFAULTS}.

param
type The algorithm to use to pack rectangles in the atlas
param
width The width of the atlas in pixels
param
height The height of the atlas in pixels
see
#Atlas(Atlas.Type, int, int, int)


                                                                       
           
        this(type, width, height, FLAG_DEFAULTS);
    
public Atlas(Type type, int width, int height, int flags)
Creates a new atlas with the specified algorithm and dimensions in pixels. A set of flags can also be specified to control the behavior of the atlas.

param
type The algorithm to use to pack rectangles in the atlas
param
width The width of the atlas in pixels
param
height The height of the atlas in pixels
param
flags Optional flags to control the behavior of the atlas: {@link #FLAG_ADD_PADDING}, {@link #FLAG_ALLOW_ROTATIONS}
see
#Atlas(Atlas.Type, int, int)

        mPolicy = findPolicy(type, width, height, flags);
    
Methods Summary
private static android.graphics.Atlas$PolicyfindPolicy(android.graphics.Atlas$Type type, int width, int height, int flags)

        switch (type) {
            case SliceMinArea:
                return new SlicePolicy(width, height, flags,
                        new SlicePolicy.MinAreaSplitDecision());
            case SliceMaxArea:
                return new SlicePolicy(width, height, flags,
                        new SlicePolicy.MaxAreaSplitDecision());
            case SliceShortAxis:
                return new SlicePolicy(width, height, flags,
                        new SlicePolicy.ShorterFreeAxisSplitDecision());
            case SliceLongAxis:
                return new SlicePolicy(width, height, flags,
                        new SlicePolicy.LongerFreeAxisSplitDecision());
        }
        return null;
    
public android.graphics.Atlas$Entrypack(int width, int height)
Packs a rectangle of the specified dimensions in this atlas.

param
width The width of the rectangle to pack in the atlas
param
height The height of the rectangle to pack in the atlas
return
An {@link Entry} instance if the rectangle was packed in the atlas, or null if the rectangle could not fit
see
#pack(int, int, Atlas.Entry)

        return pack(width, height, null);
    
public android.graphics.Atlas$Entrypack(int width, int height, android.graphics.Atlas$Entry entry)
Packs a rectangle of the specified dimensions in this atlas.

param
width The width of the rectangle to pack in the atlas
param
height The height of the rectangle to pack in the atlas
param
entry Out parameter that will be filled in with the location and attributes of the packed rectangle, can be null
return
An {@link Entry} instance if the rectangle was packed in the atlas, or null if the rectangle could not fit
see
#pack(int, int)

        if (entry == null) entry = new Entry();
        return mPolicy.pack(width, height, entry);