NGUI: Next-Gen UI kit  3.7.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros
UITexturePacker Class Reference

Public Types

enum  FreeRectChoiceHeuristic {
  FreeRectChoiceHeuristic.RectBestShortSideFit, FreeRectChoiceHeuristic.RectBestLongSideFit, FreeRectChoiceHeuristic.RectBestAreaFit, FreeRectChoiceHeuristic.RectBottomLeftRule,
  FreeRectChoiceHeuristic.RectContactPointRule
}
 

Public Member Functions

 UITexturePacker (int width, int height, bool rotations)
 
void Init (int width, int height, bool rotations)
 
Rect Insert (int width, int height, FreeRectChoiceHeuristic method)
 
void Insert (List< Rect > rects, List< Rect > dst, FreeRectChoiceHeuristic method)
 
float Occupancy ()
 Computes the ratio of used surface area. More...
 

Static Public Member Functions

static Rect[] PackTextures (Texture2D texture, Texture2D[] textures, int width, int height, int padding, int maxSize)
 

Public Attributes

int binWidth = 0
 
int binHeight = 0
 
bool allowRotations
 
List< Rect > usedRectangles = new List<Rect>()
 
List< Rect > freeRectangles = new List<Rect>()
 

Member Enumeration Documentation

Enumerator
RectBestShortSideFit 

-BSSF: Positions the rectangle against the short side of a free rectangle into which it fits the best.

RectBestLongSideFit 

-BLSF: Positions the rectangle against the long side of a free rectangle into which it fits the best.

RectBestAreaFit 

-BAF: Positions the rectangle into the smallest free rect into which it fits.

RectBottomLeftRule 

-BL: Does the Tetris placement.

RectContactPointRule 

-CP: Choosest the placement where the rectangle touches other rects as much as possible.

Constructor & Destructor Documentation

UITexturePacker.UITexturePacker ( int  width,
int  height,
bool  rotations 
)

Member Function Documentation

void UITexturePacker.Init ( int  width,
int  height,
bool  rotations 
)
Rect UITexturePacker.Insert ( int  width,
int  height,
FreeRectChoiceHeuristic  method 
)
void UITexturePacker.Insert ( List< Rect >  rects,
List< Rect >  dst,
FreeRectChoiceHeuristic  method 
)
float UITexturePacker.Occupancy ( )

Computes the ratio of used surface area.

static Rect [] UITexturePacker.PackTextures ( Texture2D  texture,
Texture2D[]  textures,
int  width,
int  height,
int  padding,
int  maxSize 
)
static

Member Data Documentation

bool UITexturePacker.allowRotations
int UITexturePacker.binHeight = 0
int UITexturePacker.binWidth = 0
List<Rect> UITexturePacker.freeRectangles = new List<Rect>()
List<Rect> UITexturePacker.usedRectangles = new List<Rect>()

The documentation for this class was generated from the following file: