1

Android bitmap decodeRegion rect math

view story
linux-howto

http://stackoverflow.com – I'm trying to draw and crop a bitmap with some scaling: Bitmap bitmap = ...// read the bitmap in Bitmap bm = Bitmap.createBitmap(width, height, config); canvas = new Canvas(bm); Matrix matrix = new Matrix(); matrix.preScale(scale, scale); canvas.setMatrix(matrix); canvas.drawBitmap(bitmap, offsetX, offsetY, createPaint()); The code works perfectly but when the image gets too big I would get an OutOfMemoryError, so I decided to only decode parts of the image only since most of them just get cropped anyway. Now the problem is that I don't understand how to create a rect out of the informatio (HowTos)