FromArgb vs FromScRgb

前端 未结 4 1994
花落未央
花落未央 2020-12-20 07:43

Should these two expressions result in colors which are roughly the same?

Color.FromArgb(255, 255, 255, (byte)0.25 * 255))

Color.FromScRgb(1.0f, 1.0f, 1.0f,         


        
4条回答
  •  伪装坚强ぢ
    2020-12-20 08:15

    Same answer as already mentioned - they do not map linearly ( they are different colour spaces - ScRGB is not SRGB with higher precision )

    To mzzzzb "@FurqanSafdar the solution you have given may be correct. but thats not the point here, the thing is that -- intuitively we assume them to be linearly related. btw how did you get to that solution"

    ( We all know what assume does. ) Perhaps it would have been better to link to the definitions of sRGB and ScRGB ! Also, given that they are different color spaces with different ranges, why would you assume ?

    You can see the source code and what is being performed:

    FromScRGB

    FromArgb

    In particular the conversion functions:

    ScRgbTosRgb

    sRgbToScRgb

    The ScRgbTosRgb function is the ColorFloatToByte mentioned by Furqan Safdar.

提交回复
热议问题