是的。简而言之,
<a:gamma>
只是意味着采取sRGB值(0-1比例)并线性化它(转换为线性RGB)。取这些线性RGB值并将其保存为sRGB(如果需要,可将其转换为0-255范围)。
<a:invGamma>
正好相反 - 取线性RGB值(0-1比例)并将其非线性化(转换为sRGB)。将这些非线性化的RGB值保存为sRGB(如果需要,可将其转换为0-255范围)。
那么什么是线性RGB?计算结果为here on Wikipedia's sRGB page。
这里也是一个VBA版本:
Public Function sRGB_to_linearRGB(value As Double)
If value < 0# Then
sRGB_to_linearRGB = 0#
Exit Function
End If
If value <= 0.04045 Then
sRGB_to_linearRGB = value/12.92
Exit Function
End If
If value <= 1# Then
sRGB_to_linearRGB = ((value + 0.055)/1.055)^2.4
Exit Function
End If
sRGB_to_linearRGB = 1#
End Function
Public Function linearRGB_to_sRGB(value As Double)
If value < 0# Then
linearRGB_to_sRGB = 0#
Exit Function
End If
If value <= 0.0031308 Then
linearRGB_to_sRGB = value * 12.92
Exit Function
End If
If value < 1# Then
linearRGB_to_sRGB = 1.055 * (value^(1#/2.4)) - 0.055
Exit Function
End If
linearRGB_to_sRGB = 1#
End Function
您传递中是在0-1范围内的R,G,B分量的value
,无论是sRGB的或线性RGB。你会收到相同的范围,0-1,根据你的需要,你可以转换为0-255范围来构建你的颜色。
好,太感谢宅男。 – 2010-10-24 13:09:49