简体   繁体   中英

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? As in, is the 255 gradient evenly distributed over 0-1, or is it somehow different?

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. 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. 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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