• 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: Color comparison
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Color comparison


  • Subject: Re: Color comparison
  • From: "Timothy J. Wood" <email@hidden>
  • Date: Mon, 3 Jun 2002 20:30:58 -0700

On Monday, June 3, 2002, at 03:08 PM, David Sinclair wrote:
Is there an easier way of comparing them than getting the individual color components (R, G, B) and seeing if the values are close?

Probably not.

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.

You could take the color you are going to compare against, archive it an unarchive it to cause the same rounding. That's kind of silly though.

It's probably best to assume you pick a target color depth (i.e. 8 bits per channel or maybe 10, 12 or 16 if you want to plan for the future) and see if the colors are within that tolerance of each other:


#define BITS_PER_CHANNEL (8)

if (rint(r1 * ((1<< BITS_PER_CHANNEL) -1)) == rint(r2 * ((1<< BITS_PER_CHANNEL) -1)) && ...) {
colors will display the same on screen, so they are 'equal enough'
}


-tim
_______________________________________________
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.

  • Follow-Ups:
    • Re: Color comparison
      • From: David Sinclair <email@hidden>
References: 
 >Color comparison (From: David Sinclair <email@hidden>)

  • Prev by Date: Connect to web address...
  • Next by Date: Re: Connect to web address...
  • Previous by thread: Color comparison
  • Next by thread: Re: Color comparison
  • Index(es):
    • Date
    • Thread