blob: 15f95a7c4f19e1ff39e11dd24ce1fb27fd6bb238 [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
David Morrisseyf065d6d2014-05-30 11:08:33 +010015* Loading from assets or external files
David Morrissey0e895c22013-08-26 20:07:35 +010016* Pinch to zoom
17* Panning while zooming
18* One finger pan with momentum
David Morrissey3276a502013-09-15 12:19:27 +010019* Dynamically swapping image
David Morrissey6543eaf2014-05-19 23:41:55 +010020* Dynamically rotating image (0, 90, 180, 270)
21* Optional automatic rotation of image based on EXIF
David Morrissey0e895c22013-08-26 20:07:35 +010022* Can be easily extended to add overlays
David Morrissey8c910452014-05-21 08:22:45 +010023* Compatible with OnClickListener and OnLongClickListener
David Morrisseyf065d6d2014-05-30 11:08:33 +010024* Works within a ViewPager to create a photo gallery
David Morrisseyae862192014-05-30 12:38:10 +010025* Supports restoring scale, center and orientation after rotate
David Morrisseyf065d6d2014-05-30 11:08:33 +010026* Designed for extension
27* Respects maximum bitmap size (in SDK14+ this is Canvas.getMaximumBitmapWidth/Height, for older versions 2048px)
David Morrissey0e895c22013-08-26 20:07:35 +010028
29Limitations:
30* Requires SDK 10 (Gingerbread).
31* BitmapRegionDecoder does not support decoding an image from resources - the image file needs to be in assets or external storage.
32* 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.
David Morrissey260aec22013-08-29 23:31:20 +010033* This view does not extend ImageView so attributes including android:tint, android:scaleType and android:src are not supported.
David Morrissey6543eaf2014-05-19 23:41:55 +010034* Images stored in assets cannot be rotated based on EXIF. This shouldn't be a problem as you'll know the orientation of your files.