Advertisement
Guest User

Untitled

a guest
Oct 25th, 2014
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. // draw the phone case on the canvas
  2. context.drawImage(phonecase,0,0);
  3.  
  4. // set compositing to source-in
  5. // future drawings will only be visible where existing pixels are opaque
  6. context.globalCompositeOperation='source-in';
  7.  
  8. // draw the artwork over the phonecase
  9. // compositing will display the artwork only inside the opaque phonecase pixels
  10. context.drawImage(artCanvas,offsetX,offsetY);
  11.  
  12. // always clean up! Return compositing to its default mode
  13. context.globalCompositeOperation='source-out';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement