Ωmega
Ωmega

Reputation: 43673

Resizing Canvas by adding space on top and left..?

Is it possible to resize canvas by adding a fresh space on top and left of the canvas - by adding dx pixels on left and dy pixels on top? If so, what is the best optimized solution to do that, if the current canvas is very large...?

Upvotes: 1

Views: 515

Answers (1)

Simon Sarris
Simon Sarris

Reputation: 63812

Yes this is possible with an in-memory canvas. All you have to do is "save" the canvas bitmap by drawing it to a temporary in-memory canvas, resize your canvas, and draw back the old bitmap in the right place.

Here's a live example of that:

http://jsfiddle.net/simonsarris/YdtEd/

Upvotes: 1

Related Questions