W3C home > Mailing lists > Public > whatwg@whatwg.org > April 2006

[whatwg] proposed canvas 2d API additions

From: Arve Bersvendsen <arveb@opera.com>
Date: Fri, 28 Apr 2006 16:24:54 +0200
Message-ID: <op.s8p2bsl4byn2jm@localhost.localdomain>
On Fri, 21 Apr 2006 21:10:11 +0200, Vladimir Vukicevic  
<vladimirv at gmail.com> wrote:

> Note: we could return the pixels as integers in the range of 0..255,
> as 8-bit color is most likely what canvases will be dealing with.
> However, using floats allow us to easily extend into a 16-bit
> colorspace without any API changes.  In addition, any computation
> using these pixels is often done in normalized colors, so the division
> by 255 would need to happen anyway.

I would suggest that we do not use floats for the color values.   While  
the choice of floats versus integers hardly matters on the desktop, it is  
a big deal on mobile devices, where you (often) may find that there is no  
FPU, so any floating point operations are performed entirely in software.   
The performance implication of this is huge, and we should not sacrifice  
performance for theoretical perfection.

If we are worried about color space depth, we should instead normalize the  
R, G, B and A values to unsigned 16-bit integers. This will overcome any  
hardware limitations, and should suffice for the next few decades.

-- 
Arve Bersvendsen, Opera Software ASA
Received on Friday, 28 April 2006 07:24:54 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:46 UTC