问题
I want to rotate the numbers in canvas,
This is what I have tried:
override fun onDraw(canvas: Canvas) {
var i = 0
while (i < rulerHeightInInch) {
val markingPositionYaxis =
screenHeightInPx - (ydpinch * i + topThreshold)
paint.textSize = getPixelValueForDp(18.0f)
val path = Path()
path.reset()
path.moveTo(
(getPixelValueForDp(30f) + paint.textSize),
markingPositionYaxis +17
)
path.lineTo(
(getPixelValueForDp(30f) + paint.textSize),
markingPositionYaxis - (paint.textSize)
)
canvas.drawTextOnPath(nf.format(i / 32), path, 0f, 0f, paint)
}
i++
}
}
First image is what I have right now
Second image is what I want
I don't want to draw in circular path or by using radius I want from top to bottom in a straight line
来源:https://stackoverflow.com/questions/60396437/how-to-rotate-text-drawn-in-a-straight-line-without-radius-when-using-drawtext