如何将RGB颜色更改为HSV? [英] How to change RGB color to HSV?

查看:163
本文介绍了如何将RGB颜色更改为HSV?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将RGB颜色更改为HSV?在C#语言。
我搜索非常快的方法没有任何外部库。

How to change RGB color to HSV? In C# language. I search for very fast method without any external library.

推荐答案

你是否考虑过简单地使用System.Drawing命名空间?例如:

Have you considered simply using System.Drawing namespace? For example:

System.Drawing.Color color = System.Drawing.Color.FromArgb(red, green, blue);
float hue = color.GetHue();
float saturation = color.GetSaturation();
float lightness = color.GetBrightness();

请注意,这不是您要求的内容(请参阅 HSL和HSV之间的差异和Color类别没有从HSL / HSV转换回来,但后者合理地易于添加

Note that it's not exactly what you've asked for (see differences between HSL and HSV and the Color class does not have a conversion back from HSL/HSV but the latter is reasonably easy to add.

这篇关于如何将RGB颜色更改为HSV?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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