Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 557611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:02:40+00:00 2026-05-13T12:02:40+00:00

How can I rotate an Image eg. 180 degrees clockwise using the Matrix I

  • 0

How can I rotate an Image eg. 180 degrees clockwise using the Matrix

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

var matrix: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);

Each time I run the code the image is rotated +90 degrees.

What I want is not to increment by 90 each time, but explicit say rotate 180, rotate90 and so on.

I am not familiar with the Matrix, but I guess it does real bitmapdata manipulation rather than just eg. rotate the Image component box (arrest me if I am wrong).

If so, I guess I have to reset the image each time I do the rotate command.

Am I missing something?

Thanks in advance for any advice and tips

Ran

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T12:02:41+00:00Added an answer on May 13, 2026 at 12:02 pm

    The matrix does no real bitmapdata manipulation.

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

    So as your code is currently standing, yes, you either have to refresh the image from scratch before every rotation, or you will have to keep track of the rotations in a variable and calculate how many more times you have to rotate to get to the desired rotation.

    If you need to do multiple 90 degrees rotation in one step, then replace

    matrix.rotate(Math.PI/2);
    

    with

    matrix.rotate(Math.PI/2 * howmanytimesyouwanttorotateby90degrees);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple 3D cube that I can rotate using the following code:
HI, Is there a way by which I can rotate an image inside a
How can I rotate the Apache Access and Error logs on a Window 2000
I want to show a label rotated 90 degrees (so I can put a
I'm looking for an algorithm that rotates an image by some degrees (input). public
Can somebody point me to a resource that explains how to go about having
Can anyone (maybe an XSL-fan?) help me find any advantages with handling presentation of
Can you cast a List<int> to List<string> somehow? I know I could loop through
can you recommend some good ASP.NET tutorials or a good book? Should I jump
Can a LINQ enabled app run on a machine that only has the .NET

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.