davemorrissey | b064b0b | 2013-08-26 09:45:26 -0700 | [diff] [blame] | 1 | subsampling-scale-image-view |
| 2 | ============================ |
| 3 | |
David Morrissey | 0e895c2 | 2013-08-26 20:07:35 +0100 | [diff] [blame] | 4 | A custom ImageView for Android with pinch to zoom and subsampled tiles to support large images. While zooming in, the |
| 5 | low resolution base layer is overlaid with tiles in the best resolution for the current scale, and tiles are loaded and |
| 6 | discarded during panning to avoid loading too much image data. |
| 7 | |
| 8 | Unfortunately it's difficult to know how much image data it's safe to load but the view appears stable on tested devices. |
| 9 | |
| 10 | Supports: |
| 11 | * Display of images of any size |
| 12 | * Pinch to zoom |
| 13 | * Panning while zooming |
| 14 | * One finger pan with momentum |
| 15 | * Can be easily extended to add overlays |
| 16 | * Tiles over 2048px are avoided to support hardware acceleration |
| 17 | |
| 18 | Limitations: |
| 19 | * Requires SDK 10 (Gingerbread). |
| 20 | * BitmapRegionDecoder does not support decoding an image from resources - the image file needs to be in assets or external storage. |
| 21 | * 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. |
| 22 | * Does not support changing the image after one is loaded. This is another fairly simple change. |