以下问题可能听起来有点愚蠢,但我猜愚蠢没有限制,所以在这里。我在Android中使用Canvas绘制心脏,并没有绘制心脏的问题,但我无法在会议中使心脏变得锐利。我的心脏看起来像在Android中用尖角绘制一颗心
CODE:
left_x_moveto = 200;
left_y_moveto = 45;
left_x1 = 197;
left_y1 = -35;
left_x2 = 60;
left_y2 = 20;
left_x3 = 193;
left_y3 = 130;
right_x_moveto = 200;
right_y_moveto = 45;
right_x1 = 197;
right_y1 = -35;
right_x2 = 345;
right_y2 = 20;
right_x3 = 193;
right_y3 = 130;
heart_outline_paint.setColor(getResources().getColor(R.color.heart_outline_color)); // Change the boundary color
heart_outline_paint.setStrokeWidth(15);
heart_outline_paint.setStyle(Paint.Style.STROKE);
path.moveTo(left_x_moveto, left_y_moveto);
path.cubicTo(left_x1, left_y1, left_x2, left_y2, left_x3, left_y3);
path.moveTo(right_x_moveto, right_y_moveto);
path.cubicTo(right_x1, right_y1, right_x2, right_y2, right_x3, right_y3);
canvas.drawPath(path, heart_outline_paint);
有什么我试过到目前为止:
- 减少或增加的
left_x_moveto
,left_y_moveto
点,反之亦然,但心脏是完全毁容的,我无法找到原因。
当right_x_moveto = 198
和right_y_moveto = 45
,心脏看起来像
我不知道为什么会这样。
- 减小
heart_outline_paint
的宽度会给我我想要什么,但我想厚度的心脏的如此降低setStrokeWidth
同样不是一个选项。
总之,我想无论是曲线MEET和合并并不仅仅是MEET。 任何帮助将不胜感激。提前致谢。
你有没有尝试使用[Path.close()](http://developer.android.com/intl/es/reference /android/graphics/Path.html#close())? –
不,我在哪里关闭它?在drawPath之后? – San
是的,我会尽力。 –