views:

126

answers:

3

Hi,

In my application a canvas object have height=90 px & width =86400 px (indicating 24 hrs 1sex/pixel). The canvas is scrollable and User can add delete components in that.

Now, i want to have snapshot of whole canvas & shrink it to size 910x30 to draw taken snapshot in another canvas.

Can anybody tell me how to take snapshot of such large Component ??

I have tried to take snapshot in BitmapData object but as it max width is 2880 can not give whole canvas snapshot.

Is there any other Idea possible, if yes plz let me know.

Suggestions are welcome.

A: 

You could take multiple snapshots of your large Canvas, scale down and then stitch them back together. But any kind of bitmap capture for a component that large is going to be very intensive.

cliff.meyers
A: 

You may also be able to try to set the scaleX/scaleY property on the canvas so that it fits to your 910x30 size and then doing the snapshot. That way Flash would scale for you.

Ben Johnson
+1  A: 

I haven't tested this out, but what if you dismissed the BitmapData all together and just took the result straight from the client computer? like this:

var imgSnapshot:ImageSnapshot = ImageSnapshot.captureImage(savableCanvas,72,new PNGEncoder(),false);
   var bArray:ByteArray = imgSnapshot.data;

   var fileRef:FileReference = new FileReference();
   fileRef.save(bArray,"mySavedImage.png");

Also, are there typos on your question, 86,400 pixels is a hell of a lot of data to be dealing with and you should probably be handling this with some server-side code and tiling techniques (think, Google Maps)... this way if you were say using php, you could use imagick and crop the needed dynamically-created-section. Now if it were 8,640px, then that's another story, look into BitmapDataUnlimited on Google Code. And don't worry, it's commercial friendly. However, it does come at a price, that large of a canvas needs to be managed quite well, and discarded immediately after it's use is threw considering that a 12k x 12k bitmapData object is said to be at least 1GB of memory...

Adrian