3

As Im drawing multiple objects in the same context layer I have stumbled across something.

 context.putImageData(imageData, x, y);

This will overwrite everything in the area of this image data. Dose not mater if data is transparent of not.

Unlike when you draw it to the context.

context.drawImage(spriteImage, x, y);

If it is drawn transparent areas of the image will still act just as they are set, transparent.

So my question is is there a way to drawImage of "ImageData" that is used in putImageData?

I guess an easy solution for this would be another context layer, but that no good for this, as I have a few sprite types that have to share the same layer to be rendered properly and not look bad when it comes to the feel of x, y and z aspects.

Jonas Lindahl
  • 752
  • 10
  • 24
  • Would offscreen rendering be viable? – MarioP Jun 19 '13 at 08:36
  • 1
    possible duplicate of [Is putImageData(...) more performant than drawImage(...)?](http://stackoverflow.com/questions/7721898/is-putimagedata-more-performant-than-drawimage) – Tom Roggero Jan 20 '14 at 17:56

0 Answers0