blob: daa0a943e8fbe288d9be9dc192ab3acf8e8dc5fa [file] [log] [blame] [view]
davemorrisseyb064b0b2013-08-26 09:45:26 -07001subsampling-scale-image-view
2============================
3
David Morrissey0e895c22013-08-26 20:07:35 +01004A custom ImageView for Android with pinch to zoom and subsampled tiles to support large images. While zooming in, the
David Morrissey260aec22013-08-29 23:31:20 +01005low resolution, full size base layer is overlaid with smaller tiles in the best resolution for the current scale, and
6tiles are loaded and discarded during panning to avoid holding too much bitmap data in memory.
David Morrissey0e895c22013-08-26 20:07:35 +01007
David Morrissey260aec22013-08-29 23:31:20 +01008Ideal for use in image gallery apps where the size of the images may be large enough to require subsampling, and where
9pinch to zoom is required to view the high resolution detail.
10
11Tested with images up to 20000x13000px, but such large images are unusably slow to render.
David Morrissey0e895c22013-08-26 20:07:35 +010012
13Supports:
14* Display of images of any size
15* Pinch to zoom
16* Panning while zooming
17* One finger pan with momentum
18* Can be easily extended to add overlays
19* Tiles over 2048px are avoided to support hardware acceleration
20
21Limitations:
22* Requires SDK 10 (Gingerbread).
23* BitmapRegionDecoder does not support decoding an image from resources - the image file needs to be in assets or external storage.
24* Very wide or tall images may still cause out of memory errors because each tile has same w:h ratio as the source image. Fixing this should be fairly easy if required.
25* Does not support changing the image after one is loaded. This is another fairly simple change.
David Morrissey260aec22013-08-29 23:31:20 +010026* This view does not extend ImageView so attributes including android:tint, android:scaleType and android:src are not supported.