我在位图上绘制了一个矩形,它的边框被抗锯齿或有一些效果,如您所见: 原始图像:
如何关闭该效果以获得如下实线:
我使用这段代码:
Bitmap mBuffer = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
gfx = new Canvas(mBuffer);
Paint paintNorm = new Paint();
paintNorm.setAntiAlias(false);
paintNorm.setStrokeWidth(1);
paintNorm.setStyle(Paint.Style.STROKE);
paintNorm.clearShadowLayer();
paintNorm.setDither(false);
paintNorm.setFilterBitmap(false);
paintNorm.setColor(0xFFA8A8A8);
gfx.drawRect(2,3,50,50, paintNorm);