How to save current state of canvas as an image in android -


i'm developing application allows user edit image , save edited image new image on sd card want current state of canvas object. please me this.

it's hard answer without knowing more how image editor works. guess surfaceview, commonly subclassed allow arbitrary drawing.

surfaceview provides easy way render output canvas , bitmap.

bitmap bitmap = bitmap.createbitmap(msurfaceview.getwidth(), msurfaceview.getheight(), bitmap.config.argb_8888); msurfaceview.draw(new canvas(bitmap)); try {     outputstream out = new bufferedoutputstream(new fileoutputstream(saved.png));     bitmap.compress(bitmap.compressformat.png, 100, out); } catch (ioexception e) {     log.w(tag, e); } 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -