Saves a copy of the current transform and clip on the save stack, and then
creates a new group which subsequent calls will become a part of. When the
save stack is later popped, the group will be flattened into a layer and
have the given paint
's Paint.colorFilter and Paint.transferMode
applied.
This lets you create composite effects, for example making a group of drawing commands semi-transparent. Without using saveLayer, each part of the group would be painted individually, so where they overlap would be darker than where they do not. By using saveLayer to group them together, they can be drawn with an opaque color at first, and then the entire group can be made transparent using the saveLayer's paint.
Call restore to pop the save stack and apply the paint to the group.
Source
void saveLayer(Rect bounds, Paint paint) { if (bounds == null) { _saveLayerWithoutBounds(paint._objects, paint._data); } else { _saveLayer(bounds.left, bounds.top, bounds.right, bounds.bottom, paint._objects, paint._data); } }