bufferDrawText method
void
bufferDrawText()
Draws one styled UTF-8 run.
Implementation
void bufferDrawText(
OptimizedBufferHandle buffer,
String text,
int x,
int y,
Color foreground,
Color? background,
int attributes,
) {
_checkUnsignedAbi(x, 0xFFFFFFFF, 'x');
_checkUnsignedAbi(y, 0xFFFFFFFF, 'y');
_checkUnsignedAbi(attributes, 0xFFFFFFFF, 'attributes');
validateColorChannels(foreground, name: 'foreground');
if (background != null) {
validateColorChannels(background, name: 'background');
}
_guardAlloc('Failed to draw text', (allocator) {
final (textPointer, textLength) = _utf8(allocator, text);
_native.bufferDrawText(
buffer.value,
textPointer,
textLength,
x,
y,
_colorToNative(foreground, allocator),
background == null ? nullptr : _colorToNative(background, allocator),
attributes,
);
});
}