Skip to content

[web]: filter/blur incorrectly rendered by the HTML backend #58546

Closed

Description

@mariamhas

To produce the effect on the red waves (that actually slowly continuously animate like waves when run) a MaskFilter.blur(BlurStyle.outer, 10) is used, I suspect it is the culprit that looks bad on DomCanvas, but until I isolate it and demonstrate it in a stand-alone example I’m not 100% sure.

Expected (Canvaskit rendering):
image002

Actual (Dom rendering):
image003

Activity

  1. added this to the milestone on Jun 4, 2020
  2. added
    e: web_htmlHTML rendering backend for Web
    engineflutter/engine related. See also e: labels.
    c: renderingUI glitches reported at the engine/skia or impeller rendering level
    on Jun 4, 2020
  3. rydmike commented on Jun 4, 2020

    @rydmike
    Contributor

    Thanks @mariamhas for opening the MaskFilter.blur issue based just on the rough eMail discussion of it. Below is a more detailed presentation of it with reproducible code example as well.


    Example of MaskFilter.blur Issue

    TLDR

    Using MaskFilter.blur with BlurStyle.outer produces a totally different result on Flutter WEB when using DomCanvas versus CanvasKit. The CanvasKit version is correct, well at least it matches the result we get when using Flutter with SKIA on devices and desktops.

    Applies to

    All Flutter Web DomCanvas versions (past ones too).

    Steps to reproduce

    This Gist: https://gist.github.com/rydmike/78cdff7f63515a9ea18f172b8640de55 contain an interactive version that can be used to demo and reproduce the issue.

    A pre-built live demo using CanvasKit (SKIA) can be found here:
    https://rydmike.github.io/maskfilterskia/#/

    And a pre-built live demo using DomCanvas can be found here:
    https://rydmike.github.io/maskfilterdom/index.html#/

    These versions were built on master channel (version details below):

    Live demo versions built with version **Used version**
    flutter doctor -v
    [√] Flutter (Channel master, 1.19.0-4.0.pre.24, on Microsoft Windows [Version 10.0.18363.778], locale en-US)
        • Flutter version 1.19.0-4.0.pre.24 at c:\src\flutter
        • Framework revision 27186c784f (24 hours ago), 2020-06-03 09:33:02 -0700
        • Engine revision 6589dcb2d4
        • Dart version 2.9.0 (build 2.9.0-13.0.dev 3d53df52af)
    
    [√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
        • Android SDK at C:\Users\mryds\AppData\Local\Android\sdk
        • Platform android-28, build-tools 28.0.3
        • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
        • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
        • All Android licenses accepted.
    
    [√] Chrome - develop for the web
        • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
    
    [√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.5.4)
        • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
        • Visual Studio Community 2019 version 16.5.30011.22
    
    [√] Android Studio (version 3.6)
        • Android Studio at C:\Program Files\Android\Android Studio
        • Flutter plugin version 45.1.1
        • Dart plugin version 192.8052
        • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
    
    [√] IntelliJ IDEA Community Edition (version 2019.2)
        • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.3.1
        • Flutter plugin version 35.3.3
        • Dart plugin version 192.7402
    
    [√] VS Code (version 1.45.1)
        • VS Code at C:\Users\mryds\AppData\Local\Programs\Microsoft VS Code
        • Flutter extension version 3.11.0
    
    [√] Connected device (4 available)
        • Nexus 7    • 0a99f5e8   • android-arm    • Android 6.0.1 (API 23)
        • Windows    • Windows    • windows-x64    • Microsoft Windows [Version 10.0.18363.778]
        • Web Server • web-server • web-javascript • Flutter Tools
        • Chrome     • chrome     • web-javascript • Google Chrome 81.0.4044.138
    • No issues found!
    

    While the above DomCanvas and CanvasKit demos were built with master channel, we can also demonstrate the same issue in stable Web version with DartPad, using the supplied Gist. This can be tried here: https://dartpad.dartlang.org/78cdff7f63515a9ea18f172b8640de55

    Detailed Information

    The supplied code example show a huge difference between the result when building with DomCanvas versus CanvasKit. We can also observe a significant difference between different DomCanvas versions when using the stable version used by DartPad versus the supplied live version that was built using master channel. Clearly there is also some work in progress that also already impacts the filter result. The stable DartPad DomCanvas version is actually even worse than the one built with master, but they are both totally different from the CanvasKit and device versions.

    Example case

    With the provided example, the Maskfilter.blur effect can be turned ON and OFF and we can compare the results side by side from CanvasKit and DomCanvas.

    The example code contain some other interesting effects too that can be turned on and off. They were left in there as I wanted to see and make sure what was causing the issue, as I tore down and isolated the case from a more involved case with continuous animation. Only the MaskFilter.blur was relevant, as can be shown with the example. The ImageFilter.blur effect that was used to create a blurry lake reflection effect, did not have any impact on this use case.

    Below we can see the relevant differences in screenshot from identical code. The first screen shot using CanvasKit show the CORRECT result, the other two DomCanvas versions are very different.

    Screenshot examples

    1) CORRECT RESULT : The live example built with CanvasKit using master channel:

    https://rydmike.github.io/maskfilterskia/#/
    image

    2) INCORRECT RESULT : The live example built with DomCanvas using master channel:

    https://rydmike.github.io/maskfilterdom/index.html#/
    image

    3) EVEN WORSE RESULT : A live DartPad version using the current 'stable/beta' WEB version it uses:

    https://dartpad.dartlang.org/78cdff7f63515a9ea18f172b8640de55
    image
    Which uses the same Gist code snippet the above live examples are built with.


    Sidenote

    This example code snippet can also demonstrate the ClipRect issue reported in #58547 with a more actual useful use case. Here we can see an example where something else than a BoxShadow we on purpose put around a container is drawn outside the container that we then clip away. Here the shadow around the container is actually a in this case unwanted side effect of the used filter on the CustomPaint object, that we then need/want to cut away this effect. However, as reported in #58547 it was found that ClipRect cannot do this consistently.

  4. changed the title [-][web]: filter/blur discrepancy between DOM and Canvaskit[/-] [+][web]: filter/blur incorrectly rendered by the HTML backend[/+] on Jun 4, 2020
  5. added
    P1High-priority issues at the top of the work list
    on Jun 4, 2020
  6. added
    P2Important issues not at the top of the work list
    and removed
    P1High-priority issues at the top of the work list
    on Jun 16, 2020
  7. removed this from the milestone on Aug 17, 2020
  8. TahaTesser commented on Nov 11, 2020

    @TahaTesser
    Contributor

    Using. code samples from #58546 (comment), I can reproduce the issue

    flutter doctor -v
    [✓] Flutter (Channel master, 1.24.0-8.0.pre.194, on Mac OS X 10.15.7 19H15
        darwin-x64, locale en-GB)
        • Flutter version 1.24.0-8.0.pre.194 at /Users/tahatesser/Code/flutter_master
        • Framework revision 018467cdb1 (4 hours ago), 2020-11-11 02:04:03 -0500
        • Engine revision 81f219c59c
        • Dart version 2.12.0 (build 2.12.0-31.0.dev)
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
        • Android SDK at /Users/tahatesser/Code/sdk
        • Platform android-30, build-tools 30.0.2
        • ANDROID_HOME = /Users/tahatesser/Code/sdk
        • Java binary at: /Applications/Android
          Studio.app/Contents/jre/jdk/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build
          1.8.0_242-release-1644-b3-6915495)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 12.2)
        • Xcode at /Volumes/SanDisk/Xcode-beta.app/Contents/Developer
        • Xcode 12.2, Build version 12B5044c
        • CocoaPods version 1.10.0
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 4.1)
        • Android Studio at /Applications/Android Studio.app/Contents
        • Flutter plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build
          1.8.0_242-release-1644-b3-6915495)
    
    [✓] VS Code (version 1.51.0)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.16.0
    
    [✓] Connected device (4 available)
        • Taha’s iPad (mobile) • 00008020-000255113EE8402E • ios            • iOS 14.2
        • macOS (desktop)      • macos                     • darwin-x64     • Mac OS X
          10.15.7 19H15 darwin-x64
        • Web Server (web)     • web-server                • web-javascript • Flutter
          Tools
        • Chrome (web)         • chrome                    • web-javascript • Google
          Chrome 86.0.4240.193
    
    • No issues found!
  9. 2 remaining items

  10. rydmike commented on Nov 28, 2022

    @rydmike
    Contributor

    Thanks @huycozy for the check, verification and update of this old issue to a version that shows it with latest Flutter versions.

  11. Kingtous commented on Aug 28, 2023

    @Kingtous
    Contributor

    Hi, I've encountered a similar problem with the blur mask filter. maybe flutter-team-archive/engine#45166 can solve this issue.

  12. yjbanov commented on May 27, 2025

    @yjbanov
    Contributor

    As the HTML renderer has been deprecated and removed from the default Flutter SDK, we're now closing all issues that affect only the HTML renderer. For more information, please see:

  13. github-actions commented on Jun 10, 2025

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  14. locked as resolved and limited conversation to collaborators on Jun 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: renderingUI glitches reported at the engine/skia or impeller rendering levelcustomer: housecustomer: web10e: web_htmlHTML rendering backend for Webengineflutter/engine related. See also e: labels.found in release: 3.3Found to occur in 3.3found in release: 3.6Found to occur in 3.6has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyteam-webOwned by Web platform teamtriaged-webTriaged by Web platform team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions