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
I don't want to draw in circular path or by using radius I want from top to bottom in a straight line
This is how i did it:
canvas.save()
canvas.rotate(180f,(getPixelValueForDp(30f) + paint.textSize),markingPositionYaxis)
canvas.drawTextOnPath(nf.format(i / 32), path, 0f, 0f, paint)
canvas.restore()