|
The HTML canvas has a set of methods, createImageData and putImageData, that look like they will enable you to draw transparent shapes pixel by pixel. The data structures that you manipulate with these methods are pseudo-arrays of pixels, with four bytes per pixel. One byte for red, one for green, one for blue and one for alpha. This alpha byte makes one believe that you are going to be able to manage transparency, but that’s a lie. Here is a little script that attempts to overlay a simple generated pattern on top of a uniform background: var wrong = document.getElementById( "wrong" ).getContext( "2d" ); wrong.fillStyle = "#ffd42a" ; wrong.fillRect(0, 0, 64, 64); var overlay = wrong.createImageData(32, 32), data...
|