As we saw in a previous entry, “Taking screenshots in Flex 3 using the ImageSnapshot.captureImage() method”, it is possible to take a screenshot of an item on the display list using the static ImageCapture.captureImage() method. Once the image is captured, we accessed the image’s pixel data using the ImageCapture object’s data property, which was displayed using the SWFLoader control.
The ability to load a ByteArray object directly into a SWFLoader was added in Flex 3 build 187814, you may need to update your SDK build by downloading a recent nightly build from http://labs.adobe.com/technologies/flex/sdk/flex3sdk.html.
The following example shows how you can take a snapshot of an item on the display list using the static ImageSnapshot.captureBitmapData() method, which returns a BitmapData object, as seen in the following snippet:
var imageBitmapData:BitmapData = ImageSnapshot.captureBitmapData(source);
swfLoader.source = new Bitmap(imageBitmapData);
Full code after the jump.
Continue reading ‘Taking screenshots in Flex 3 using the ImageSnapshot.captureBitmapData() method’
The following example shows how you can compare the bitmap data of two embedded images using the BitmapData class’s compare() method.
Full code after the jump.
Continue reading ‘Comparing two bitmap images using the BitmapData class’
This is semi-related to the previous post, but this is something I’ve wanted to do for a while now. In fact, I first started thinking about it when I did the Image color picker sample. Basically, how can you take a bitmap image of something on the Stage and then create an item renderer out of it. The answer turned out to be fairly easy (much to my surprise).
In this mini-application we look at how to take a snapshot of the video at each cue point. We then take that bitmap, and bind it to a TileList control’s data provider so our TileList shows handy video cue points, along with an HTML-formatted label of the cue point name/time/type.
Full code after the jump.
Continue reading ‘Creating FLV cuepoint thumbnails using the Bitmap and BitmapData classes’
In a previous post (Finding a pixel’s color value using the Bitmap classes and getPixel()) we looked at copying an image so we could build a simple color-picker like app. In this post, we explore duplicating a loaded image and copying it into a TileList control. Each time you press the “Copy image” button, a new instance of the source image is created and added to the TileList control’s data provider.
As an added bonus, we also create a custom item renderer consisting of an HBox container, Image control, and a Label control.
Full code after the jump.
Continue reading ‘Duplicating images using the Bitmap and BitmapData classes’
This example loads an image and then uses a combination of the Bitmap and BitmapData classes to determine the color value under the mouse cursor. Pretty basic, but kind of neat. Maybe? Sorta?
Full code after the jump.
Continue reading ‘Finding a pixel’s color value using the Bitmap classes and getPixel()’