Quantcast
Channel: Clker.com - weblog » development
Viewing all articles
Browse latest Browse all 10

Flex – Zooming in on large bitmaps, with large zooms

$
0
0

If you didn’t know, Flex and actionscript flash imposes a limit on the bitmap size. For some reason, the max width or height cannot exceed 2048 pixels.

When applying a transformation matrix to a bitmap, it seems that Flex generates a temporary bitmap in memory, even for the area that are not going to be displayed. Since there is a limit on the bitmap size, usually it won’t resize or zoom more than a certain amount.

This problem will show if you have a graphical application that views a bitmap, which has a zoom-in feature. The solution that I found to this problem is: after calculating the transformation matrix (scaling from zoom, translation from the scroll bars), calculate the inverse of the matrix. Using your viewport co-ordinates (usually will be 0,0 and width,height) determine the area in the bitmap that will appear if the bitmap was zoomed. Copy that area to a temporary bitmap, Calculate a new transformation matrix composed only of the zoom, and apply it to the temporary image. That’s it!


Viewing all articles
Browse latest Browse all 10

Trending Articles