addArc()使用路径默认边距/填充

时间:2016-06-18 10:02:49

标签: java android graphics android-studio-2.1

我使用addArc()创建了半圆,但弧与弧之间存在奇怪的差距。矩形如下图所示。如何去除弧周围的空隙。

Here is my output image link

    int saveCount = canvas.saveLayer(0, 0, getWidth(), getHeight(), null, Canvas.ALL_SAVE_FLAG);
super.dispatchDraw(canvas);

paint.setXfermode(pdMode);
paint.setStrokeWidth(0);
path.reset();
path.setFillType(Path.FillType.INVERSE_WINDING);
//path.moveTo(0, getHeight() - 100);
int h = (getMeasuredHeight() / 2) - (getMeasuredHeight() /2) - 100;
path.addArc(new RectF(50, h, getMeasuredWidth()-50, getMeasuredHeight()-50), 0, 180);
path.close();


canvas.drawPath(path, paint);

canvas.restoreToCount(saveCount);
paint.setXfermode(null);

0 个答案:

没有答案