bitmapdata

make visual clone of displayObject that's nested within other displayObjects, and add the clone to the stage layer in the same location, rotation, etc

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-10 23:57:57
问题 I want to be able to grab a copy of a DisplayObject that is nested within other transformed DisplayObjects (rotated, scaled, stretched objects), and be able to stamp it back into the same visual location, but on the stage layer. Essentially, being able to make a clone of a nested DisplayObject, but be able to add the clone to the stage layer, yet have it perfectly align (visually) with the original (same position, scale, rotation) I have been working with something along the lines of: // draw

AS3 How to check if BitmapData is empty

﹥>﹥吖頭↗ 提交于 2019-12-10 19:03:14
问题 I have a code to erase a masked movieclip. (credits here) I would like to know how I can check if the whole movieclip is been erased. So I thought I had to check if the BitmapData is empty, but I could be terribly wrong! How can I check if every pixel of the movieclip has been erased? Of course my example below is wrong, but I think it has to be something like that. if (erasableBitmapData = empty) { trace("empty") } var lineSize:Number=40; var doDraw:Boolean=false; var resumeDrawing:Boolean

Rotate bitmap data in AS3 180deg for export

三世轮回 提交于 2019-12-10 15:48:18
问题 I have a bitmap in AS3 flash and I am sending it over to javascript using a base64 encoded jpg string. All that works great. I need to send the img over scaled down, and rotated 180deg. The scaling works, but not the rotation. The rotation never takes. I know Im am obviously doing it wrong, but don't know the right way. So basically I just need to rotate the image 180deg so when it is sent to javascript it is upside down. Here is my transform code var scaleFactor:int = 5; var tempBitmap

BitmapData - scale and select area in one matrix?

人盡茶涼 提交于 2019-12-08 13:29:48
问题 I'm using a transform matrix as part of a bitmap draw to select an area of my target rather than drawing from 0,0: var bmd:BitmapData = new BitmapData(target.width,target.height,true,0); var mat:Matrix = new Matrix(1,0,0,1,-target.x,-target.y); bmd.draw(this,mat); This works perfectly, drawing the contents of this using target as a boundary. I can also use a matrix to scale as I draw like this: var scale:Number = .32; var bmd:BitmapData = new BitmapData(target.width/scale,target.height/scale

Android Renderscript Allocation.USAGE_SHARED crash

半城伤御伤魂 提交于 2019-12-08 08:25:04
问题 I am getting a crash while running my app which uses renderscript. Unfortunately, the logcat does not give any specific details. b = Bitmap.createBitmap(ib.getWidth(), ib.getHeight(),ib.getConfig()); Allocation mInAllocation = Allocation.createFromBitmap(mRS, inBitmap, Allocation.MipmapControl.MIPMAP_NONE,Allocation.USAGE_SHARED); Allocation mOutAllocation2 = Allocation.createFromBitmap(mRS, outBitmap, Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_SHARED); ...execute an algorithm

Flash/Flex crossdomain issue - using BitmapData.draw() for image from AWS S3 results in SecurityError: Error #2122: Security sandbox violation

自闭症网瘾萝莉.ら 提交于 2019-12-07 22:01:27
问题 I am using BitmapData.draw() on a DisplayObject that includes an image from my AWS S3 bucket. The image loads fine in the swf when I set the S3 image URL as the source for an Image object but when I use BitmapData.draw() on it, it gives me this error: SecurityError: Error #2122: Security sandbox violation: BitmapData.draw: https://www.example.com/Example.swf cannot access https://s3.amazonaws.com/example-images/example.jpg. A policy file is required, but the checkPolicyFile flag was not set

URLLoader data to BitmapData

谁都会走 提交于 2019-12-07 05:47:55
问题 I'm trying to load an image file that's right next to the .SWF file. Something like this: var loader:URLLoader = new URLLoader(); loader.dataFormat = URLLoaderDataFormat.BINARY; loader.addEventListener(Event.COMPLETE, function(e:Event):void { trace(typeof(loader.data)); graphic = spritemap = new Spritemap(loader.data, 32, 32); ... } But this is the output I get: object [Fault] exception, information=Error: Invalid source image. The thing is loader.data has the image's bytes but is not a

Why do Loader objects kill bitmapdata draw();?

北战南征 提交于 2019-12-06 15:24:55
问题 The code below is a simple add and save program. You press the addButton to add content to the canvas and than press the exportButton to save an image of the canvas in its current state to your desktop. This code works fine when I add circle objects to the canvas that are drawn to the canvas. The problem lies when I try to load a .png into the canvas. Once the loaded content is added to the canvas the exportButton stops working all together and no longer responds. What is causing the loaded

How to upload BitmapData to a server (ActionScript 3)?

天涯浪子 提交于 2019-12-06 13:18:15
问题 I have bitmapData. I want to upload it to a server using URLLoader. I tried many ways, but with no result. This is my current code in ActionScript 3: import flash.net.URLLoader; import flash.net.URLRequest; import mx.graphics.codec.JPEGEncoder; ... var jpg:JPEGEncoder = new JPEGEncoder(); var myBytes:ByteArray = jpg.encode(bitmapData); var uploader:URLLoader = new URLLoader(); var request:URLRequest = new URLRequest("uploadFile.php"); request.contentType = "application/octet-stream"; request

Comparing bitmap data in AS3 pixel for pixel

半城伤御伤魂 提交于 2019-12-06 11:04:42
问题 I am looking for a fairly simple image comparison method in AS3. I have taken an image from a web cam (with no subject) passed it in to bitmap data, then a second image is taken (this time with a subject) to compare this data, from these two images I would like to create a mask from the pixels that match on both bitmaps. I have been scratching my head for a while, and I am not really making any progress. Could any one point me in the right direction for pixel comparison method, something like