https://kotlinlang.org logo
Title
r

Rachid

07/10/2020, 12:03 PM
I have drawn a line with:
val line = graphics {
        stroke(
            ColorPaint(Colors.LIGHTGRAY),
            Context2d.StrokeInfo(thickness = 1.0)
        ) {
            moveTo(e1.v1.pos.x + VERTEX_RADIUS, e1.v1.pos.y + VERTEX_RADIUS)
            lineTo(e1.v2.pos.x + VERTEX_RADIUS, e1.v2.pos.y + VERTEX_RADIUS)
        }
Is it possible to change the color of this line afterwards? If not, what should I use to draw the line instead?
d

Deactivated User

07/10/2020, 12:05 PM
There is a single line?
youcan draw it white, then use tinting
if not, you should redraw it
r

Rachid

07/10/2020, 12:07 PM
I want to change the color when certain state changes. What do you mean with redraw?
d

Deactivated User

07/10/2020, 12:08 PM
here the tinting way
repainting the shape
r

Rachid

07/10/2020, 12:11 PM
Ah, thnx. I will play with this
d

Deactivated User

07/10/2020, 12:11 PM
👍
tinting is orders of magnitude faster
super cheap
repainting is costly
so take that in mind