Skip to content

Blur filter is not applied in OpenSwiftUI View Renderer #880

@Kyle-Ye

Description

@Kyle-Ye

Summary

blur(radius:) does not visually take effect when using the OpenSwiftUI View Renderer.

The generated DisplayList contains the expected separate background and filtered content entries, but the rendered UIKit/CALayer hierarchy differs from the SwiftUI-renderer path. The blue graphics layer is present, but it does not receive the expected Gaussian blur filter.

Reproduction

Use a minimal view with a blurred foreground color over a red background:

struct ContentView: View {
    var body: some View {
        Color.blue
            .frame(width: 100, height: 100)
            .blur(radius: 10)
            .background(Color.red)
    }
}

Run the example with the OpenSwiftUI View Renderer enabled.

Expected Behavior

The blue square should render with a blur effect, matching the SwiftUI-renderer path.

The layer corresponding to the blue graphics content should have a Gaussian blur filter applied.

Actual Behavior

The red background and blue content both render, but the blue content is not blurred.

The OpenSwiftUI renderer hierarchy creates a blue _UIGraphicsView layer without any layer filters. In the SwiftUI-renderer path, the corresponding blue layer has a gaussianBlur filter.

Notes

The issue appears to be in OpenSwiftUI renderer application of graphics filters to platform layers, not in the basic view layout or background/content ordering.

Log

DisplayList

(display-list
  (item #:identity 3 #:version 2
    (frame (151.0 401.0; 100.0 100.0))
    (content-seed 5)
    (color #FF3B30FF))
  (item #:identity 2 #:version 4
    (frame (151.0 401.0; 100.0 100.0))
    (effect
      (item #:identity 1 #:version 3
        (frame (0.0 0.0; 100.0 100.0))
        (content-seed 7)
        (color #007AFFFF)))))

OpenSwiftUI View Renderer

<_UIHostingView ... frame = (0 0; 402 874)>
   | <OpenSwiftUI._UIGraphicsView ... frame = (151 401; 100 100); backgroundColor = red; layer = <CALayer ...>>
   | <OpenSwiftUI._UIGraphicsView ... frame = (151 401; 100 100); backgroundColor = blue; layer = <CALayer ...>>

<UIHostingViewDebugLayer ... sublayers = (<CALayer ...>, <CALayer ...>)>
   <CALayer ...; position = CGPoint (151 401); bounds = CGRect (0 0; 100 100); _openSwiftUI_displayListID = 3; backgroundColor = red>
   <CALayer ...; position = CGPoint (151 401); bounds = CGRect (0 0; 100 100); _openSwiftUI_displayListID = 1; backgroundColor = blue>

SwiftUI View Renderer

<_UIHostingView ... frame = (0 0; 402 874)>
   | <OpenSwiftUI._UIGraphicsView ... frame = (151 401; 100 100); backgroundColor = red; layer = <CALayer ...>>
   | <OpenSwiftUI._UIGraphicsView ... frame = (151 401; 100 100); backgroundColor = blue; layer = <CALayer ...>>

<UIHostingViewDebugLayer ... sublayers = (<CALayer ...>, <CALayer ...>)>
   <CALayer ...; position = CGPoint (151 401); bounds = CGRect (0 0; 100 100); _swiftUI_displayListID = 3; backgroundColor = red>
   <CALayer ...; position = CGPoint (151 401); bounds = CGRect (0 0; 100 100); _swiftUI_displayListID = 1; filters = (
       gaussianBlur
   ); backgroundColor = blue>

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: renderingDisplayList, render backends, renderer hosts, drawing, and effects.impact: visual-diffVisual mismatch, screenshot diff, or rendering fidelity issue.type: bugSomething is not working correctly.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions