Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- This is related to this bug since it was designed to be used with the drawImageData method.
- https://www.w3.org/Bugs/Public/show_bug.cgi?id=11517
- This was just a performance optimization for very special case algorithms that requires rendering to only a specific region of the screen with a binary stencil. So while the clip() method performs clipping on anything rendered it takes a performance hit by using a clipping algorithm. Ideally a stencil() operation could be given an ImageData object where only the alpha channel is used and 0 means not to render the pixel. (You could use a byte array, but it wouldn't fit into the current API).
- So pretend you loaded an image of a star map then you wanted to render another image and have the pixels only show up in the stars. Without allocating temporary buffers the API might look like:
- context.save();
- context.stencil = imageDataStarMap;
- context.drawImageData(imageDataOverlay);
- context.restore();
- It would only be useful really for rendering imageData very quickly using another imageData as a mask.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement