GenImageFontAtlas method

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

Generate image font atlas using chars info

Implementation

(ImageD image, List<RectangleD> glyphRecs) GenImageFontAtlas(
  List<GlyphInfoD> glyphs,
  num fontSize,
  num padding,
  num packMethod,
) => run(
  () => _debugLabels.GenImageFontAtlas(glyphs, fontSize, padding, packMethod),
  () {
    final recsPtr = $.Rectangle$.$.Raw();

    try {
      final image = _flat.GenImageFontAtlas(
        glyphs.first.getOp(),
        recsPtr,
        glyphs.length,
        fontSize.toInt(),
        padding.toInt(),
        packMethod.toInt(),
      );

      final innerPtr = recsPtr.readPtr();
      final recs = RectangleD.struct.ptr(innerPtr).readArray(glyphs.length);

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