extractKittyCellImageId function

int extractKittyCellImageId(
  1. String grapheme,
  2. int fgArgb
)

Extracts the 32-bit Kitty imageId from a U+10EEEE placeholder grapheme and cell fgArgb without allocating coordinate records.

Implementation

int extractKittyCellImageId(String grapheme, int fgArgb) {
  final low24 = fgArgb & 0xFFFFFF;
  if (grapheme.length < 5) return low24;
  final msb = _diacriticToIndex[grapheme.codeUnitAt(4)] ?? 0;
  return ((msb & 0xFF) << 24) | low24;
}