I am currently drawing circle and rectangle in canvas now what I want is to remove part of the circle stroke so it would look like it is combined with the rectangle.
code:
public void setup() {
mLinePaint = new Paint();
mLinePaint.setAntiAlias(true);
mLinePaint.setStyle(Paint.Style.STROKE);
mLinePaint.setColor(ContextCompat.getColor(getContext(), R.color.white));
mCirclePaint = new Paint();
mCirclePaint.setAntiAlias(true);
mCirclePaint.setStyle(Paint.Style.FILL_AND_STROKE);
mCirclePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
mCirclePaint.setColor(ContextCompat.getColor(getContext(), R.color.white));
mLineRect = new Rect(100, 0, 200, 300);
mBackgroundColor = ContextCompat.getColor(getContext(), R.color.colorPrimaryDark);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
//the background color of the canvas
canvas.drawColor(mBackgroundColor);
//the rectangle line in the background only border
canvas.drawRect(mLineRect, mLinePaint);
canvas.drawCircle(viewWidth / 2, viewHeight / 2, LINE_HEIGTH * 2, mCirclePaint);
}
As you can see above the circle stroke is still not cut off, is there a way to cut off part of the stroke?