GenImageFontAtlas method

(ImageD, List<RectangleD>) GenImageFontAtlas(
  1. List<GlyphInfoD> glyphs,
  2. num fontSize,
  3. num padding,
  4. num packMethod,
)

Implementation

(ImageD image, List<RectangleD> glyphRecs) GenImageFontAtlas(
  List<GlyphInfoD> glyphs,
  num fontSize,
  num padding,
  num packMethod,
) => run(
  () => 'GenImageFontAtlas(glyphs: ${glyphs.length}, $fontSize, $padding, $packMethod)',
  () {
    final recsPtr = rl.Temp.Ptr$Rectangle$.Raw();

    try {
      final image = _refCaptureImage(
        'GenImageFontAtlas_${glyphs.length}_${fontSize}_$padding',
        rl.Core.GenImageFontAtlas(
          _refListGlyphInfo(glyphs),
          recsPtr,
          glyphs.length,
          fontSize.toInt(),
          padding.toInt(),
          packMethod.toInt(),
        ),
      );

      final recs = List.generate(glyphs.length,
        (i) => (recsPtr.value + i).ref.toD()
      );

      return (image, recs);
    } finally {
      calloc.free(recsPtr);
    }
  },
);