Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    GuillotinePacker Class

    Namespace: Stride.Core.Mathematics
    Assembly: Stride.Core.Mathematics.dll

    Implementation of a "Guillotine" packer. More information at http://clb.demon.fi/files/RectangleBinPack.pdf.

    System.Object → GuillotinePacker
    Derived from GuillotinePacker:

    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).

    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    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

    true if it was successfully inserted.


    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

    true if all rectangles were successfully fitted.


    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation