View Full Version : advanced color manipulation
JimmyH
06-06-2006, 11:12 AM
Hello to you all.
I know how to manipulate hex colours by splitting the num bers up and perfoming calcutaions on them using bit-operators. Thats fine...
but i now need to manipulate colour not using the normal RGB. I need to be able to add two colours together like paint. E.g. red and blue equals purple, yellow and blue equals green.
Has anyon e had any experience with this and even more importantly can it be done? (i assume it can... nothings impossible)
cheers
James
FormerSwinger
06-06-2006, 11:52 AM
that's a bit tricky. Yes, I believe it's possible but I have no clue about the maths involved.
The problem is that if you add all color components together in rgb you get white where in real life you would end up with black (in a perfect world) or dark brown.
Also in real life the main colors are red yellow and blue instead of red green and blue. so in rgb yellow is red and green, in the real world this would give you something brownish I think?
If I were you I'd try to search the math someplace else e.g math forums, image manipulation forums etc.
JimmyH
06-06-2006, 02:46 PM
thanks mate...
Thats exactly what i've been doing and i have the maths now. I have some functions that work now and i will be putting a class togather at some point over the next few days.
But i have a nother problem... adding two CMYK colours together... take this problem for example. We know that if we add red paint and blue paint we get purple paint. Simple... most people learnt that in junior school. The mathematical values of the paints are
Red:
c = 0
m = 100
y = 100
Blue:
c = 100
m = 100
y = 0
now the cmy value for purple is:
c = 50
m = 100
y = 0
so whats the formular for merging the red and the blue to get the purple figures. it's baffling me quite a bit (reccon it's pretty simple but it's escaping me!)
edit... and i'll be off to some maths forums as well i'd expect ;)
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.