image processing - Programmatically take screen shot of part of the screen on Android -


i'm doing app where, @ 1 point, user able make composition multiple imageviews (which can dragged , rotated) , save resulting combined image.

at first thought take screenshot of screen, able following code:

private void takescreenshot() {     date = new date();     android.text.format.dateformat.format("yyyy-mm-dd_hh:mm:ss", now);      try {         string mpath = environment.getexternalstoragedirectory().tostring() + "/" + + ".jpg";          view v1 = getwindow().getdecorview().getrootview();         v1.setdrawingcacheenabled(true);         bitmap bitmap = bitmap.createbitmap(v1.getdrawingcache());         v1.setdrawingcacheenabled(false);          file imagefile = new file(mpath);          fileoutputstream outputstream = new fileoutputstream(imagefile);         int quality = 100;         bitmap.compress(bitmap.compressformat.jpeg, quality, outputstream);         outputstream.flush();         outputstream.close();      } catch (throwable e) {         e.printstacktrace();     } } 

however, output literally on screen, not includes areas should left out, includes status bar.

here's visual representation of need:

needed area

i need take screen shot (or otherwise combine imageviews in single image file) of yellow part, throwing that's on black parts out, cutting images if needed be.

the imageviews added relativelayout has same size of screen, user needs able place parts of imageviews outside cutting zone.

the yellow part being merely background color , black parts black overlays show user part of image left out.

is there way it?


Comments