1
我試圖在畫布上繪製一個笑臉。 根據0-100之間的整數,嘴巴需要看起來很開心或不開心。下面的代碼繪製的笑臉:如何在畫布上繪製半橢圓形
paint.setStyle(Paint.Style.FILL);
paint.setColor(getColorByIntesity(intesity));
canvas.drawCircle(23, 23, 20, paint);
paint.setColor(Color.BLACK);
canvas.drawCircle(15, 15, 3, paint); //Left eye
canvas.drawCircle(31, 15, 3, paint); //Right eye
paint.setStyle(Paint.Style.STROKE);
canvas.drawCircle(23, 23, 20, paint);
if(intesity >= 55)
canvas.drawArc(getMouthDrawingByIntesity(intesity), 180, 180, false, paint); //Mouth
else if(intesity < 55)
canvas.drawArc(getMouthDrawingByIntesity(intesity), 0, 180, false, paint); //Mouth
我的方法繪製的嘴確實是這樣ATM:
final RectF oval = new RectF();
if(intesity < 5){
oval.set(11, 12, 35, 35);
} etc..
但嘴看起來非常像素化。有沒有人知道繪製曲線(橢圓的一半)的更好方法?
日Thnx了很多,它看起來好多了,現在:) – Luciano