Created
January 30, 2012 22:51
-
-
Save Amokrane/1707321 to your computer and use it in GitHub Desktop.
Clever way to decode a bitmap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Allocate a bitmap of the desired size | |
Bitmap b = Bitmap.createBitmap(256, 256, BitmaP.Config.ARGB_8888); | |
// Set the allocated bitmap as the target | |
BitmapFactory.Options opts = new BitmapFactory.Options(); | |
opts.inBitmap = b; | |
// Decode resource in pre-allocated bitmap | |
BitmapFactory.decodeResource(resources, R.drawable.texture, opts); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment