Android rotates a bitmap without copying

Is there a way to rotate a bitmap without copying it? Or maybe an image containing a bitmap? Right now I have something similar to:

Bitmap bm = BitmapFactory.decodeFile(... // get the orientation Matrix m = new Matrix m.postRotate(orientation) Bitmap new = Bitmap.createFromBitmap(bm, ..., m); 
+4
source share
1 answer

There really is algorithmically not an EASY way to perform this rotation without a completely new place to place the rotated copy, and then delete the current (non-rotating) copy. I can think of a potential algorithm in which you essentially have to have one pixel memory, but I would have to spend more time figuring out the actual algorithm.

Also look at this StackOverflow link: Algorithm to rotate an image 90 degrees? (No extra memory)

+1
source

Source: https://habr.com/ru/post/1415986/


All Articles