public class RectanglePacker extends Object
Constructor and Description |
---|
RectanglePacker(BackingStoreManager manager,
int initialWidth,
int initialHeight) |
Modifier and Type | Method and Description |
---|---|
void |
add(Rect rect)
Decides upon an (x, y) position for the given rectangle (leaving
its width and height unchanged) and places it on the backing
store.
|
void |
clear()
Clears all Rects contained in this RectanglePacker.
|
void |
compact()
Forces a compaction cycle, which typically results in allocating
a new backing store and copying all entries to it.
|
void |
dispose()
Disposes the backing store allocated by the
BackingStoreManager.
|
Object |
getBackingStore() |
void |
remove(Rect rect)
Removes the given rectangle from this RectanglePacker.
|
void |
setMaxSize(int maxWidth,
int maxHeight)
Sets up a maximum width and height for the backing store.
|
float |
verticalFragmentationRatio()
Returns the vertical fragmentation ratio of this
RectanglePacker.
|
void |
visit(RectVisitor visitor)
Visits all Rects contained in this RectanglePacker.
|
public RectanglePacker(BackingStoreManager manager, int initialWidth, int initialHeight)
public Object getBackingStore()
public void setMaxSize(int maxWidth, int maxHeight)
public void add(Rect rect) throws RuntimeException
BackingStoreManager.preExpand
does not clear enough space for the incoming rectangle, then
this method will throw a RuntimeException.RuntimeException
public void remove(Rect rect)
public void visit(RectVisitor visitor)
public float verticalFragmentationRatio()
public void compact()
public void clear()
public void dispose()
Copyright 2010 JogAmp Community.