process method

  1. @override
void process(
  1. Canvas canvas,
  2. Function applyPaint, [
  3. int processCount = 1
])
override

(Internal usage) Applies the filter to the given canvas.

This method applies the filter to the given canvas during the rendering process . It updates the filter's properties based on the value of the adjustToScale property and the current scale of the owner object (if applicable). It then saves the current canvas state, applies the filter using the applyPaint callback function, and restores the canvas state.

The canvas parameter is the canvas that the filter will be applied to.

The applyPaint parameter is a callback function that applies the paint properties to the canvas.

The processCount parameter is the number of times that the filter should be applied to the canvas. This parameter is not currently used.

Implementation

@override
void process(Canvas canvas, Function applyPaint, [int processCount = 1]) {
  if (adjustToScale) {
    if (currentObject != null) {
      final worldScale = currentObject!.worldScaleX;
      if (worldScale != _ownerScale) {
        _ownerScale = worldScale;
        _updateProperties();
      }
    }
  }
  canvas.saveLayer(null, paint);
  applyPaint(canvas);
  canvas.restore();
}