Edges of image curves on canvas get distorted on android -


as shown in image, when create image out of curvy path(using porterduffxfermode) looks distorted. black outline drawn same path image peaks out of edges creating distorted look. have listed code below (android:hardwareaccelerated="true" has been set well). how can remove distortion , align image behind black outline.

enter image description here

********************* create image ****************************** // translatedfigure curvy figure // sourcepicture image drawn curvy figure  canvas gfx = new canvas(image); gfx.drawpath(translatedfigure, fillstrokepaint);  // use new porterduffxfermode(android.graphics.porterduff.mode.src_in)  gfx.drawbitmap(sourcepicture, 100, 100, porterduffpaint);  gfx.drawbitmap(image, 0, 0,embosspaint); // emboss  gfx.drawpath(translatedfigure, outlinepen); // draw black outline  ****************************draw image on canvas****************************     canvaspaint.setflags(paint.filter_bitmap_flag | paint.anti_alias_flag);      canvas.scale(mscalefactor, mscalefactor);     canvas.translate(mposx, mposy);      super.ondraw(canvas);     canvas.drawbitmap(bigimagesizeofscreen, mposx, mposy, canvaspaint);     canvas.restore();  ********************************************************   public void createpaint() {         // outline         outlinepen = new paint(color.black);         outlinepen.setflags(paint.anti_alias_flag | paint.dither_flag);         outlinepen.setstyle(paint.style.stroke);         outlinepen.setantialias(true);         outlinepen.setdither(true);         outlinepen.setstrokejoin(paint.join.round);         outlinepen.setstrokecap(paint.cap.round);         outlinepen.setstrokewidth(1);           fillstrokepaint = new paint(color.white);         fillstrokepaint.setflags(paint.anti_alias_flag | paint.dither_flag);         fillstrokepaint.setantialias(true);         fillstrokepaint.setdither(true);         fillstrokepaint.setstrokejoin(paint.join.round);         fillstrokepaint.setstrokecap(paint.cap.round);         fillstrokepaint.setstyle(paint.style.fill);          porterduffpaint = new paint();         porterduffpaint.setxfermode(new porterduffxfermode(                 android.graphics.porterduff.mode.src_in));           embosspaint = new paint(color.red);         embosspaint.setflags(paint.filter_bitmap_flag | paint.anti_alias_flag                 | paint.dither_flag);         embosspaint.setstyle(paint.style.fill_and_stroke);         embosspaint.setstrokejoin(paint.join.round);         embosspaint.setstrokecap(paint.cap.round);          embossmaskfilter memboss = new embossmaskfilter(                 new float[]{1, 1, 1}, 0.4f, 6, 3.5f);         embosspaint.setmaskfilter(memboss);     } 


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -