AndEngine
AndEngine copied to clipboard
Load sampled down bitmaps
This patch is based on the Android developer training Loading Large Bitmaps Efficiently
It enables to use the method AssetBitmapTextureAtlasSource.createSampled to create a scaled down version of a bitmap into memory, for example to display a thumbnail of a big image: e.g.: an image of 2048x1536 (12Mb in memory) can be sampled down to 512x384 (0.75Mb in memory).
It sets the inSampleSize of BitmapFactory.Options object of the BitmapFactory.decodeResource method.
This sample value can only be integer and power of two are faster and more efficient for the decoder.