问题描述
Hey Codeproject,
我想知道如何将两种颜色混合在现实生活中。例如,混合红色和蓝色将导致紫色。我想知道这是因为我也喜欢将颜色的不透明度作为一个组件来播放(意味着如果alpha为255,它会比它更难混合。)
澄清一下, []我希望能够做到的图片。
Hey Codeproject,
I'm wondering how you blend two colors like you would with paint in real life. For instance, blending red and blue would result in purple. I'm wondering this because I'd also like the opacity of the color to play in as a component (meaning that if the alpha is 255 it would blend harder than it if it wouldn't.)
To clarify, [Here's] a picture of what I want to be able to do.
public Color PaintBlendColors(Color One, Color Two)
{
Color Col;
/*Col = Blend?*/
return Col;
}
最好的问候,
- Edz
我尝试了什么:
我到目前为止尝试在Monogame /中使用预构建函数XNA称为Color.Lerp,但这并没有产生预期的效果。
Best Regards,
- Edz
What I have tried:
I've so far tried using a pre-build function in Monogame/XNA called Color.Lerp, but this does not give the desired effect.
推荐答案
Col.Red= (One.Red+ Two.Red)/ 2;
...
这篇关于如何混合/混合两种颜色,如真正的油漆?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!