[whatwg] proposed canvas 2d API additions

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