S
S
Sergey2011-10-13 01:45:27
Canvas
Sergey, 2011-10-13 01:45:27

Canvas: Resizing the canvas

Is there a way to resize an already rendered canvas? In a sense, there is a canvas with pictures and text drawn on it. You need to resize (proportionately) so that the contents of the canvas also resize. Or is it impossible? Just redraw on a smaller scale?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
jov, 2011-10-13
@jov

oldimg = context.getImageData(0, 0, context.canvas.width, context.canvas.height);
//resize canvas
context.putImageData(oldimg, 0, 0, 0, 0, context.canvas.width, context.canvas.height);

E
eliah_lakhin, 2011-10-13
@eliah_lakhin

Generally speaking, not at all. You can try as jov wrote above, but if I'm not mistaken, when the canvas context is deleted, the saved ImageData disappears, and without recreating the canvas context, you can't change the dimensions.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question