special K
special K

Reputation: 25

Add image from one canvas context to another canvas context

I need method which works like addImage, but only for a canvas context.

How can I add an image from one canvas context to another canvas context?

Upvotes: 0

Views: 428

Answers (1)

Simon Sarris
Simon Sarris

Reputation: 63812

You can use ctx.drawImage with another canvas as the argument (or a <video> even)

The syntax is just ctx.drawImage(someCanvas, 0, 0)

You can even draw one canvas onto itself, which can be useful for drawing overviews or minimaps.

Upvotes: 2

Related Questions