0
在我的应用程序中,我绘制了一条波浪线来说明滑音。绘制一条波浪线可以修剪
这是我如何创建线。
- 创建一个波浪“戳”路径
- 创建PathDashPathEffect对象,传递“邮票”路径
- 为
- 设置绘图方式到行(的moveTo和LineTo等)创建路径中风
- 设置波浪风格Paint.setPathEffect
- 划清界线路径
由于Paint.setStrokeWidth对PathDashPathEffect对象不起作用,因此我无法使用它来更正此问题。
有谁知道为什么我的波浪线的开始越来越像这样剪辑?
更重要的是,如何解决这个问题?
继铝的各种要求,这里是绘图代码:
//----------------------------------------------------------
// creation of the wave stamp
m_StampPath = new Path();
m_StampPath.moveTo(0.0f, 6.86f * fScaling);
m_StampPath.cubicTo(10.29f * fScaling, -1.68f * fScaling,
10.99f * fScaling, -1.40f * fScaling,
17.29f * fScaling, 2.66f * fScaling);
m_StampPath.cubicTo(21.91f * fScaling, 6.86f * fScaling,
24.08f * fScaling, 6.72f * fScaling,
28.56f * fScaling, 2.66f * fScaling);
m_StampPath.lineTo(28.56f * fScaling, 4.76f * fScaling);
m_StampPath.cubicTo(17.78f * fScaling, 13.44f * fScaling,
17.08f * fScaling, 12.25f * fScaling,
11.90f * fScaling, 8.33f * fScaling);
m_StampPath.cubicTo(6.37f * fScaling, 4.41f * fScaling,
4.62f * fScaling, 4.76f * fScaling,
0.0f, 8.96f * fScaling);
m_StampPath.lineTo(0.0f, 6.86f * fScaling);
fStampOffset = 23.5f * fScaling;
m_fTextOffset = -8.96f * fScaling;
m_WavyLine = new PathDashPathEffect(m_StampPath, fStampOffset, 0.0f, PathDashPathEffect.Style.MORPH);
//--------------------------------------------------------
// drawing the line
m_GlissandoPath = new Path();
m_GlissandoPath.moveTo(m_ptStart.x, m_ptStart.y);
m_GlissandoPath.lineTo(m_ptEnd.x, m_ptEnd.y);
oldStyle = pt.getStyle();
pt.setStyle(Paint.Style.STROKE);
cv.drawPath(m_GlissandoPath, pt);
// remove the path effect
pt.setPathEffect(null);
您应该显示执行绘图的代码。 –