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

[whatwg] Image Collision Detection in Canvas

From: Stefan Haustein <haustein@google.com>
Date: Thu, 8 Apr 2010 12:44:54 +0200
Message-ID: <j2le41a53f1004080344ye1221bd0m76fe3b02a842daa5@mail.gmail.com>
On Sun, Apr 4, 2010 at 1:50 PM, Saurabh Jain <saurabh at skjworld.com> wrote:

> I have a proposal for adding generic image collision API in Canvas. Given
> two images HTMLImageElement objects and there respective x, y, clip width
> and clip height the API call will let you know if there's any
> non-transparent pixel (any opaque or translucent pixel) in one image's
> clipping region that overlaps a non-transparent pixel in another image's
> clipping region. The clipping region defined by this API call is for local
> use only for this purpose.

Why not add a general BitBlt library on top of typed arrays (1) instead?

This could also be useful for other applications, e.g. web-based photo



> This API will be useful for game programmers. I am author of India's first
> book on J2ME and have been developing mobile games since 2002. I have
> through personal experience observed that this pixel level collision at
> native level is required for game developers to build games easily. What I
> am referring to is a kind of generic pixel level collision. People are free
> to develop there own complex collision mechanisms for complex games but
> small teams composed of new game developers find image collision detection
> implementation the most difficult concept in the whole game development
> process to grasp.
> Also pixel level checking for two 100 pixel x 100pixel images will involve
> lot of execution time if done at JavaScript level since up to 10000 checks
> may have to be performed. Native browser support can speed things a lot.
> Similar thing happened in J2ME where before MIDP 2.0 people had hard time to
> do pixel level collision both due to programming complexity and execution
> issues.
> Saurabh Jain
> Director
> SKJ Technologies Private Limited
> http://www.skjworld.com
> Author : Mobile Phone Programming using Java ME (J2ME)
> http://library.skjworld.com/mobile-technology/java/java-me

Stefan Haustein
Google UK Limited

Registered Office: Belgrave House, 76 Buckingham Palace Road, London SW1W
9TQ; Registered in England Number: 3977902
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20100408/ab4f96b4/attachment.htm>
Received on Thursday, 8 April 2010 03:44:54 UTC

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