Correct Window Transparency / MacOSLib / Can’t use GitHub.

I’m sorry but I do not understand how to use GitHub. I cannot remove a revoked branch and seem not to be able to create a new. Besides needing a GitHub lesson some time, maybe someone here who is into this stuff and MacOSLib alike would like to add the following:

I had noticed that it wasn’t possible to create a semi transparent NSWIndow that wasn’t grey. This made it impossible to adapt my windows to the coming Yosemite white transparent look.
By looking into MacOSLib/Cocoa/Classes/NSWindow/Methods/Transparency, I found that the background color was set with the default window color:

dim nsc as NSColor = NSColor.ColorWithRGB( 0.92, 0.92, 0.92, Value )

Therefore the grey.

When you replace this line by the following two:

dim bgc as nscolor = self.BackgroundColor dim nsc as NSColor = bgc.ColorWithAlpha (value),
the real window background color is taken and white transparent windows (or any other color) are possible.

And while we’re at it:
NSColor misses the BlueComponent method. The easiest method to add it: Duplicate the RedComponent method, rename it BlueComponent and change the contents so that they read

[code] //# Returns the NSColor’s blue component.

#if targetMacOS
declare function blueComponent lib CocoaLib selector “blueComponent” (id as Ptr) as Single

return blueComponent(self)

#endif[/code]

Theoretically one could use the components for the transparency method above, but if the window background should have been designed in a different colorspace (like grayscale), an exception would occur. So converting the color space like written above is more secure.

Again sorry: I would have liked to add this myself. But I’m too afraid I could mess up something the way GutHub presents the code to me.

No problem, I’ve submitted it to the github repository for you, thank you for your suggestions!

https://github.com/macoslib/macoslib/pull/150

Thanks a lot!