views:

65

answers:

1

Do you have to first draw any source images into the canvas before you can obtain the pixel array data? or is there a better way? such as having a second hidden canvas?

I am using several images that I will mash together, and draw into the main canvas. What is the best way to obtain to say backgroundData, objectsData, effectsData, from bg.png, obj.png, fx.png? without first showing them in the main canvas.

+1  A: 

I believe (99%, not 100%) you have to draw them to Canvas to get any of the data properties.

That said, you could draw them to a temporary, hidden canvas that you create on the fly and kill when you're done.

michael
Great thanks, that does indeed seem like the way. cheers.
davivid
It is that way -- if you really felt like it you could send an email to the whatwg or public-canvas-api mailing lists requesting the feature, and giving the use case.
olliej