MainCanvas Structure and Interaction

The MainCanvas class contains viewingSurface, which masks currentImage. MainCanvas adds the current image as a child of viewingSurface. viewingSurface is a UIComponent which creates a mask sprite dynamically. This viewingSurface is what makes it possible to hide the contents of the image that would other wise spill out of the main canvas onto other parts of the screen. To add currentImage to viewingSurface, mainCanvas uses the inherited method UIComponent.addChild of the viewingSurface class. mainCanvas maintains a reference to currentImage and applies filter directly too current image. When getBitmap is invoked mainCanvas
Note: The way that the image data is retrieved by getBitmap is a bit tricky. The filters must stay on the image for the user’s changes to reach the saved file. For this reason it is necessary to create a new bitmap with the bitmapData of currentImage. Next this bitmap is added as a child to a new Sprite. We then reapply the filters to the new Bitmap. Now we have a sprite containing our filtered Bitmap. We must copy the BitmapData of a container containing our filtered bitmap. If we copy the BitmapData of the currentImage.

0 Comments:
Post a Comment
<< Home