Vivek Sharma
01/04/2021, 6:17 AMdrawLine(
brush = SolidColor(Color.Red),
cap = StrokeCap.Round,
strokeWidth = 8.dp.toPx(),
start = middle,
end = Offset(midX, 16.dp.toPx())
)
Can anyone help me with this, when we draw a line using the above code, end
mean we ending that line at some position,
But with Offset(X,Y)
Y having 16.dp.toPx()
what does this mean?
I am increasing Y offset like 100.dp.toPx()
, line is becoming short in length Why?Val Salamakha
01/04/2021, 10:47 AM100.dp.toPx()
, line is becoming short in length Why?” The coordinate system of the Android canvas starts in the top left corner, where [0,0] represents that point. Your line joins two points between coordinates start(x,y) and end(x,y). So increasing Y you are reducing the line length as the start coordinates in the center of the Canvas.Vivek Sharma
01/04/2021, 1:58 PMVivek Sharma
01/04/2021, 2:18 PM