GuillotinePacker Class
Namespace: Stride.Core.MathematicsAssembly: Stride.Core.Mathematics.dll
Implementation of a "Guillotine" packer. More information at http://clb.demon.fi/files/RectangleBinPack.pdf.
public class GuillotinePacker
Name | Description | |
---|---|---|
Properties | ||
Height | Current height used by the packer. |
|
Width | Current width used by the packer. |
|
Methods | ||
Clear() | Clears the whole region. |
|
Clear(Int32, Int32) | Clears the specified region. |
|
Free(ref Rectangle) | Frees the specified old rectangle. |
|
Insert(Int32, Int32, ref Rectangle) | Tries to fit a single rectangle with the specified width and height. |
|
TryInsert(Int32, Int32, Int32, GuillotinePacker.InsertRectangleCallback) | Tries to fit multiple rectangle with (width, height). |
Properties
Height
Current height used by the packer.
public int Height { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Width
Current width used by the packer.
public int Width { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
Clear()
Clears the whole region.
public virtual void Clear()
Clear(Int32, Int32)
Clears the specified region.
public void Clear(int width, int height)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | The width. |
System.Int32 | height | The height. |
Free(ref Rectangle)
Frees the specified old rectangle.
public void Free(ref Rectangle oldRectangle)
Parameters
Type | Name | Description |
---|---|---|
Rectangle | oldRectangle | The old rectangle. |
Insert(Int32, Int32, ref Rectangle)
Tries to fit a single rectangle with the specified width and height.
public bool Insert(int width, int height, ref Rectangle bestRectangle)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | Width requested. |
System.Int32 | height | Height requested |
Rectangle | bestRectangle | Fill with the rectangle if it was successfully inserted. |
Returns
Type | Description |
---|---|
System.Boolean |
|
TryInsert(Int32, Int32, Int32, GuillotinePacker.InsertRectangleCallback)
Tries to fit multiple rectangle with (width, height).
public bool TryInsert(int width, int height, int count, GuillotinePacker.InsertRectangleCallback inserted)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | Width requested. |
System.Int32 | height | Height requested |
System.Int32 | count | The number of rectangle to fit. |
GuillotinePacker.InsertRectangleCallback | inserted | A callback called for each rectangle successfully fitted. |
Returns
Type | Description |
---|---|
System.Boolean |
|