Re: Transparent backgroundcolors ?
Re: Transparent backgroundcolors ?
- Subject: Re: Transparent backgroundcolors ?
- From: Christopher Holland <email@hidden>
- Date: Mon, 28 Apr 2003 12:41:32 -0500
Tobi,
I may have the answers you are looking for, although not a solution. :)
The example you give in #2 is drawing correctly. In order to get
correct alpha blending with the NSRect shortcut functions you will need
to use a "...UsingOperation" function. i.e. your code would be:
[myColor set];
NSRectFillUsingOperation(rect, NSCompositeSourceOver);
That would give you the same effect as the NSBezierPath example that
you gave.
Now, that doesn't solve the problem that you are having because I am
going to go out on a limb here and say that the standard controls don't
use the alpha-blended functions to do their drawing. So unless you want
to subclass NSTextField and do your own drawing then I doubt you can
get transparent colors there.
On Monday, April 28, 2003, at 11:22 AM, Tobias Hermann wrote:
hi!
I am playing around with transparent colors and some things really
seem odd to me: (yes, I called [NSColor setIgnoresAlpha: NO];):
1. I have a brushed metal window and a control on it, e.g. an
NSTextField. When I set the backgroundColor to a semi-transparent
color, it only gets darker, but the brushed metal pattern is totally
gone. who paints the background black before the transparent
background color gets drawn ??
2. I subclassed NSView and found out the following:
When drawing the background with a transparent Color like this (within
drawRect):
[myColor set];
NSRectFill(rect);
I get the same strange result: the brushed metal surface gets
overdrawn totally, and my transparent color only gets darker and
darker with smaller alpha values...
When I do this:
[myColor set];
[NSBezierPath fillRect: rect];
it works!! I have still see the brushed metal surface, but a
semitransparent myColor lies on top of it...
And that is what I want some Cocoa Controls want to do: paint the
background semi-transparent. But i can't get it to work!!
And e.g. when I call NSTextField's setDrawsBackground:NO, i get other
sideeffects like that the editing text overdraws itself, etc...
Any hints on that ?
Thank you in advance!!
Tobi
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.