Skip to content

Add support for TileMode and kDecal to ImageFilter.blur #71871

@flar

Description

@flar

There are a number of issues related to the ImageFiltered widget and the ImageFilter.blur type of filter that arise due to confusion over how the edges are handled. One such issue deals with distortions where the pixels near the edges of a shape being blurred bleed outward in the horizontal and vertical directions. These distortions arise due to the fact that the blur filter uses a Skia kClamp (equivalent to Flutter's ui.TileMode.clamp) mode. If the child is a shape that brushes against the edges in a few places then those edge pixels will be non-transparent and the blur will carry their samples out to the edge of the resulting image.

We can give developers some control over this with 2 additions:

  • Add TileMode as a property to ImageFilter.blur
  • Add decal as a value to the TileMode enum

Note that the new value will also enable a new gradient type where the stops are shown from 0.0->1.0, but transparency is rendered everywhere else. Skia supports this mode, so it is new functionality that we haven't exposed. It may not be very useful for many cases of gradients, but the decal mode will be very useful for blurs. Similarly the repeat and mirror values may not be useful for many cases of blur, but they are supported for blurs even though they are primarily targeted at gradients.

The documentation for TileMode should be updated to explain its application in ImageFilter cases.

Metadata

Metadata

Assignees

Labels

P3Issues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterengineflutter/engine related. See also e: labels.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions