2 Replies Latest reply on May 14, 2007 7:52 PM by Sirisian

    Bitmap To Bitmap rendering (AS 2.0)

    Sirisian
      There doesn't seem to be a way to render a region of one bitmapData to another bitmapData. Is this a large flaw or is there something I'm missing? I'm currently creating a complex game, and this has been puzzling me. I know about the draw command, but say I want to take a convex polygon region of one bitmapData object and paste that region of pixels to another. How would I do that. I am familiar with the idea that I can draw to a movieclip using the moveTo and lineTo, then just draw to a desired bitmapData, but that extra third party transfer of pixels is very useless and a tad CPU intensive for my liking.

      I've even gone as far as trying to implement my own system using get and set pixel, but that is rather pointless as the code runs far to slow, unlike the optimized functions flash uses.

      I was just wondering if one of the developers could fix this problem (if it really does exist). I thought flash CS3 would fix this simple concept, but they didn't. I don't use movieClips when I program my games, so using them for something this trivial leads me to believe that the developers didn't foresee the use of bitmap region to bitmap much.

      Has anyone else noticed this before? Any fast fixes or workarounds?
        • 1. Re: Bitmap To Bitmap rendering (AS 2.0)
          kglad Adobe Community Professional & MVP
          you can use the copyPixels() method of the bitmap class (as 2 and as 3) to efficiently copy a rectangular region of one bitmap to a rectangular region of another.
          • 2. Bitmap To Bitmap rendering (AS 2.0)
            Sirisian Level 1
            You may have misunderstood. When I say convex polygon I'm referring to an any number of points or slopes. Not to mention, using copyPixels() for copying a rectangle is rather pointless when the draw() method works with both movie clips and bitmaps.
            http://livedocs.adobe.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveD ocs_Parts&file=00001950.html

            For instance, view this image:
            www.sirisian.templarian.com/pictures/convexpolygon2.png
            Then I want to copy the polygon region formed by a group of points,
            www.sirisian.templarian.com/pictures/convexpolygon.png
            resulting in
            www.sirisian.templarian.com/pictures/convexpolygon3.png
            I hope that makes sense. And again, I know transferring to a MC then back to a bitmapData object works, but it is a little slow, and I believe it is unneeded. This is for a real-time game, so I tend to not take any shortcuts. I just find it very odd, that the bitmapData object doesn't have such a function in it.

            I'm looking forward to reading any responses or information concerning this.

            I wish the beginBitmapFill(...); worked with bitmaps. That would make things so much nicer.