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
oldRectangle
RectangleThe 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
width
intWidth requested.
height
intHeight requested
bestRectangle
RectangleFill with the rectangle if it was successfully inserted.
Returns
- bool
true
if 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
width
intWidth requested.
height
intHeight requested
count
intThe number of rectangle to fit.
inserted
GuillotinePacker.InsertRectangleCallbackA callback called for each rectangle successfully fitted.
Returns
- bool
true
if all rectangles were successfully fitted.