Class GuillotinePacker
- Namespace
- Stride.Core.Mathematics
- Assembly
- Stride.Core.Mathematics.dll
Implementation of a "Guillotine" packer. More information at http://clb.demon.fi/files/RectangleBinPack.pdf.
public class GuillotinePacker
- Inheritance
-
GuillotinePacker
Properties
Height
Current height used by the packer.
public int Height { get; }
Property Value
Width
Current width used by the packer.
public int Width { get; }
Property Value
Methods
Clear()
Clears the whole region.
public virtual void Clear()
Clear(int, int)
Clears the specified region.
public void Clear(int width, int height)
Parameters
Free(ref Rectangle)
Frees the specified old rectangle.
public void Free(ref Rectangle oldRectangle)
Parameters
oldRectangleRectangleThe old rectangle.
Insert(int, int, 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
widthintWidth requested.
heightintHeight requested
bestRectangleRectangleFill with the rectangle if it was successfully inserted.
Returns
- bool
trueif it was successfully inserted.
TryInsert(int, int, int, InsertRectangleCallback)
Tries to fit multiple rectangle with (width, height).
public bool TryInsert(int width, int height, int count, GuillotinePacker.InsertRectangleCallback inserted)
Parameters
widthintWidth requested.
heightintHeight requested
countintThe number of rectangle to fit.
insertedGuillotinePacker.InsertRectangleCallbackA callback called for each rectangle successfully fitted.
Returns
- bool
trueif all rectangles were successfully fitted.