android - can an image be manipulated using canvas -


is possible manipulate images using canvas? how image onto canvas?

@override  protected void ondraw(canvas canvas) {      bitmap bitmap = bitmapfactory.decoderesource(getresources(), r.drawable.icon);    bitmap mbitmap = bitmap.copy(bitmap.getconfig(), true);    canvas = new canvas(mbitmap);    matrix matrix = new matrix();     canvas.drawbitmap(mbitmap, matrix, mpaint); } 

i'm unable see image on screen. canvas.drawbitmap() shouldn't necessary since i'm using constructor , passing mbitmap.

yes can, don't "get image onto canvas," canvas interface draw onto bitmap. so, create canvas , give reference mutable bitmap:

canvas c = new canvas(mybitmap);

very easy :)


Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -