Since the canvas drawing in GWT was all over the map, let me be explicit and say that I use this:
import com.google.gwt.canvas.client.Canvas;
The problem is that if I draw a black line and then change it to red, the first line will also be changed to red.
// draw line in black context.moveTo(xScale(-0.5), yScale(0.0)); context.lineTo(xScale(15.0), yScale(0.0)); context.stroke(); // change to red context.setStrokeStyle(CssColor.make(255,0,0)); context.moveTo(xScale(0.0), yScale(20.0)); context.lineTo(xScale(0.0), yScale(-20.0)); context.stroke(); // both lines appear in red
What is the correct method for changing the color of a pen?
source share