2
votes

I have a window of type NSBorderlessWindow with a contentView that has the following hirarchy:

view 1 -> draws gray background
  |
  + view 2 -> draws rectangle with [NSColor colorWithDeviceRed:0 green:0 blue:0 alpha:0.8]

This is what the result looks like: enter image description here

view 2 is a subview of view 1, from my understanding the semi transparent black should be overlaid over the gray. However, it seems that the black replaces the gray in the drawn area. I use NSRectFill for the drawing. How could I avoid this effect and have the semi transparent black really draw over the gray?

1

1 Answers

1
votes

Somebody on the awesome #macdev channel on irc.freenode.net pointed out to me that I should use NSRectFillUsingOperation with NSCompositeSourceOver, that works like a charm. The default NSRectFill appears to be using a different composite for whatever reason.