crop - need example of cropping an image in android app -


sorry not technical question.

i researching understand how can implement common feature in android apps user can crop part of image. performed using square window hovering above shadowed image. example choosing profile image in linkedin app. know or have example of how it?

thanks in advance.

try sample method below. not can cut rectangle any shape place in bitmap want.

you can cut micky mouse center of bitmap also.

the below method cutting rectangular bitmap have pointed triangle on left side of bitmap. whatsapp thumbnails of images shared in chat.

anything drawn paint setxfermode(new poterduffxfermode(mode.clear)) clear pixels bitmap.

try out.. hope helps :)

private bitmap cropandgivepointedshape(bitmap originalbitmap)     {         bitmap bmoverlay = bitmap.createbitmap(originalbitmap.getwidth(),                                                originalbitmap.getheight(),                                                bitmap.config.argb_8888);          paint p = new paint();         p.setxfermode(new porterduffxfermode(mode.clear));                       canvas canvas = new canvas(bmoverlay);          canvas.drawbitmap(originalbitmap, 0, 0, null);          canvas.drawrect(0, 0, 20, 20, p);          point = new point(0, 20);         point b = new point(20, 20);         point c = new point(0, 40);          path path = new path();         path.setfilltype(filltype.even_odd);         path.lineto(b.x, b.y);         path.lineto(c.x, c.y);         path.lineto(a.x, a.y);         path.close();          canvas.drawpath(path, p);          = new point(0, 40);         b = new point(0, 60);         c = new point(20, 60);          path = new path();         path.setfilltype(filltype.even_odd);         path.lineto(b.x, b.y);         path.lineto(c.x, c.y);         path.lineto(a.x, a.y);         path.close();          canvas.drawpath(path, p);          canvas.drawrect(0, 60, 20, originalbitmap.getheight(), p);          return bmoverlay;     } 

Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -