我正在尝试在 svg 路径中绘制一些文本。我需要它在形状的最大部分。并像第 1 点那样进行正常旋转。但目前我所拥有的只是第 2 点中的结果。有人可以帮助我实现第 1 点中的结果吗?
我正在使用 Canvas 绘制路径:
var bitmap = Bitmap.createBitmap(
1000,
1000,
Bitmap.Config.ARGB_8888)
var canvas = Canvas(bitmap)
canvas.drawColor(Color.LTGRAY)
var paint = Paint()
paint.color =Color.GREEN
canvas.drawPath(p, paint)
paint.color = Color.BLACK
paint.setStyle(Paint.Style.FILL)
paint.textSize = 20f
var text= "250"
canvas.drawTextOnPath(text,
p,
50f,0f,
paint)
var rectF = RectF()
pathObject.computeBounds(rectF, true)
//the rectangle to show the rect of the Path
paint.color = Color.TRANSPARENT
paint.setStyle(Paint.Style.STROKE)
paint.color = Color.RED
paint.strokeWidth =2f
canvas.drawRect(rectF,paint)
慕莱坞森
相关分类