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

  • SEARCH
  • Home
  • 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 130897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T06:01:13+00:00 2026-05-11T06:01:13+00:00

Does anyone have an example of using the ImageSnapshot.captureBitmapData function with a rotation matrix?

  • 0

Does anyone have an example of using the ImageSnapshot.captureBitmapData function with a rotation matrix? This is the code I’m using:

var matrix:Matrix = new Matrix(); matrix.rotate(degreesToRadians(90)); var bitmapData:BitmapData = ImageSnapshot.captureBitmapData(textInput, matrix); 

But unfortunately this throws an error on the following line in ImageSnapshot.as:

data = new BitmapData(scaledWidth, scaledHeight, true, 0x00000000); // <-- THROWS ERROR HERE AS scaledWidth / scaledHeight are extremely small numbers (-1-e16 etc)             data.draw(source, matrix, colorTransform,                       blendMode, clipRect, smoothing);         }         finally         {             if (source is IUIComponent)                 finishPrintObject(IUIComponent(source), normalState); // <-- ERROR THROWN HERE, BUT CAUSE OF ERROR IS ABOVE         } 

What I’m trying to achieve is a rotated bitmap of a text input control (I’m trying to avoid embedding a font in the application). This code works just fine when I don’t rotate the bitmap, but the minute I rotate it, it breaks.

Post-Accepted-Answer Edit

I was working with a loader class in my original problem, and I also wanted the text 270degrees – so here’s the text which does that:

var matrix:Matrix = new Matrix();                         matrix.rotate(Math.PI * 1.5);                         matrix.translate(0, copyThis.width);                          var bitmapData:BitmapData = ImageSnapshot.captureBitmapData(copyThis, new Matrix());                         var rotatedBitmap : BitmapData = new BitmapData(bitmapData.height, bitmapData.width, false, 0xFFFF0000);                          rotatedBitmap.draw(bitmapData, matrix);                          loader.load(new Bitmap(rotatedBitmap)); 

Thank you!

  • 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. 2026-05-11T06:01:14+00:00Added an answer on May 11, 2026 at 6:01 am

    I have just been able to reproduce this so it indeed seems like bug in the ImageSnapshot class. All i can think of is that it’s just not been tested using a rotation Matrix so it’s been completely missed. Obviously trying to create a bitmapData less than 1×1 is the reason it’s throwing the error. Can’t seem anyway round it to be honest.

    Would think your best bet could be to create your own simplified snap shot class, or to just use an identity matrix to get the original bitmap, and then copy that into a new bitmapData that can house the rotated version.

    Edit

    on another note… as flash components are registered from the top right, you also need to translate the matrix across by the original height. Though that may have solved the original problem but it still breaks. Here’s a solution that uses a new BitmapData and transforms the one created by ImageSnapshot

    <?xml version='1.0' encoding='utf-8'?> <mx:Application xmlns:mx='http://www.adobe.com/2006/mxml' layout='absolute'>     <mx:Script>         <![CDATA[             import mx.graphics.ImageSnapshot;               private function clickHandler(event : MouseEvent) : void             {                 var matrix:Matrix = new Matrix();                 matrix.rotate(Math.PI / 2);                 matrix.translate(copyThis.height, 0);                  var bitmapData:BitmapData = ImageSnapshot.captureBitmapData(copyThis, new Matrix());                 var rotatedBitmap : BitmapData = new BitmapData(bitmapData.height, bitmapData.width, false, 0xFFFF0000);                  rotatedBitmap.draw(bitmapData, matrix);                  var g : Graphics = copyTo.graphics;                  g.clear();                 g.beginBitmapFill(rotatedBitmap);                 g.drawRect(0,0, rotatedBitmap.width, rotatedBitmap.height);                 g.endFill();             }         ]]>     </mx:Script>      <mx:VBox width='100%' height='100%' horizontalAlign='center'>         <mx:Canvas width='100%' height='100%'>             <mx:TextInput id='copyThis' text='COPY THIS'  horizontalCenter='0' verticalCenter='0'/>         </mx:Canvas>         <mx:Canvas id='copyTo' width='100%' height='100%' />         <mx:Button id='copyIt' label='COPY IT' click='clickHandler(event)' />     </mx:VBox> </mx:Application> 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 368k
  • Answers 368k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The Entity Framework designer is terrible - I've had the… May 14, 2026 at 5:11 pm
  • Editorial Team
    Editorial Team added an answer If by "hijack" you meant sniff the packets then what… May 14, 2026 at 5:11 pm
  • Editorial Team
    Editorial Team added an answer If you want two actions to be atomic, embed them… May 14, 2026 at 5:11 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.