Le 13 avr. 07 à 03:29 Matin, Lars Jensen a écrit: >> Is it not possible to simply use this formula: >> >> Color1.Red+Color1.Green*256+Color1.Blue*256? > > It's possible to use whatever formula you like, as long as it delivers > a single number per color. The question is, what effect will the > formula have? The above formula gives the red component of a color > only 1/256 as much influence as the green and blue components, which > have equal influence to each other. I don't know why you would want to > do that. > > Possibly you meant this instead: > > Color1.Red+Color1.Green*256+Color1.Blue*256*256 > > This happens to provide a _unique_ numerical value for each color in > RGB space, which is perhaps what you were getting at. But sorting does > not depend on a unique value per entity, it depends only on a single > value per entity. > > Would the above numerical value per color provide a useful sorting for > your needs? It will sort colors with a blue component to one end, > colors with a green component but no blue component in the middle, and > colors with no green or blue components to the other end. It's hard to > visualize the effect of this since I am not good at imagining hundreds > of colors with three degrees of freedom per color simultaneously. If > that's what you want, great, but there's no such thing as a "correct" > sorting of colors.
You're completely right (I forgot a *256 and sorting colors doesn't seem useful), but the original question was about that. _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives: <http://support.realsoftware.com/listarchives/lists.html>
