GoodBoyDigital/pixi.js — pull request #459 by peci1 (2013-12-26 22:55:59+00:00)
Title: Added the transparency-based hit area (usable in DisplayObject.hitArea).

Hello GoodBoy. I've just finished implementing a brand new type of hit area.

This hit area can be used instead of e.g. PIXI.Rectangle in DisplayObject.hitArea. It allows to say that a sprite can be hit only in non-transparent areas, whereas transparent areas report no hit.

Because it is needed to read out texture data and there is no direct interface for that, it instead creates a canvas or WebGL framebuffer, renders the texture to them and then reads the pixel values from that canvas or framebuffer.

Memory requirements: 1 full texture in memory for each base texture (the texture is shared among frames).

CPU/GPU requirements: in the initialization phase only. After init, only a single array access and one comparison is used to decide what contains() should return.