Re: RFC: More accurate color conversion

Wolfgang Draxinger <[email protected]>
Newsgroups gmane.comp.lib.cairo
Organization DraxIT
Message-ID <[email protected]>
On Sat, 05 Oct 2013 03:02:53 +0200
[email protected] (Søren Sandmann) wrote:

> that serves as the canonical way to convert a double-precision color
> to a uint16_t normalized color. As the comment says, the function
> divides the input range into 65536 equal sized regions, and then it
> maps each region to an integer.
> 
> The function was written following this mail from Carl:
> 
>     http://lists.freedesktop.org/archives/cairo/2006-August/007709.html
> 
> in which among other things he argues that an alternative algorithm:
> 
>     i = floor (f * 65535 + 0.5)
> 
> (...)

I'd like to throw in this little paper, discussing the problem of
floating point <-> integer range conversion at depth: 

http://kaba.hilvi.org/homepage/programming/range/RangeConversion.pdf


Regards

Wolfgang
-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.