FROM : PGM
DATE : Sun Nov 25 23:31:13 2007
On 25-Nov-07, at 22:56 PM, Ricky Sharp wrote:
>
> On Nov 25, 2007, at 3:22 PM, PGM wrote:
>
>>>
>>> How do I override the Leopard defaults to display sheets with an
>>> alpha of 1.0?
>>>
>>> My application uses a lot of NSWindow sheets - for a good reason.
>>>
>>> I do NOT want a semi-transparent background, nor do my users.
>>>
>>
>> Make the contentView of your window a custom view where you fill
>> the rect with a solid colour. I actually used this to get rid of
>> the pinstripes in Tiger, and it is not transparent in Leopard. I
>> post the code down here, though that might be superfluous as it is
>> really simple.
>>
>> Cheers, Patrick
>>
>> @interface PMPanelBackgroundView : NSView {
>>
>> }
>>
>> @end
>>
>>
>> #import "PMPanelBackgroundView.h"
>>
>>
>> @implementation PMPanelBackgroundView
>>
>> - (void)drawRect:(NSRect)rect
>> {
>> [[NSColor colorWithCalibratedWhite:0.9337 alpha:0.98] set];
>> NSRectFill(rect);
>> }
>>
>> @end
>
> If the goal here is to be 98% opqaue, you'll want to use
> NSRectFillUsingOperation instead. Otherwise, to reinforce the fact
> that total opaqueness is desired, just set the alpha to 1.0.
I just copied the code from my app and forgot to change the alpha to
one to match Keith's question. I actually don't remember whether my
goal was 98% opaque, it's a while since I wrote this.
Patrick
DATE : Sun Nov 25 23:31:13 2007
On 25-Nov-07, at 22:56 PM, Ricky Sharp wrote:
>
> On Nov 25, 2007, at 3:22 PM, PGM wrote:
>
>>>
>>> How do I override the Leopard defaults to display sheets with an
>>> alpha of 1.0?
>>>
>>> My application uses a lot of NSWindow sheets - for a good reason.
>>>
>>> I do NOT want a semi-transparent background, nor do my users.
>>>
>>
>> Make the contentView of your window a custom view where you fill
>> the rect with a solid colour. I actually used this to get rid of
>> the pinstripes in Tiger, and it is not transparent in Leopard. I
>> post the code down here, though that might be superfluous as it is
>> really simple.
>>
>> Cheers, Patrick
>>
>> @interface PMPanelBackgroundView : NSView {
>>
>> }
>>
>> @end
>>
>>
>> #import "PMPanelBackgroundView.h"
>>
>>
>> @implementation PMPanelBackgroundView
>>
>> - (void)drawRect:(NSRect)rect
>> {
>> [[NSColor colorWithCalibratedWhite:0.9337 alpha:0.98] set];
>> NSRectFill(rect);
>> }
>>
>> @end
>
> If the goal here is to be 98% opqaue, you'll want to use
> NSRectFillUsingOperation instead. Otherwise, to reinforce the fact
> that total opaqueness is desired, just set the alpha to 1.0.
I just copied the code from my app and forgot to change the alpha to
one to match Keith's question. I actually don't remember whether my
goal was 98% opaque, it's a while since I wrote this.
Patrick
| Related mails | Author | Date |
|---|---|---|
| Keith Wilson | Nov 25, 02:14 | |
| John Stiles | Nov 25, 17:13 | |
| PGM | Nov 25, 22:22 | |
| Ricky Sharp | Nov 25, 22:56 | |
| PGM | Nov 25, 23:31 | |
| Keith Wilson | Nov 26, 00:20 | |
| Keith Wilson | Nov 26, 02:50 |






Cocoa mail archive

