stbrp_setup_allow_out_of_mem function

  1. @Native<Void Function(Pointer<stbrp_context>, Int)>(ffi.Pointer<stbrp_context>, ffi.Int)>()
void stbrp_setup_allow_out_of_mem(
  1. Pointer<stbrp_context> context,
  2. int allow_out_of_mem
)

Initialize a rectangle packer to: pack a rectangle that is 'width' by 'height' in dimensions using temporary storage provided by the array 'nodes', which is 'num_nodes' long

You must call this function every time you start packing into a new target.

There is no "shutdown" function. The 'nodes' memory must stay valid for the following stbrp_pack_rects() call (or calls), but can be freed after the call (or calls) finish.

Note: to guarantee best results, either:

  1. make sure 'num_nodes' >= 'width' or 2. call stbrp_allow_out_of_mem() defined below with 'allow_out_of_mem = 1'

If you don't do either of the above things, widths will be quantized to multiples of small integers to guarantee the algorithm doesn't run out of temporary storage.

If you do #2, then the non-quantized algorithm will be used, but the algorithm may run out of temporary storage and be unable to pack some rectangles.

Implementation

@ffi.Native<ffi.Void Function(ffi.Pointer<stbrp_context>, ffi.Int)>()
external void stbrp_setup_allow_out_of_mem(
  ffi.Pointer<stbrp_context> context,
  int allow_out_of_mem,
);