简体   繁体   English

开罗RGB颜色范围

[英]Cairo RGB color range

I'm using cairo in haskell, and the setSourceRGB function takes values between 0 and 1. Does anyone know how this corresponds to the standard 0-255 gradient? 我在haskell中使用cairo,并且setSourceRGB函数的值介于0和1之间。有人知道这与标准0-255渐变如何对应吗? As in, is the 255 gradient evenly distributed over 0-1, or is it somehow different? 例如,255梯度是在0-1上均匀分布的,还是有所不同?

From the colour package documentation, whose author definitely knows more about colours than you or I: 颜色包装文档中,其作者肯定比您或我对颜色了解更多:

Interfacing with the colour for other libraries, such as cairo and OpenGL, can be a challenge because these libraries often do not use colour spaces in a consistent way. 与其他库(例如cairo和OpenGL)的颜色进行接口可能是一个挑战,因为这些库通常不会以一致的方式使用颜色空间。 The problem is that these libraries work in a device dependent colour space and give no indication what the colour space is. 问题在于这些库在与设备相关的色彩空间中工作,而没有给出色彩空间的指示。 For most devices this colours space is implicitly the non-linear sRGB space. 对于大多数设备,此颜色空间隐含为非线性sRGB空间。 However, to make matters worse, these libraries also do their compositing and blending in the device colour space. 但是,更糟的是,这些库还在设备颜色空间中进行合成和混合。 Blending and compositing ought to be done in a linear colour space, but since the device space is typically non-linear sRGB, these libraries typically produce colour blends that are too dark. 混合和合成应该在线性颜色空间中进行,但是由于设备空间通常是非线性sRGB,因此这些库通常会产生太暗的颜色混合。

Because these other colour libraries can only blend in device colour spaces, they are fundamentally broken and there is no "right" way to interface with them. 由于这些其他颜色库只能在设备颜色空间中混合,因此它们从根本上被破坏了,并且没有“正确”的方式与它们交互。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM