如何混合/混合两种颜色,如真正的油漆? [英] How to blend/mix two colors like real paint?

查看:183
本文介绍了如何混合/混合两种颜色,如真正的油漆?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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.

推荐答案

你可以尝试计算2种颜色的平均值

You can try to calc the mean of the 2 colors
Col.Red= (One.Red+ Two.Red)/ 2;
...


这篇关于如何混合/混合两种颜色,如真正的油漆?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆