Skip navigation.
 
mlWhat paradigm behind NSColor's drawing methods?
FROM : Jerry Krinock
DATE : Fri Feb 01 20:41:55 2008

I've always been amazed by -[NSColor set], which "Sets the color of 
subsequent drawing to the color that the receiver represents".

This seems absurd.  Instead of affecting the receiver, the receiver is 
affecting some other object, and the identify of the affected object 
is not even hinted at.

Instead, I would expect there to be a method like like:

    -[NSGraphicsContext setColor:(NSColor*)]

and then you could also have a getter (and I cannot find a real-life 
equivalent of this),

    -(NSColor*)[NSGraphicsContext color]

I've just re-read the Cocoa Drawing Guide but still can't comprehend 
the paradigm behind NSColor's -set, -setFill, -setStroke etc.  Can 
someone please straighten me out?  Or are these methods the 
unfortunate legacy of some bad decision made 15 years ago?

Jerry Krinock

Related mailsAuthorDate
mlWhat paradigm behind NSColor's drawing methods? Jerry Krinock Feb 1, 20:41
mlRe: What paradigm behind NSColor's drawing methods? glenn andreas Feb 1, 21:47
mlRe: What paradigm behind NSColor's drawing methods? Jerry Krinock Feb 1, 22:18
mlRe: What paradigm behind NSColor's drawing methods? glenn andreas Feb 1, 22:44
mlRe: What paradigm behind NSColor's drawing methods? Erik Buck Feb 1, 23:49
mlRe: What paradigm behind NSColor's drawing methods? Peter Ammon Feb 2, 01:23
mlRe: What paradigm behind NSColor's drawing methods? Erik Buck Feb 2, 03:29
mlRe: What paradigm behind NSColor's drawing methods? Ricky Sharp Feb 2, 16:04
mlRe: What paradigm behind NSColor's drawing methods? Jerry Krinock Feb 4, 19:59