Re: Transparent NSRectFill?
Re: Transparent NSRectFill?
- Subject: Re: Transparent NSRectFill?
- From: Matt Reagan <email@hidden>
- Date: Fri, 23 Dec 2005 12:13:59 -0800
I'm actually just making successive drawing calls (in this case, a
series of simple colored rectangles) to an opaque NSView in a
standard, opaque window. But I need these rectangles, as they're drawn
one by one, to be semi-transparent and overlap one another. This is
easy with NSImage's drawAtPoint method because you can set the
fraction to less than 1 (and use the sourceOver mode), but I'm having
trouble finding a simple way to do this with a NSBezierPath or
RectFill.
I remember seeing sample code that did this, I can't find it now. The
answer is probably right under my nose, I'm sure... :\
On 12/23/05, Timothy J. Wood <email@hidden> wrote:
>
>
On Dec 23, 2005, at 9:47 AM, Matt Reagan wrote:
>
>
> I'm having trouble figuring out a simple way to draw a series of
>
> transparent rectangles into an NSView. I thought maybe the alpha value
>
> of NSColor would allow me to do that, but it doesn't work, it simply
>
> fades the NSColor towards black (blue with a .5 alpha is simply dark
>
> blue).
>
>
Are you trying to make it so you can see through the view to the
>
desktop?
>
If so, you need to tell the window that it should obey its alpha channel
>
via -[NSWindow setOpaque:NO]. Otherwise, you'll get a black
>
contribution
>
like you're seeing.
>
>
Note that if you are using a 'copy' compositing mode with a
>
non-1.0 alpha,
>
this is effectively what you are doing (setting some pixels in the
>
window's
>
store to a non-1.0 alpha). Normally you'd use the 'source-over' mode if
>
you want the view underlying your view to be partially visible.
>
>
-tim
>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden