Class GuillotinePacker
- Namespace
- Stride.Core.Mathematics
- Assembly
- Stride.Core.Mathematics.dll
Implementation of a "Guillotine" packer. More information at https://github.com/juj/RectangleBinPack/blob/master/RectangleBinPack.pdf.
public class GuillotinePacker- Inheritance
- 
      objectGuillotinePacker
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
- oldRectangleRectangle
- The 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
- widthint
- Width requested. 
- heightint
- Height requested 
- bestRectangleRectangle
- Fill 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
- widthint
- Width requested. 
- heightint
- Height requested 
- countint
- The number of rectangle to fit. 
- insertedGuillotinePacker.InsertRectangleCallback
- A callback called for each rectangle successfully fitted. 
Returns
- bool
- trueif all rectangles were successfully fitted.