0

I draw a lot of sectors on canvas (like a circle graph) and I need rotate it. Unfortunately it's to slow, so I tried to draw it only once and than save bitmap and draw the bitmap. I tried:

 v=ctx.getImageData(0, 0, 100, 100)
 ctx.rotate(Math.PI/2)
 ctx.putImageData(v, 0, 0)

The problem is, that ImageData doesn't rotate (even translate and scale doesn't work). Is it posible to make just Image? I couldn't find the answer, there's just canvas.toDataURL, but it takes whole canvas, I need just part of it.

knezi
  • 247
  • 1
  • 12
  • 3
    Do you have any more code or explanation? My thinking is you could make a temporary canvas and draw your somewhat static images on them once in the beginning and just use `drawImage` from the temp canvases to your main which will then respect the transformation matrix. Otherwise to rotate imageData, you have to reorder the actual array containing the data – Loktar Jun 19 '14 at 14:42
  • haha no problem, glad to have helped even if it only was a comment :P – Loktar Jun 19 '14 at 17:01

0 Answers0