我想提出一个Color类在C ++中一个非常基本的图形API的一部分。 所以我决定先看看微软的.NET框架,发现它们的颜色类有功能的HSB。
然后,我开始了研究,以确定自己是否应该提供HSB,HSL或HSV或全部在我的课。
所以,我对HSB,HSL,HSV 3个问题:
是HSB一样HSL?
如果没有,为什么没有一个HSBL甚至HSBLV?
我觉得计算这些值的许多不同的方法,可有人告诉我最快的人?
我想提出一个Color类在C ++中一个非常基本的图形API的一部分。 所以我决定先看看微软的.NET框架,发现它们的颜色类有功能的HSB。
然后,我开始了研究,以确定自己是否应该提供HSB,HSL或HSV或全部在我的课。
所以,我对HSB,HSL,HSV 3个问题:
是HSB一样HSL?
如果没有,为什么没有一个HSBL甚至HSBLV?
我觉得计算这些值的许多不同的方法,可有人告诉我最快的人?
Is HSB same as HSL?
No, HSB is the same as HSV but HSL is different. All these are used as a friendly way to represent RGB colors. The Wikipedia article on HSL an HSV explains the differences using color cilinders: HSL and HSV Basically, Hue is the same for HSB and HSL but the Saturation takes different values and Brightness and Lightness are also different.
If not, why isn't there an HSBL or even HSBLV?
I don't get the point. Both HSB/HSV and HSL can represent any RGB color. Having B and L independently is not possible because of the way they are defined. A given HSB Brightness and Saturation is associated to a fixed Lightness. In fact converting between them is very easy.
I find many different methods of calculating these values, can someone show me the FASTEST ones?
There's a similar question here for calculating HSB from RGB: Fast, optimized and accurate RGB <-> HSB conversion code in C There's a Java implementation there that might help. For converting between HSB/HSV and HSL see HSL vs HSB vs HSV
HSV - > RGB(在JS实现这里 )
RGB - > HSV(在JS实现这里 )