tags:

views:

48

answers:

0

Some background. I currently have a class that is instantiated multiple times and inside the class resides a Bitmap member variable that is set using BitmapFactory.decodeResource on instantiation. At any time I may need to apply a matrix to the bitmap and it's currently done via:

public void applyMatrix(Matrix matrix) {
    mBitmap = Bitmap.createBitmap(mBitmap, 0, 0, mBitmap.getWidth(), mBitmap.getHeight(), matrix, true);
}

I am making the assumption that every time I instantiate this class it must load the Bitmap into memory (again). Is that in fact the case? I was also considering pre-loading all bitmaps into an array and referencing the index instead, but I would still run into a problem when I need to transform the Bitmap - I would have to create a new Bitmap from the one in memory. Is there a better way to do this?