Re: Shiny little square buttons
Re: Shiny little square buttons
- Subject: Re: Shiny little square buttons
- From: Uli Kusterer <email@hidden>
- Date: Tue, 4 Jul 2006 02:20:55 +0200
Am 03.07.2006 um 21:04 schrieb Gerd Knops:
On Jul 3, 2006, at 4:23 AM, Uli Kusterer wrote:
NSRectFill & Co. are for *replacing* a color in a rect (e.g. to
reset the alpha channel of an NSImage). Why does everybody insist
on using the functions when we have a perfectly good fillRect
method in NSBezierPath?
And the difference/reason to use one over the other would be? They
both fill a rectangle with a color, right?
Yes, but the alpha value is handled differently. Example:
[[NSColor clearColor] set];
[NSBezierPath fillRect: [self bounds]]; // Does nothing. Transparent
drawings are painted on top of whatever's there.
NSRectFill( [self bounds] ); // Clears the entire rectangle of
drawings.
I should correct what I said earlier: If you use the correct drawing
mode ("operation"), NSRectFillUsingOperation() will probably work as
well, but since NSRectFill() uses the "copy" mode, it'll overwrite
any alpha and colour information that may already be there, while
[NSBezierPath fillRect:] automatically uses the mode most people
would expect.
Most problems with NSRectFill() I've seen so far were due to people
not expecting it to use the "copy" mode.
Cheers,
-- M. Uli Kusterer
http://www.zathras.de
_______________________________________________
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