-
Notifications
You must be signed in to change notification settings - Fork 6k
Allow Tile mode for blur filter and add new decal TileMode #22982
Conversation
|
@Hixie Is |
lib/ui/painting.dart
Outdated
| ///  | ||
| mirror, | ||
|
|
||
| /// Edge is transparent black. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: maybe "Extrapolates the source image with transparent black (0x00000000) pixels, when the image filter samples outside of the bounds of the source image"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rest of the entries are documented as "Edge is ...". I agree that I don't like the way that is all phrased. I'll look for some better wording for all of them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updates pushed...
lib/ui/painting.dart
Outdated
| /// 4.0 to 3.0, and so forth (and for linear gradients, similarly from in the | ||
| /// negative direction). | ||
| /// | ||
| /// An image filter will treat the image as tiled in an alternating forwards and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: "An image filter will treat the image ..." makes me think TileMode is a property of the image, not the filter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"An image filter will treat its source as ..."?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updates pushed...
| /// | ||
| /// An image filter will substitute transparent black for any sample it must read from | ||
| /// outside its source image. | ||
| decal, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess decal is as good a name for this as any, and has the advantage of matching Skia.
| /// gradient. | ||
| /// | ||
| /// An image filter will substitute transparent black for any sample it must read from | ||
| /// outside its source image. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't forget to add the new image, too. :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The plan was to add that as soon as it propagates to the framework and I can modify the built assets. I also plan to add equivalent ImageFilter.blur example images to all of the TileMode values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I landed new assets today which included the assets for decal. (I forgot about ImageFilter.blur examples, sorry, so if they haven't been added yet they're still missing.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was that just for the gradient? I have been waiting to update these assets until Skia fixes bugs in the tile mode handling for the ImageFilter.blur(). It was supposed to go in a few days after this PR, but the fix has been re-un-re-verted since then and still hasn't landed and rolled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tracking the blur/TileMode doc image issue in flutter/flutter#74367
* 3a30ae3 Fix ios voiceover (for safari >13.4) (flutter/engine#22965) * 4338849 Replace g_object_weak_ref with g_object_add_weak_pointer * 3b9937a Load macOS dart bundle by URL fallback (flutter/engine#22979) * 96927bb add ffi_struct_patch.dart to libraries.yaml (flutter/engine#23000) * 2efc7c1 Set SkPath::setIsVolatile based on whether the path survives at least two frames (flutter/engine#22620) * bb81b95 Allow Tile mode for blur filter and add new decal TileMode (flutter/engine#22982) * 9df2157 Load iOS dart bundle by URL fallback (flutter/engine#22997) * 7647fdb Roll Skia from 22f80a60b17f to 6b07e0eb497c (26 revisions) (flutter/engine#23005) * 062cbd8 Freiling warmup memory (flutter/engine#22984) * 1646966 Revert "Freiling warmup memory (#22984)" (flutter/engine#23007) * 50d830a [web] Do not reset 'cursor' in PersistedPlatformView. (flutter/engine#22977) * 6ebf5c3 Roll Dart SDK from e4c9b06267d3 to a4e6fe145bf7 (2 revisions) (flutter/engine#23006) * 14c8c24 [web] Fix regression in foreground style (flutter/engine#22999) * 6678efa Implement SystemSound.play * fb769a4 Roll Fuchsia Linux SDK from rnN_X2o75... to ESzmO-yOF... (flutter/engine#23010) * b424356 Roll Skia from 6b07e0eb497c to f7cce2b243b2 (6 revisions) (flutter/engine#23018) * 56035c7 Roll Fuchsia Linux SDK from ESzmO-yOF... to K4cPd0-Xd... (flutter/engine#23020) * cb4a2ef Roll Skia from f7cce2b243b2 to b0cb8372c1ef (3 revisions) (flutter/engine#23021) * cc8c9d4 Roll Skia from b0cb8372c1ef to 5284e96599a8 (2 revisions) (flutter/engine#23023) * 8e9a943 Roll Dart SDK from a4e6fe145bf7 to c287db6bf232 (2 revisions) (flutter/engine#23024) * 714b543 Roll Fuchsia Mac SDK from OUQEzH1oE... to a9yuHfriB... (flutter/engine#23025) * d50cdda Roll Dart SDK from c287db6bf232 to 2553a84fe438 (1 revision) (flutter/engine#23026) * 4794d04 Roll Skia from 5284e96599a8 to f7fdf1aa2911 (1 revision) (flutter/engine#23027)
Fixes flutter/flutter#71871
Currently Skia supports a "decal" tile mode which defines "out of bounds" values of a gradient or image as transparency. Skia supports this in both Gradients and Blur filters, but we don't have the value in our TileMode enum. This PR adds that new value.
We also have no parameter on
ImageFilter.blur()that allows the developer to specify a tile mode. The implementation currently defaults toclampwhich is appropriate for opaque images, but it causes frustrating rendering anomalies for other uses (see flutter/flutter#57180). This PR adds a newTileModeparameter toImageFilter.blurto enable developers to control this aspect of the blur operation. The default value isclampfor backwards compatibility.I've updated the tests to include the new values and implemented this on web, with a few caveats:
Flutter web on HTML/CSS only supports a single radius and decal mode so the implementation of blur on this platform used to be "always wrong" and now it is "wrong unless a developer asks for decal mode and uses the same sigma for X and Y". Improvement, but this platform will likely never support all of the capabilities of the Flutter blur filter.
Flutter with CanvasKit supports all of the new decal modes for Gradients, and it should support all of the modes for blur filters, but for some reason the values supplied in the
MakeBlur()constructor don't seem to have any effect. Is there a missing link in getting that value to the underlying implementation that I missed?Finally, I took the name
decalfrom the Skia enum. Is that a good name for Flutter developers?