withNewViewport abstract method

ScalableImage withNewViewport(
  1. Rect viewport, {
  2. bool prune = false,
  3. double pruningTolerance = 0,
})

Return a copy of this SI with a different viewport. The bulk of the data is shared between the original and the copy. If prune is true, it attempts to prune paths that are outside of the new viewport. Pruning away unneeded nodes will speed up rendering of the resulting ScalableImage.

Pruning is an expensive operation. It relies on Flutter's calculations of the bounding box for the different graphical operations. For stroked shapes, it adds the strokeWidth to that bounding box.

The pruning tolerance allows you to prune away paths that are just slightly within the new viewport. A positive sub-pixel tolerance might reduce the size of the new image with no discernible visual impact.

Implementation

ScalableImage withNewViewport(Rect viewport,
    {bool prune = false, double pruningTolerance = 0});