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