Color comparison
Color comparison
- Subject: Color comparison
- From: David Sinclair <email@hidden>
- Date: Mon, 3 Jun 2002 15:08:58 -0700
I am trying to compare colors. I have colors in a text view (saved
to disk as an NSAttributedString) and in an array. The former is
assigned from the latter, and -IsEqual works okay until the document
is saved. But after saving and reloading the colors are slightly
different, so I can't simply use -IsEqual to match them. (Both
colors are in NSCalibratedRGBColorSpace.)
Is there an easier way of comparing them than getting the individual
color components (R, G, B) and seeing if the values are close?
NSColor's -blendedColorWithFraction:ofColor: looked promising, but not very.
Alternatively, is there any way of avoiding the difference in values.
I doubt this one is feasible, as it looks like a rounding difference
-- e.g. 0.0588235 vs 0.0581305.
--
David Sinclair - email@hidden
http://www.dejal.com/
_______________________________________________
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.