Reputation: 5476
I'm drawing a line using this code:
this.graphics.moveTo(posx, posy);
this.graphics.lineTo(2*posx,2*posy);
But now I want to remove it, but I can't clear the whole this.graphics
object because it contains more information that is useful for me.
How can I remove this line without clearing this.graphics
object? Is there any method to draw a similar line over it to hide or replace the line?
EDIT:
The purple lines are what I want to hide after I draw them:
Upvotes: 0
Views: 522
Reputation: 17347
You can try drawing the line on a different surface (another Sprite
or MoveClip
on top of the original image) - in this case you can hide/clear the top surface which removes the line without actually changing the underlying image.
You start by setting the top surface to be transparent and then you get the graphics
object that belongs to it and you draw the line on it.
If you then want to 'finalize' the line, you can just merge the two surfaces. After this, removing the line can be much harder, depending on the surrounding pixels.
Upvotes: 2
Reputation: 8402
It depends what the line is going over. If it is a uniform color, just draw a line of the surrounding color on top of it.
Upvotes: 1