[whatwg] proposed canvas 2d API additions

Vladimir Vukicevic vladimirv at gmail.com
Tue May 16 02:49:37 PDT 2006


On 5/16/06, Arve Bersvendsen <arveb at opera.com> wrote:
> Again, and this goes back to what's already been said about the RGBA
> values in ImageData: Using floats for x,y,w,h will for all practical
> purposes exclude canvas from ever being possible to implement in a
> meaningful way on systems without hardware FPUs.
>
> I realise that we can go on forever debating whether having an API that
> "facilitates data loss" is good or bad, but the fact is that it is
> possible for authors to code around this, and get enough performance to
> perform on weaker devices.

Floats are already used throught the rest of the canvas API; this
should be no slower than calling moveTo() or similar. You're
internally rounding the float that's passed in to an integer that
refers to the actual pixel coordinate.  All subsequent implementaiton
operations happen in terms of ints, so there aren't any actual
operations on floating point, no?  Your JS parser/interpreter is
probably free to use fixed point here as well.

   - Vlad



More information about the whatwg mailing list