getFilterBounds method
Returns the bounds of this object after applying all its filters.
If layerBounds
is not provided, the bounds of the parent are used.
If alphaPaint
is not null, it will be used as the paint for the filters
that use alpha. This is useful when computing the bounds of filters that
require a non-default paint.
Implementation
GRect? getFilterBounds([GRect? layerBounds, ui.Paint? alphaPaint]) {
layerBounds ??= getBounds($parent);
if ($filters == null || $filters!.isEmpty) {
return layerBounds;
}
layerBounds = layerBounds!.clone();
GRect? resultBounds;
for (var filter in $filters!) {
resultBounds ??= layerBounds.clone();
if (alphaPaint != null) {
filter.update();
}
filter.expandBounds(layerBounds, resultBounds);
if (alphaPaint != null) {
filter.currentObject = this;
filter.resolvePaint(alphaPaint);
filter.currentObject = null;
}
}
return resultBounds;
}