bitmapdata

How do I replace colours in a movieclip?

I am trying to take a movieclip of a character and change the colour of their clothes. The character is comprised of vectors. So far I have semi-sucessfully used this method: stop the movieclip take the bitmap data from the current frame use threshold to replace the colour store the resulting bitmap data in an array add an onenterfram...

Flex: Copying bitmapData of a loaded image into another SWFLoader

I have 2 SWFLoaders like so: <mx:SWFLoader width="10" height="10" complete="imageLoaded()" id="ldr_src" source="img.jpg" scaleContent="true"/> <mx:SWFLoader id="ldr_target" scaleContent="true"/> private function imageLoaded():void{ var bm:Bitmap = new Bitmap(ImageSnapshot.captureBitmapData(ldr_src); ldr_target.source = bm; } ...

Are Bitmap.LockBits and Graphics.FromImage combinable in C#

Can you combine the methods of Bitmap.LockBits and Graphics.FromImage, or in other words if I have a bitmap "bmp" and I want to edit the bitmap with a Graphics-object g, are the changes visible in the byte-array of the BitmapData.Scan0: Bitmap bmp = new Bitmap(200,200); Graphics g = Graphics.FromImage(bmp); bmp.LockBits(new Rectangle(0,...

AS3 - get access to the internal bitmap used by CacheAsBitmap ?

is it possible to get access to Flash's internal bitmap cache of an object when CacheAsBitmap is on ? eg, something like: var bmd:BitmapData = someDisplayObject.getCachedBitmapData(); if (bmd != null) trace("stoked!"); else trace("bummer. got to bmd.Draw(someDisplayObject) ourselves."); seems unlikely, but thought i'd ask. t...

Actionscript Retrieving BitmapData From Sprite Mouse Event

i've created a bitmap with data and placed it into a sprite so to receive mouse events. however, i'm struggling with reading the BitmapData within the sprite. function showBitmapData(e:Event):void { var bData:BitmapData = new BitmapData(video.width, video.height); bData.draw(video); var bmap:Bitmap = new Bitmap(bData);...

Flash: BitmapData.draw(Video) ignores video height.

Hi there...I'm pretty much the rookiest rookie when it comes to Flash. Here's the actionscript (3): // Here's the dumb-dumb: /*****************************************************************/ /*****************************************************************/ function captureImage(e:MouseEvent):void { // The video still-image is c...

[AS3] BitmapData cut-off

Hello, I am writing a MovieClip rasterizer which rasterizes all the frames in the specified movieclip. Here's the code for rasterizing: for ( var i:int = start; i <= end; i++ ) { //goto the next frame clip.gotoAndStop( i ); //get the bounds bounds = clip.getBounds(clip); //create a new bitmapdata container bitmapData = new Bitma...

Trying to capture stage area using BitmapData

I am trying to grab part of stage area using BitmapData and copyPixels method: bmd = new BitmapData(stage.stageWidth, stage.stageHeight); bmdRect = new BitmapData(320, 240); rectangle = new Rectangle(360, 20, 320, 240); bmdRect.copyPixels(bmd, rectangle, new Point()); bmd.draw(bmp); bmp = new Bitmap(bmdRect); var myEncoder:JPGE...

Getting each loaded image

The images only loads into the last MC, how to make it load into each MC? private function imageHandler():void { imageBox=new MovieClip(); imageBox.graphics.lineStyle(5, 0xFFFFFF); imageBox.graphics.beginFill(0xFF0000); imageBox.graphics.drawRect(0,0,150,225); imageBox.graphics.endFill(); allImage.addChild(imageB...

Comparing bitmap data in AS3 pixel for pixel

Hi, 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...

Creating Bitmaps from ARGB strings (in actionscript-3)???

Hi, in actionscript 3, what's the fastest way to dump your data (not from a file) into a bitmap for display? I have it working with setPixels and colored rects but that's way too slow/inefficient. Is there a way to load in the raw bytes or hijack the loader class to put in custom loader data? What would be the best/fastest--should I s...

Placement coordinates of bitmapData in AS3

i've programatically created a vector graphic (rect), repositioned the graphic, and set up an MOUSE_MOVE eventListener to trace color information of the graphic using getPixel(). however, the bitmapData is placed at 0,0 of the stage and i don't know how to move it so that it matches the graphic's location. var coloredSquare:Sprite = ne...

How to use bmpdata.draw(component); on Flex 4 SPARK components?

So I try to say bmpdata.draw(backgroundRect); to dray on my Bitmap my component but Flash Builder gives me this and I do not know what to do... 1067: Implicit coercion of a value of type spark.primitives:Rect to an unrelated type flash.display:IBitmapDrawable. Flex Problem Please help ...

Stretching BitmapData in AS3

Hi! I'm trying to replicate this function from the Allegro graphics library: void stretch_blit(BITMAP *source, BITMAP *dest, int source_x, int source_y, int source_width, int source_height, int dest_x, dest_y, dest_width, dest_height); http://www.allegro.cc/manual/api/blitting-and-sprites/stretc...

bitmap data as movie clip

Hi, I import my images with imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete); imageLoader.load(imageRequest); and then try and cast as a movieclip: var newImage:MovieClip = imageLoader.content as MovieClip; addChild(newImage); i keep getting errors, is this possible? Thanks, Ross ...

.net bitmap file type limitations

Hi, Given the line: Bitmap bitmap = new Bitmap(stream); where stream is a System.IO.Stream, are there any limitations on the image file type e.g png, jpg, gif etc that can be handled. i.e are all image file/stream header info clear enough to say "I am an image". I haven't run into any yet, but have only being using the pretty stand...

Actionscript 3: How to remove all black pixels from BitmapData ?

Hello, Let say I have a BitmapData with different pixels representing an object, and some black pixels around it that I want to remove. I would like to obtain a new BitmapData, with width and height of the object represented by non-black pixels. For example, let say I have a BitmapData 400x400px, but the object represented by non-blac...

Flex/Actionscript image display problem.

I'm trying to extend the Image class but hit a problem that I can't get past. I have a private image (img) that loads an image and a function that takes that image and copies it onto the parent. The debug function "copyit2" displays the image fine (so I know it's loaded OK). But the function "copyit" doesn't work - it just displays a wh...

How to convert bitmap data into image file in AS3?

Hi everybody , I want to convert bitmap data to an image file like jpg or png file in AS3 can anyone help me? Thanks in advance ; ...

Copying a 14bit grayscale image (saved in long[]) to a pictureBox

My camera gives me 14bit grayscale images, but the API's function returns a long* to the image data. (so i'm assuming 4 bytes for each pixel) My application is written in C++/CLI, and the pictureBox is of .NET type. I am currently using the BitmapData.LockBits() mechanism to gain pointer access to the image data, and using memcpy(bmpDat...