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);
您應該顯示執行繪圖的代碼。 –