Chr*_*pix 27 android view path stroke
我在扩展视图中有一些代码设置,它可以做一些容易缩放的绘图(类似矢量).(我的比例设置为0-1.0)
我注意到当我将绘制填充设置为FILL时,路径上绘制的文本看起来是正确的,但是当我将填充设置为笔划(我只想要文本的轮廓)时,图像看起来就像是在某个LSD行程中.这是我的示例代码:
Paint yellowPaint = Paints.getFillTextPaint(0.01f, 0xFFffea3e, 0.065f);
canvas.drawTextOnPath(mContext.getString(R.string.building_a_partnership),
Paths.getRoundedTextPath(mOuterCircleRectF, 280f, 350f),
0, -0.025f, yellowPaint);
public static Paint getFillTextPaint(float f, int color, float textSize) {
Paint textPaint = new Paint();
textPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
textPaint.setStyle(Paint.Style.FILL);
textPaint.setColor(color);
textPaint.setTextSize(textSize);
textPaint.setStrokeWidth(f);
textPaint.setShadowLayer(0.002f, 0.0f, 0.0f, 0xFF000000);
textPaint.setTypeface(Typeface.SANS_SERIF);
return textPaint;
}
Run Code Online (Sandbox Code Playgroud)
如果我将Paint.Style从FILL更改为STROKE,我会得到下面的图像.我使用了canvas.drawText(),它可以很好地显示描边字母.只有当它应用于Path时才会变得奇怪.


| 归档时间: |
|
| 查看次数: |
3087 次 |
| 最近记录: |