我可能没有使用正确的颜色术语,但我希望能够基本上像附图一样缩放颜色。 我一直在寻找饱和度来做到这一点,因为看起来正确的版本只是左侧的饱和度较低的版本。
我尝试了这个(我发现的),但看起来一点也不正确:
Public Shared Function GetDesaturatedColor(color As Color) As Color
Const kValue As Double = 0.01R
Dim greyLevel = (color.R * 0.299R) + _
(color.G * 0.587R) + _
(color.B * 0.144R)
Dim r = greyLevel * kValue + (color.R) * (1 - kValue)
Dim g = greyLevel * kValue + (color.G) * (1 - kValue)
Dim b = greyLevel * kValue + (color.B) * (1 - kValue)
' ColorUtils.ToByte converts the double value
' to a byte safely
Return color.FromArgb(255, _
ColorUtils.ToByte(r), _
ColorUtils.ToByte(g), _
ColorUtils.ToByte(b))
End Function
有没有人知道一些可以做到这一点的算法?