android - How to rotate pixels of bitmap -


i want rotate bitmap 90 degrees in android. , don't want new instance. there way resolve this? have idea: rotate pixels of bitmap. can't it.

temp = bitmap.createbitmap(temp, 0, 0, w, h, matrix, false);

this works:

http://warting.github.com/androidbitmaprotate/

public class rotatebitmapactivity extends activity {      imageview iv;     private bitmap bitmap;      @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.main);          bitmap = bitmapfactory.decoderesource(getresources(), r.drawable.ic_launcher);         iv = (imageview) findviewbyid(r.id.imageview01);          findviewbyid(r.id.left).setonclicklistener(new onclicklistener() {             @override             public void onclick(view v) {                 rotate(-90f);             }         });          findviewbyid(r.id.right).setonclicklistener(new onclicklistener() {             @override             public void onclick(view v) {                 rotate(90f);             }         });     }      private void rotate(float degrees) {          matrix rotatematrix = new matrix();         rotatematrix.postrotate(degrees);          bitmap = bitmap.createbitmap(bitmap, 0, 0, bitmap.getwidth(), bitmap.getheight(), rotatematrix, true);         iv.setimagebitmap(bitmap);     } } 

Comments

Popular posts from this blog

How do you change vbulletin's home page to the forums instead of the default (CMS or Activity Stream)? -

c++ - Troubles when compiling phash program -