我通过使用重新缩放画布更大的矩形(100×100)的辅助功能进行管理,绘制圆和规模在画布到原来的大小。
public static void drawOval(Canvas canvas, RectF rectangle, Paint paint, float scale) {
float originalStrokeWidth = paint.getStrokeWidth();
float upScaling = 100f;
paint.setStrokeWidth(originalStrokeWidth * upScaling);
canvas.save();
RectF newRect = new RectF();
newRect.left = rectangle.left*upScaling;
newRect.top = rectangle.top*upScaling;
newRect.right = rectangle.right*upScaling;
newRect.bottom = rectangle.bottom*upScaling;
canvas.scale(scale/upScaling, scale/upScaling);
canvas.drawOval(newRect, paint);
canvas.restore();
paint.setStrokeWidth(originalStrokeWidth);
}
public static void drawOval(Canvas canvas, RectF rectangle, Paint paint) {
drawOval(canvas, rectangle, paint, 1f);
}
所以,在这里我不得不canvas.drawOval(RECT,油漆)我 CanvasUtils.drawOval(帆布,矩形,油漆)取代它;
我已经注意到,“错误”当我使用位图作为画布绘制图作为计的背景下才会发生。