bitmapdata

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

早过忘川 提交于 2019-12-06 08:30:12
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 when this media was loaded. AS code: var bmpd:BitmapData = new BitmapData(objectToDraw.width

AS3 Blitting - Copy Pixels getting some of the source image

我的梦境 提交于 2019-12-06 08:05:11
问题 I am trying to draw something on the screen and then, copy that onto a bitmap which is on stage. I have done this before, with a procedurally drawn shape like a circle but when I use a library item most of the source pixels get cut off. here's my code - in another function the bitmap object is added to the stage and I can see that copyPixels work but as I have said copies only some of the pixels. I have tried playing with the Rectangle but no luck so far. var s:StarAsset = new StarAsset(); s

AS3 get Bitmap from Movieclip with Mask

醉酒当歌 提交于 2019-12-06 07:21:32
问题 This works: var a:BitmapData = new BitmapData(640,480); var b:Bitmap = new Bitmap(a); a.draw(movieClip); This doesn't work: movieClip.mask = movieClipMask; var a:BitmapData = new BitmapData(640,480); var b:Bitmap = new Bitmap(a); a.draw(movieClip); How can I draw just the visible part of a MovieClip (that uses a mask) into my Bitmap? 回答1: Create a new Sprite and add both the MovieClip and its mask to it. Then draw the parent Sprite. var container:Sprite = new Sprite(); container.addChild

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

怎甘沉沦 提交于 2019-12-04 19:24:07
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.data = myBytes; uploader.load(request); I take an object bitmapData and encode it to jpg. After that I

Comparing bitmap data in AS3 pixel for pixel

核能气质少年 提交于 2019-12-04 17:09:56
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 getPixel32() Cheers Jono back2dos use compare to create a difference between the two and then use

AS3 get Bitmap from Movieclip with Mask

岁酱吖の 提交于 2019-12-04 12:44:28
This works: var a:BitmapData = new BitmapData(640,480); var b:Bitmap = new Bitmap(a); a.draw(movieClip); This doesn't work: movieClip.mask = movieClipMask; var a:BitmapData = new BitmapData(640,480); var b:Bitmap = new Bitmap(a); a.draw(movieClip); How can I draw just the visible part of a MovieClip (that uses a mask) into my Bitmap? Create a new Sprite and add both the MovieClip and its mask to it. Then draw the parent Sprite. var container:Sprite = new Sprite(); container.addChild (movieClip); container.addChild (movieClipMask); movieClip.mask = movieClipMask; var a:BitmapData = new

Convert Bitmap to Mat

≡放荡痞女 提交于 2019-12-01 14:10:39
I need to convert Gdiplus::Bitmap to cv::Map format. I'm using this code to do this: Gdiplus::Bitmap* enhanced = ...; // some Bitmap Gdiplus::BitmapData bmp_data = {}; Gdiplus::Rect rect(0, 0, enhanced->GetWidth(), enhanced->GetHeight()); enhanced->LockBits(&rect, Gdiplus::ImageLockModeRead, enhanced->GetPixelFormat(), &bmp_data); Mat imageMap(enhanced->GetHeight(), enhanced->GetWidth(), CV_8UC3, bmp_data.Scan0, std::abs(bmp_data.Stride)); // construct Map from Bitmap data. The problem is probably here cvNamedWindow("w", 1); cvShowImage("w", &imageMap); // runtime error (access violation)

Convert Bitmap to Mat

一笑奈何 提交于 2019-12-01 13:24:51
问题 I need to convert Gdiplus::Bitmap to cv::Map format. I'm using this code to do this: Gdiplus::Bitmap* enhanced = ...; // some Bitmap Gdiplus::BitmapData bmp_data = {}; Gdiplus::Rect rect(0, 0, enhanced->GetWidth(), enhanced->GetHeight()); enhanced->LockBits(&rect, Gdiplus::ImageLockModeRead, enhanced->GetPixelFormat(), &bmp_data); Mat imageMap(enhanced->GetHeight(), enhanced->GetWidth(), CV_8UC3, bmp_data.Scan0, std::abs(bmp_data.Stride)); // construct Map from Bitmap data. The problem is

AS3 - Webcam video dimensions not carrying over into new BitmapData - defaulting to 320x240

为君一笑 提交于 2019-12-01 01:57:56
I am attempting to capture a 1920x1080 webcam capture and create a new bitmap with the capture. I feel like I have all the dimension settings correct but the final 1920x1080 bitmap only contains a small 320x240 version of the video capture. Help! import flash.display.Bitmap; import flash.display.BitmapData; var bandwidth:int = 1000; // Maximum amount of bandwidth that the current outgoing video feed can use, in bytes per second. var quality:int = 100; // This value is 0-100 with 1 being the lowest quality. var cam:Camera = Camera.getCamera(); cam.setQuality(bandwidth, quality); cam.setMode

AS3 - Webcam video dimensions not carrying over into new BitmapData - defaulting to 320x240

丶灬走出姿态 提交于 2019-11-30 21:05:37
问题 I am attempting to capture a 1920x1080 webcam capture and create a new bitmap with the capture. I feel like I have all the dimension settings correct but the final 1920x1080 bitmap only contains a small 320x240 version of the video capture. Help! import flash.display.Bitmap; import flash.display.BitmapData; var bandwidth:int = 1000; // Maximum amount of bandwidth that the current outgoing video feed can use, in bytes per second. var quality:int = 100; // This value is 0-100 with 1 being the