• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Shiny little square buttons
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >Shiny little square buttons (From: Nik Youdale <email@hidden>)
 >Re: Shiny little square buttons (From: Jeremy Dronfield <email@hidden>)
 >Re: Shiny little square buttons (From: Nik Youdale <email@hidden>)
 >Re: Shiny little square buttons (From: Uli Kusterer <email@hidden>)
 >Re: Shiny little square buttons (From: Gerd Knops <email@hidden>)

  • Prev by Date: How do I move my running app?
  • Next by Date: Re: Model / View best practice
  • Previous by thread: Re: Shiny little square buttons
  • Next by thread: Re: Shiny little square buttons
  • Index(es):
    • Date
    • Thread