import { Rectangle } from "../../../flash/geom/Rectangle";
/**
 * Class used to pack rectangles within container rectangle with close to optimal solution.
 */
export declare class RectanglePacker {
    static VERSION: string;
    private mWidth;
    private mHeight;
    private mPadding;
    private mPackedWidth;
    private mPackedHeight;
    private mInsertList;
    private mInsertedRectangles;
    private mFreeAreas;
    private mNewFreeAreas;
    private mOutsideRectangle;
    private mSortableSizeStack;
    private mRectangleStack;
    get rectangleCount(): number;
    get packedWidth(): number;
    get packedHeight(): number;
    get padding(): number;
    /**
     * Constructs new rectangle packer
     * @param width the width of the main rectangle
     * @param height the height of the main rectangle
     */
    constructor(width: number, height: number, padding?: number);
    /**
     * Resets the rectangle packer with given dimensions
     * @param width
     * @param height
     */
    reset(width: number, height: number, padding?: number): void;
    /**
     * Gets the position of the rectangle in given index in the main rectangle
     * @param index the index of the rectangle
     * @param rectangle an instance where to set the rectangle's values
     * @return
     */
    getRectangle(index: number, rectangle: Rectangle): Rectangle;
    /**
     * Gets the original id for the inserted rectangle in given index
     * @param index
     * @return
     */
    getRectangleId(index: number): number;
    /**
     * Add a rectangle to be packed into the packer
     * @width the width of inserted rectangle
     * @height the height of inserted rectangle
     * @id the identifier for this rectangle
     * @return true if inserted successfully
     */
    insertRectangle(width: number, height: number, id: number): void;
    private sortOn;
    /**
     * Packs the rectangles inserted
     * @param sort boolean defining whether to sort the inserted rectangles before packing
     * @return the number of the packed rectangles
     */
    packRectangles(sort?: Boolean): number;
    /**
     * Removes rectangles from the filteredAreas that are sub rectangles of any rectangle in areas.
     * @param areas rectangles from which the filtering is performed
     */
    private filterSelfSubAreas;
    /**
     * Checks what areas the given rectangle intersects, removes those areas and
     * returns the list of new areas those areas are divided into
     * @param target the new rectangle that is dividing the areas
     * @param areas the areas to be divided
     * @return list of new areas
     */
    private generateNewFreeAreas;
    /**
     * Divides the area into new sub areas around the divider.
     * @param divider rectangle that intersects the area
     * @param area rectangle to be divided into sub areas around the divider
     * @param results vector for the new sub areas around the divider
     */
    private generateDividedAreas;
    /**
     * Gets the index of the best free area for the given rectangle
     * @width the width of inserted rectangle
     * @height the height of inserted rectangle
     * @return index of the best free area or -1 if no suitable free area available
     */
    private getFreeAreaIndex;
    /**
     * Allocates new rectangle. If one available in stack uses that, otherwise new.
     * @param x
     * @param y
     * @param width
     * @param height
     * @return
     */
    private allocateRectangle;
    /**
     * Pushes the freed rectangle to rectangle stack. Make sure not to push same rectangle twice!
     * @param rectangle
     */
    private freeRectangle;
    /**
     * Allocates new sortable size instance. If one available in stack uses that, otherwise new.
     * @param width
     * @param height
     * @param id
     * @return
     */
    private allocateSize;
    /**
     * Pushes the freed sortable size to size stack. Make sure not to push same size twice!
     * @param size
     */
    private freeSize;
}
