This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SWBShared2 | |
import Metal | |
import AppKit | |
import CoreImage | |
import CoreGraphics | |
import QuartzCore | |
@globalActor | |
public struct CALayerToMetalRendererActor { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// TODO: setting window transforms (or mission control) flattens layers... | |
// TODO: Mask image vs path (layer)? | |
/// `NSVisualEffectView`: | |
/// | |
/// A view that adds translucency and vibrancy effects to the views in your interface. | |
/// When you want views to be more prominent in your interface, place them in a | |
/// backdrop view. The backdrop view is partially transparent, allowing some of | |
/// the underlying content to show through. Typically, you use a backdrop view | |
/// to blur background content, instead of obscuring it completely. It can also |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UIVisualEffectView { | |
private var filterLayer: CALayer? { | |
return layer.sublayers?.first | |
} | |
private var blurFilter: NSObject? { | |
return filterLayer? | |
.filters?.flatMap({ $0 as? NSObject }) | |
.first(where: { $0.value(forKey: "name") as? String == "gaussianBlur" }) |