fillForegroundStyle method
Fills the foreground style of all cells in bounds using blend.
Implementation
void fillForegroundStyle(Rect bounds, Style style, BlendOption blend) {
final fgVal = style.foreground?.argb ?? 0;
final styleMods = style.modifiers;
for (var y = bounds.y; y < bounds.y + bounds.height; y++) {
if (y < 0 || y >= height) continue;
final rowOffset = y * width;
for (var x = bounds.x; x < bounds.x + bounds.width; x++) {
if (x < 0 || x >= width) continue;
final idx = rowOffset + x;
final attrIdx = idx * 3;
if (blend == BlendOption.replace) {
attributes[attrIdx + 0] = fgVal;
attributes[attrIdx + 1] = style.background?.argb ?? 0;
attributes[attrIdx + 2] = styleMods;
} else if (blend == BlendOption.colorOnly) {
if (fgVal != 0) {
attributes[attrIdx + 0] = fgVal;
}
} else if (blend == BlendOption.addModifiers) {
attributes[attrIdx + 2] |= styleMods;
}
}
}
}