我在扩展视图中设置了一些代码,可以进行一些易于缩放的绘图(类似矢量)。 (我的比例设置为0-1.0)
我注意到当我将我的填充颜色设置为FILL时,路径上绘制的文本看起来正确,但是当我将填充颜色设置为stroke(只想要文本的轮廓)时,图像看起来就像处于LSD旅程中。 这是我的示例代码:
如果我将Paint.Style从FILL更改为STROKE,我会得到下面的图像。我已经使用了canvas.drawText(),它可以正常工作并显示描边字母。只有当它应用于路径时,它似乎变得很奇怪。
我注意到当我将我的填充颜色设置为FILL时,路径上绘制的文本看起来正确,但是当我将填充颜色设置为stroke(只想要文本的轮廓)时,图像看起来就像处于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;
}
如果我将Paint.Style从FILL更改为STROKE,我会得到下面的图像。我已经使用了canvas.drawText(),它可以正常工作并显示描边字母。只有当它应用于路径时,它似乎变得很奇怪。
drawTextOnPath
可能不是受支持的画布操作。请参阅 http://android-developers.blogspot.com/2011/03/android-30-hardware-acceleration.html。 - Roman Nurik