Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/391.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在画布上缩放后在路径上消除锯齿_Java_Android_Android Canvas - Fatal编程技术网

Java 在画布上缩放后在路径上消除锯齿

Java 在画布上缩放后在路径上消除锯齿,java,android,android-canvas,Java,Android,Android Canvas,我有一个在屏幕上绘制一些形状的应用程序。问题是,抗锯齿在我使用路径绘制的形状上不起作用,而只是在缩放(缩放)后才起作用。 另一方面,绘制圆没有问题(即使在缩放之后)。缩放效果很好,只是之后的形状不明显 ... // Matrix m = new Matrix(); // m.setValues(createMatrix()); // canvas.concat(m); //or canvas.scale(6.0f, 6.0f); // the upper code is used on real

我有一个在屏幕上绘制一些形状的应用程序。问题是,抗锯齿在我使用路径绘制的形状上不起作用,而只是在缩放(缩放)后才起作用。 另一方面,绘制圆没有问题(即使在缩放之后)。缩放效果很好,只是之后的形状不明显

...
// Matrix m = new Matrix();
// m.setValues(createMatrix());
// canvas.concat(m);
//or
canvas.scale(6.0f, 6.0f); // the upper code is used on real, but the same problem occures with this call
...
RectF oval = new RectF(x, y, x + width, y + height);
currentPaint.setAntiAlias( true );
canvas.drawOval(oval, currentPaint);

currentPaint.setAntiAlias( true );
canvas.drawPath(getPathOfShape(), currentPaint);

有人能帮我吗?

我找到了问题的原因。问题是,如果启用了硬件加速,android就不支持这种功能。禁用硬件加速后,缩放工作正常

view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
有关详细信息,请参阅谷歌网站: