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 583489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:47:55+00:00 2026-05-13T14:47:55+00:00

I have a container with masked bitmap in it. The scale and rotation of

  • 0

I have a container with masked bitmap in it. The scale and rotation of this container changes at runtime, and I need to draw the masked bitmap but cannot figure out the appropriate matrix calculations to do so.

My code works correctly to reflect position, scale, offset for centering without rotation. When rotated, the angle is correct but the positioning is incorrect – I believe because the dimensions change when the rectangle is rotated.

Can someone help me figure out how to compensate for this in the positioning – here is some code:

 // Adjust the transformation matrix to account for the position of the container
        var tMatrix:Matrix = _imgContainer.transform.matrix;

        //Offset for container
        tMatrix.translate(this.x,this.y);

        //Offset for bounds centering
        tMatrix.translate(-_imgContainer.width/2,-_imgContainer.height/2);   

       // Compensate for rotation
       // ????

   var result_bitmap:BitmapData = new BitmapData(_maskedImg.width,_maskedImg.height,true,0x00FFFFFF);
   result_bitmap.lock();
   result_bitmap.draw(_maskedImg,tMatrix,null,null,null,true);
   result_bitmap.unlock();

Thanks in advance for any help you can provide –

b

EDIT:
Sorry if I’m not explaining this correctly, let me try again with an image to support. I have a masked bitmap in a container which I’m using as the source to draw a new bitmap. this container can be scaled/rotated at runtime by the user prior to capturing. In order to accomplish this I pass the draw method a transformation matrix based on the container matrix and adjust the tx and ty values to account for the non-zero origin (due to centering). Up to this point it works fine and captures what I would expect.

However – once this container is rotated, the POSITION of the capture is now off again – presumable due to the dimensions changing, therefore the tx/ty offsets now being incorrect for the new dimensions of the container. I simply need to compensate for this, but cannot figure out how.

Does anyone have experience with the transform matrix that can help?? Thanks again for the effort!

Hosted by imgur.com

Hosted by imgur.com

  • 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-13T14:47:55+00:00Added an answer on May 13, 2026 at 2:47 pm

    FYI for anyone that might come along with similar problems. I solved my issue by explicitly setting the transformation matrix values and in this specific order scale, rotation then translation.

    This was instead of copying the transformation matrix from the container. So instead of

    var tMatrix:Matrix = _imgContainer.transform.matrix;
    

    I am setting the values directly in this order:

    tMatrix.scale (_imgContainer.scaleX, _imgContainer.scaleY);
    tMatrix.rotate (_imgContainer.rotation * (Math.PI/180));
    tMatrix.translate (_imgContainer.x, _imgContainer.y);
    

    Thanks for the effort –

    b

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a container that contains an image that I need to drag from
I have a container MovieClip that serves as a content area that I need
I have a container (div) with a background image. In this div there is
I have this problem where I need to add a red asterisk beside a
i have a container box that includes a number of thumbnails. i earlier made
I have a container DIV which contains several block-DIVS. Every block-DIV contains SPAN items
I have a container class which uses boost::optional to hold the value. Here is
i have a container div which is position:relative and the squares are position:absolute because
I have a container div with the following CSS: #container { position:relative; overflow:hidden; width:200px;
I have a container element that you can drag objects around in. I want

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.