applyEffect method
Applies the effect directly to the target buffer within bounds.
Implementation
@override
void applyEffect(Buffer target, Rect bounds) {
final mutator = ColorMutator(scalar);
for (var y = bounds.y; y < bounds.y + bounds.height; y++) {
if (y < 0 || y >= target.height) continue;
final rowOffset = y * target.width;
for (var x = bounds.x; x < bounds.x + bounds.width; x++) {
if (x < 0 || x >= target.width) continue;
final idx = rowOffset + x;
final attrIdx = idx * 3;
if ((target.attributes[attrIdx + 2] & Modifier.transparent) != 0) {
continue;
}
final fg = target.attributes[attrIdx + 0];
if (fg != 0) {
target.attributes[attrIdx + 0] = mutator.dimPacked(fg);
}
final bg = target.attributes[attrIdx + 1];
if (bg != 0) {
target.attributes[attrIdx + 1] = mutator.dimPacked(bg);
}
}
}
}