I'm trying to make a semi-transparent window (white), and have a view that sits over the top of it to make it appear clear again.
Essentially, it looks like:
And what I want it to look like is:
My window is defined like:
window!.alphaValue = 0;
// Set level to screensaver level
window!.level = 1000
window!.backgroundColor = NSColor.white;
window!.animator().alphaValue = 0.5;
A white window with 50% opacity. The view on top contains a single CAShapeLayer. This layer is defined like:
shapeLayer = CAShapeLayer();
shapeLayer!.lineWidth = 1.0;
shapeLayer!.strokeColor = NSColor(red: 0.5, green: 0.5, blue: 0.5, alpha: 1).cgColor;
shapeLayer!.fillColor = NSColor(red: 0, green: 0, blue: 0, alpha: 0.5).cgColor;
This window is movable by the user, so I need some kind of dynamic way to clear the contents of the main window and show through to whatever is underneath (the desktop, another application, etc)