BitmapData Resize and rotation

Hi there,
I'm having some problems manipulating an image with AS3 and Flash Player 10.
I've managed to edit a Bitmap from a local image by changing it's size and rotation with the help of class Matrix.
The problem is that now I want to save the new image to the disk as a PNG file.
I'm using a PNG as encoder that requires a BitmaData.
When I passed that Bitmap.bitmapData all of the matrix changes do not get reflected in the bitmapData.
Here is the code:
var BMP:Bitmap  = Bitmap (LOADERINFO.content);
      BMP.pixelSnapping = PixelSnapping.ALWAYS;
      BMP.smoothing     = true;
      BMP.bitmapData.lock ();
var scale:Number = .2;
var matrix:Matrix = BMP.transform.matrix;
      matrix.rotate(90*(Math.PI/180));
      matrix.scale (scale,scale);
     BMP.transform.matrix = matrix;
var BMPD:BitmapData = new BitmapData ( BMP.width, BMP.height, true, 0x00000000 );
      BMPD.draw(BMP);
var BMP2:Bitmap = new Bitmap ( BMPD, PixelSnapping.ALWAYS, true );
// JUST TO TEST
addChild (BMP);
addChild (BMP2);
Thanks,
PM

oops, typo:
kglad wrote:
try:
var BMP:Bitmap  = Bitmap (LOADERINFO.content);
      BMP.pixelSnapping = PixelSnapping.ALWAYS;
      BMP.smoothing     = true;
      BMP.bitmapData.lock ();
var scale:Number = .2;
var matrix:Matrix = BMP.transform.matrix;
      matrix.rotate(90*(Math.PI/180));
      matrix.scale (scale,scale);
     BMP.transform.matrix = matrix;
var BMPD:BitmapData = new BitmapData ( BMP.width, BMP.height, true, 0x00000000 );
      BMPD.draw(BMP,matrix);
var BMP2:Bitmap= new Bitmap(BMPD);
// JUST TO TEST
addChild (BMP);
addChild (BMP2);

Similar Messages

  • Using IOS 7.1.2 on Safari when I leave the focus on a input on my webpage and rotate my device from Horizontal to vertical, I see a black space on the right and the page is not displayed properly. Any solutions to this problem?

    iOS Version: 7.1.2
    Browser: Safari
    I have a sample log-in page with two input fields and a submit button. When I focus on any of the input fields in landscape mode and rotate my phone and come to the portrait mode I see a weird black space towards the right of my page. Screenshots attached below:
    My page code below:
    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0" />
        <title>IOS Test</title>
        <style type="text/css">
            a, abbr, acronym, address, applet, article, aside, audio, b, blockquote, big, body, center, canvas, caption, cite, code, command, datalist, dd, del, details, dfn, dl, div, dt, em, embed, fieldset, figcaption, figure, font, footer, form, h1, h2, h3, h4, h5, h6, header, hgroup, html, i, iframe, img, ins, kbd, keygen, label, legend, li, meter, nav, object, ol, output, p, pre, progress, q, s, samp, section, small, span, source, strike, strong, sub, sup, table, tbody, tfoot, thead, th, tr, tdvideo, tt, u, ul, var
                background: transparent;
                border: 0 none;
                font-size: 100%;
                margin: 0;
                padding: 0;
                border: 0;
                outline: 0;
                vertical-align: top;
            ol, ul
                list-style: none;
            blockquote, q
                quotes: none;
            table, table td
                padding: 0;
                border: none;
                border-collapse: collapse;
            img
                vertical-align: top;
            embed
                vertical-align: top;
            article, aside, audio, canvas, command, datalist, details, embed, figcaption, figure, footer, header, hgroup, keygen, meter, nav, output, progress, section, source, video, div
                display: block;
            mark, rp, rt, ruby, summary, time
                display: inline;
            input, textarea
                border: 0;
                padding: 0;
                margin: 0;
                outline: 0;
            iframe
                border: 0;
                margin: 0;
                padding: 0;
            input, textarea, select
                margin: 0;
                padding: 0;
            body
                font-family: Arial, Myriad Pro, Trebuchet MS, sans-serif;
                font-size: 100%;
                background: #F5F5F5;
            a
                text-decoration: none;
            a:hover
                text-decoration: none;
            img, object, embed, video
                max-width: 100% !important;
            .clear
                display: block !important;
                width: 100% !important;
                clear: both !important;
            .body
                position: fixed;
                width: 100%;
                top: 0;
                left: 0;
                overflow-y: scroll;
                -ms-overflow-style: -ms-autohiding-scrollbar;
                -webkit-overflow-scrolling: touch;
                -ms-touch-action: pan-y;
                -ms-user-select: none;
                z-index: 0;
            .body > *
                -webkit-transform: translateZ(0px);
            .header
                background: #fff;
                text-align: center;
                border-bottom: #45A116 solid 8px;
                padding: 5% 10%;
            .content
                width: 70%;
                position: relative;
                margin: 20% auto 10% auto;
                text-align: center;
            .content input
                display: block;
                background: #E6E6E6;
                border-radius: 15px;
                border-bottom: #A8A8A8 solid 3px;
                margin-bottom: 5%;
                width: 96%;
                padding: 4% 2%;
                text-align: center;
                color: #595959;
            .content a
                display: inline-block;
                padding: 2% 10%;
                color: #fff;
                background: #45A116;
                margin-top: 5%;
                border-radius: 5px;
                border-bottom: #2C690E solid 3px;
                -webkit-transition: all 0.1s linear;
                -moz-transition: all 0.1s linear;
                -ms-transition: all 0.1s linear;
                -o-transition: all 0.1s linear;
            .content a:active
                background:#368011;
        </style>
        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js" type="text/javascript"></script>
        <script type="text/javascript">
            function adjustBody() {
                var wh = $(window).height();
                $(".body").css({
                    "height": wh + "px"
            $(document).ready(function () {
                adjustBody();
                $(window).resize(function () {
                    adjustBody();
        </script>
    </head>
    <body>
        <div class="body">
            <div class="header">
                <img src="sampleImage.png" alt="Sample Logo" />
            </div>
            <form action="" method="get" id="sampleForm">
            <div class="content">
                <input type="email" value="User Name" onblur="if($(this)[0].value == ''){$(this)[0].value = 'User Name';}"
                    onfocus="if($(this)[0].value != '' && $(this)[0].value == 'User Name'){$(this)[0].value = ''};" />
                <input type="password" value="Password" onblur="if($(this)[0].value == ''){$(this)[0].value = 'Password';}"
                    onfocus="if($(this)[0].value != '' && $(this)[0].value == 'Password'){$(this)[0].value = ''};" />
                <a href="javascript:void(0);" onclick="$('#sampleForm').submit();">Login</a>
            </div>
            </form>
        </div>
    </body>
    </html>
    Does anyone have any solutions to this problem?
    Regards,
    Mayank Tripathi

    ALWAYS SAVE YOUR idevice USING ICLOUD !!!! IT SAVES ... ALL !! (includings apps data, but the apps themselves ! USE IT ! i done this...)

  • Resizing and printing a photo

    Hello all.Could someone please tell me how to use the printer window in Preview to resize a JPG photo.I want to make the photo larger.I have a Mac Pro with Snow Leopard as my operating system.Thank you.

    Use AffineTransformOp.
    Here is my code
    //create an affinetransform (methods to set scale and rotation - I'm setting values directly)
    AffineTransform image_at=new AffineTransform(Trm[0][0],Trm[1][0],Trm[0][1],(Trm[1][1]),0,0);
    //make an imageOp
    AffineTransformOp flip= new AffineTransformOp(image_at,hints);
    //apply the opt to current image and put result in temp_image
    temp_image=flip.filter(current_image,null);
    MArk

  • Resizing and Printing a bufferedImage.

    I have a bufferedImage , and I was wondering if somebody could supply me with a method to resize it to the paper size and print it out with out asking the user anything. Except are you sure you want to print? This would be of great help!

    Use AffineTransformOp.
    Here is my code
    //create an affinetransform (methods to set scale and rotation - I'm setting values directly)
    AffineTransform image_at=new AffineTransform(Trm[0][0],Trm[1][0],Trm[0][1],(Trm[1][1]),0,0);
    //make an imageOp
    AffineTransformOp flip= new AffineTransformOp(image_at,hints);
    //apply the opt to current image and put result in temp_image
    temp_image=flip.filter(current_image,null);
    MArk

  • BitmapData.draw() and displayobject with 3D transformations

    Hi all,
    I have a sprite with some objects in it which are transformed in 3D (positioned and rotated). The objects form a coneshape in such a way that the objects that make up the back are hidden.
    When I use that sprite as a source for the bitmapData.draw() it is drawn from another viewpoint so it seems. In my case the copy is viewed slightly from the bottom and right.
    Bottomline:
    Does anyone know of a way to duplicate the image of a sprite which contains 3D manipulated graphics?
    thanks in advance,
    Manno

    Nevermind:
    var pp:PerspectiveProjection = new PerspectiveProjection();
    pp.projectionCenter = new Point( 0, 0 );
    sphere.transform.perspectiveProjection = pp;
    Where sphere is the object to use as a source in the draw method. It seems OK now it has it's own perspectiveProjection set.

  • Film loops and rotation

    I have a character that is seen from the top and I can move
    and rotate it - as long as it is a single image. However, I've put
    together a 4 frame film loop and the film loop won't rotate. Is
    there any way to do that - rotate a film loop? Can I get at the
    sprites in the film loop instead? I can use an animated gif but the
    line quality is a bit rubbish. Would a small linked movie be
    controllable? Any other suggestions?
    Thanks

    You can get access to any of the loop's sprites through the
    loop-sprite's movie property. Assuming you used sprite channel 1
    for your 4 frame loop, then the following behavior will rotate
    those sprites inside the film loop.
    property pMovieSprite
    on beginSprite me
    pMovieSprite = sprite(me.spriteNum).movie.sprite(1)
    end
    on enterframe me
    pMovieSprite.rotation = pMovieSprite.rotation + 10
    end
    In the property inspector select the "Film Loop" tab for your
    film loop member and select the "Crop" and "Center" radio buttons.
    This will enable you to resize the film loop sprite to fix any
    cropping issues.
    Note: This will also work for LDMs - Linked Director Movies,
    if you want to use these "Loops" across multiple movies.

  • My homescreen won't resize and I can't access anything because everything is too big to navigate.  Help.

    My homescreen won't resize and I can't access anything because everything is too big to navigate.  Help.

    Double-tap the screen with three fingers to disable Zoom.
    To turn off Zoom go to Settings > General > Accessibility > Zoom and turn this Off.

  • How separate and rotate pieces of an object in preparation for creation of a GIF in After Affects?

    Here is the image that I'm working with...
    I want to make this object rotate a tight 90 degrees in After Effects and then separate. If you're wondering why I put this up under Photoshop it is because I need to have this model in addition to 2 others, one of the top half and one of the bottom half and button, both turned 90 degrees [preferably clockwise] in order to create the GIF. I need these 3 pieces before I can even consider creating the GIF in After Effects... so if somebody either wants to try and do it for me or to try and help me to do it on my own, either one would be extremely helpful

    Don't worry guys, I actually found the answer all on my own what I needed was to separate the image into 3 files, something I was probably going to do anyways to make exporting and importing the images easier and rotating the two top and bottom half images here's what I have right now (per background removal)Thanks for trying to help... but I think I'm ready to move on to After effects with this one The reason I'm moving it to after effects is simply because I understand simple movement/animation there already... if you're curious as to what I plan on doing with these images, the complete ball will sit in a hole in my border, turn a sharp 90 degrees right and then be replaced by the two half images, the bottom one will fade slowly out while the top is lifted off screen to the right... it's a fancy reveal for my upcoming project thanks again

  • Trackpad two finger scroll, zoom and rotation does not work, tried everything

    After I updated to lion my trackpad zoom, scroll and rotation feautres won´t work. I´ve tried tip I could find ( restarting, updating to mavericks, enabling them in system preferences, using terminal ect)
    I made an guest account as well, the features work there, but not on my main account and it´s starting to annoy me. Please help
    I have a macbook pro from 2010
    2,4 GHz intel core 2 du
    4gb 1067 mhz ddr3
    os x 10.9.1

    Try to reset the PRAM.
    http://support.apple.com/kb/PH14222
    If that doesn't do it, reset the SMC.
    http://support.apple.com/kb/ht3964

  • My MacBook will not boot up past the white screen and rotating circle

    Tried to start up my MacBook. Can't get past the white screen and rotating circle. Left it on for 10 min. same results. Any solutions before I bring it in for repair? Thanks.

    Zap the pram
    Maybe wait longer and see if it does anything or if anything comes up.

  • Adobe camera raw window won't resize and can't reach buttons

    When I open an image from bridge into adobe camera raw 6.1 (Photoshop CS5) on my laptop, the camera raw window fills all of the screen (top to bottom) and the buttons at the bottom of the window are below the task bar. Thus I can't open the image in photoshop except by hitting the enter key. I can't reach the open, etc buttons. The window won't resize and there are no icon/buttons in the right upper corner to go to/from full screen. When I hit the icon in the top right hand menu bar in ACR (to go to full screen size) the window then fills the whole width of the screen in addition to the height, but no matter what I do I can't get the height of the window to shrink, so that I can access the icons at the bottom of the screen. What am I missing? Thanks

    Don't worry about turning aero off just yet.
    There are two key first questions:
    What is your screen resolution (width in pixels x height in pixels)?  Right-click on desktop, choose Screen Resolution.
    What setting have you chosen for the display size (Smaller, Medium, Larger) in the Display dialog?  Right-click on desktop, choose Personalize, then Display.
    -Noel

  • Skew, Warp, Resize and Nest a video in Photoshop???

    I would like to know how to skew, warp and resize a video inside of photoshop cs4.  I would also like to know how to nest multiple video files into one file.
    I am new to Photoshop, I am looking for some tutorials but unable to find any.
    Thanks

    Marian, thanks for the advice.
    Thou I understand your point, very well about screwdriver vs hammer, that was not my question in my post.  I asked a straight forward question about how to Skew, Warp, Resize and Nest a video in Photoshop.  Not which is the best software to use for this task.
    If you know the answer, share the knowledge, is this not what this forum is for or am I in the wrong place???  Before suggesting which tool is best for me to use, try understanding what I want to build first.  This makes all the difference. 
    As I have already proven to myself I don’t need a new tool to accomplish the task I had at hand.  If I took your advice, I and my company would have wasted money on a software that we did not need in the first place.
    Understand your client needs first before giving advice.  Sometimes a hammer is all it takes, if you use right.
    I don’t need to study more on video production, this is not my job.  All I wanted to know was how to edit a video in Photoshop.
    I hope we are not off on the wrong foot because I feel I could learn a lot from you but you need to take the time to understand the question before shooting from the hip with an answer.

  • I have snow leopard installed as an OS.  When trying to reboot a MacBook Pro I am getting stuck on grey screen with apple logo and rotating symbol.  What can I do?

    I have snow leopard installed as an OS.  When trying to reboot a MacBook Pro I am getting stuck on grey screen with apple logo and rotating symbol.  What can I do?

    Maybe this might help.
    http://support.apple.com/kb/TS2570

  • Zoom in-out and rotation in trackpad doesn't work in iPhoto and Aperture. Any solution?

    Zoom in-out and rotation in trackpad doesn't work in iPhoto and Aperture. Any solution?

    Sound like a trackpad problem and not an iPhoto one.  Have you asked in the forum dedicated to the Mac model you're using or is this an add on trackpad?
    OT

  • HT5858 In the control center I can change the mute or the rotation but not both.  How do I fix this.  In settings I can not uncheck both the mute and rotation lock.

    In the control center I can change the mute or the rotation but not both.  In the settings area therefore I can't uncheck the mute and rotation settings at the same time.

    Check your settings. The iPads have a small switch on the right edge. It can be used as a rotation lock to keep the screen from automatically reorienting itself as you move around, but you need to have the tablet’s settings configured properly. That same switch, right above the volume buttons, can also be set to function instead as a mute button to silence certain types of audio.
    If the switch is set to work as a mute button, you can change its purpose to “screen-rotation lock” by tapping the Settings icon on the home screen. On the Settings screen, tap General on the left side, and on the right side of the screen flick down to “Use Side Switch to.” Tap to select Lock Rotation or Mute to set the button’s function. Even if you set the side switch for your preferred use, you can still mute the Mini or lock the screen. Just double-click the Home button, and when the panel of apps appears along the bottom edge of the screen, flick the row from left to right with your finger. Tap the icon on the far left side of the row to either lock the iPad’s screen or mute the iPad’s alerts, notifications and sound effects. Music, podcasts and video are not muted unless you turn the volume all the way down.
     Cheers, Tom

Maybe you are looking for