panpf/zoomimage

Add ability to set custom BitmapFactoryDecoder for subsampling

Closed this issue · 2 comments

It might be a niche use case but I'm currently working on a on-demand encrypted image viewer. I've created a custom BitmapFactoryDecoder that handles the region subsampling and full bitmap creation from the decrypted-on-the-go (the image is received as FileDataSource, encrypted, then I decrypt it inside the decoder and handle the bytes to the region decoder) image.

The image is displayed properly in both AsyncImage and SketchZoomAsyncImage, however, it is not subsampled because it tries to use the default Android BitmapRegionDecoderDecodeHelper (SubsamplingState#createTileDecoder). It would be nice if I could set my own BitmapRegionDecoder to handle region decoding for subsampling.

Zoomimage version: 1.1.0-beta01
Sketch version: 4.0.0-alpha08

Version 1.1.0-rc01 already supports this feature, please check the documentation: https://github.com/panpf/zoomimage/blob/main/docs/wiki/subsampling.md#regiondecoder

Oh, thanks!