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.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden