Advertisement
Guest User

Untitled

a guest
Mar 1st, 2012
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. This is related to this bug since it was designed to be used with the drawImageData method.
  2. https://www.w3.org/Bugs/Public/show_bug.cgi?id=11517
  3.  
  4. 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).
  5.  
  6. 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:
  7.  
  8. context.save();
  9. context.stencil = imageDataStarMap;
  10. context.drawImageData(imageDataOverlay);
  11. context.restore();
  12.  
  13. 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