I have to mix some colors in a natural way. This means
blue + yellow = green
blue + red = purple
And so on. I got the colors as RGB-Values. When I try to mix them I got the right "RGB"-results like
green + red = yellow
yellow + blue = white
But not the right "natural-wet-paint"-results. Any good idea how to mix RGB in a natural way?
It would be great if someone knew a solution within the Microsoft.Xna.Framework.Graphics
namespace but a generic solution would also help :)
@Jay Bazuzi:
Please post a code sample that shows
what you're trying to do.
Sure - this is my function for mixing the two RGB-Colors.
public Color colorMixer(Color c1, Color c2)
{
int _r = Math.Min((c1.R + c2.R),255);
int _g = Math.Min((c1.G + c2.G),255);
int _b = Math.Min((c1.B + c2.B),255);
return new Color(Convert.ToByte(_r),
Convert.ToByte(_g),
Convert.ToByte(_b));
}
What I have read so far in this thread is very promising - I will convert C1 and C2 to Lab*, mix them - convert it back to RGB and return that color.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…