actionscript 3 - Flex Matrix rotate Image n degrees -


How do I rotate an image like 180 degrees clockwise using matrix

I get image 90 I can use the following code to rotate the degree, but it is incremental, meaing

  var metrics: matrix = new matrix (); Matrix.rotate (Math.PI / 2); Matrix tx = imgControl.content.height; Var Bitmapdata: Bitmapdata = New Bitmapdata (imgControl.content.height, imgControl.content.width); BitmapData.draw (imgControl.content, matrix); ImgControl.source = new bitmap (bitmapdata);  

Every time I run the code, the image rotates + 90 degrees.

I do not want to increase 90 times every time, but it is clear that rotate 180, and so on.

I'm not familiar with the matrix, but I think it manipulates the actual bitmap data instead of just the example. Image component rotates box (if I'm wrong then arrest me)

If so, then I feel that whenever I rotate the order I will reset the image every time.

Am I missing something?

P> Matrix does not manipulate any actual bitmap data.

This is the bitmap.draw call that pulls the rotated image of imgcontrol.content into bitmap, after which your code overwrites imgcontrol.content with the rotated image.

That's because your code is currently standing, yes, you have to refresh the image before each rotation, or you must keep track of a rotation variable and calculate how much to get the desired rotation The bar will rotate you.

If you need 90 degrees of rotation in one stage, then

  matrix.rotate (Math.PI / 2);  

with

  matrix. Rotate (Math .PI / 2 * howmanytimesyouwanttorotateby90degrees);  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -