是否可以丢弃碎片或至少使其更顺畅?
我从running cursor读取像素颜色,并且可以看到低速碎片。
这是我的代码:
final int[] mColors = new int[] {
0xFFFF0000, 0xFFFF7F00, 0xFFFFFF00, 0xFF7FFF00, 0xFF00FF00, 0xFF00FF7F,
0xFF00FFFF, 0xFF007FFF, 0xFF0000FF, 0xFF7F00FF, 0xFFFF00FF, 0xFFFF007F,
0xFFFF0000
};
...
Shader shad = new SweepGradient(centerX, centerY, mColors, null);
...
Paint colorWheel = new Paint();
colorWheel.setAntiAlias(true);
colorWheel.setShader(shad);
colorWheel.setStyle(Paint.Style.STROKE);
colorWheel.setStrokeWidth(radius/10);
colorWheel.setDither(true);
...
Bitmap colorWheelBitmap = Bitmap.createBitmap(xNew, yNew, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(colorWheelBitmap);
canvas.drawCircle(centerX, centerY, radius, colorWheel);
...
@Override
protected void onDraw(Canvas canvas) {
canvas.drawBitmap(colorWheelBitmap, 0, 0, null);
...
}