Saturday 15 March 2014

android - Freehand Image Crop draw inside bitmap region -


An attempt is being made to capture the freehand crop of an image, so I am capable of dragging on the image. But this bitmap goes out of the area, I can only attract that user only in the bitmap area, check the screen shot below.

I am trying to implement this kind of functionality.

Drawing outside the drawing area, which produces incorrect output. Input

Output  Output

Code @

onDraw

  Public Waste On Draw (Canvas Canvas) {Final Rink Rect = New Racket (0, 0, Bitmap .getWidth (), Bitmap.GateHight ()); Canvas.draw bitmap (bitmap, rect, text, empty); // rectifr t = new rhetfth (); // matrix matrix = new matrix (); // matrix.mapRect (r); // Log.i (Tag, "Ricquet" + R. Left + "" + R.op + "" + R. Right + "" + // R. Bottom + ""); // canvas.clipart (R. left, R.op., R. Wright, R. Bottom); Path path = new path (); Boolean first = true; For (int i = 0; i & lt; points.size (); i + = 2) {point point = numeral.gate (i); If (first) {first = false; Path.moveTo (point.x, point.y); } And if (i & lt; points.size () - 1) {point next = points.get (i + 1); Path.quadTo (point.x, point.y, next.x, next.y); } And {mastpoint = points.get (I); Path.lineTo (point.x, point.y); }} Canvas skeleton (path, paint); }   

onCrop

  Bitmap result image = bitmap .createbitmap (widthofscreen, heightoffscreen, bitmap1.getconfig ()) ; Canvas canvas = new canvas (resulting image); Paint paint = new paint (); Paint.setAntiAlias ​​(right); Path path = new path (); (Int i = 0; i & lt; some View.points.size (); i ++) {path.lineTo (Some View.points.get (i) .x, SomeView.points.get (i) .y ); } // path.lineTo (150, 0); // path.lineTo (230, 120); // path.lineTo (70, 120); // path.lineTo (150, 0); Canvas skeleton (path, paint); If (crop) {paint.setXfermode (new portfidixformode (mod. Rcnin)); } Else {paint.setXfermode (new PortfidxFormode (mod.RC_UUT)); }   

Please suggest me to achieve my goal.

One way to achieve your goal ..

Below Follow the steps taken:

1) Make an image, like the inside of the crop image should be transparent and out

3) Anyone on your canvas Attract the thing and make the picture above the picture. Canvas

Image:

enter image Details here

No comments:

Post a Comment