In my recent adventure about using GWT canvas to draw some images at work lead me to one discovery. Lets assume that we are trying to draw a polygon, so we will use following code
canvas = new GWTCanvas(500,500);
canvas.setFillStyle(color);
canvas.beginPath();
canvas.moveTo(100, 500);
canvas.lineTo(150, 400);
canvas.moveTo(150, 400);
canvas.lineTo(450, 400);
canvas.moveTo(450, 400);
canvas.lineTo(500, 500);
canvas.moveTo(500, 500);
canvas.lineTo(100, 500);
canvas.closePath();
canvas.stroke();
canvas.fill();
This will draw the polygon but will not fill it with the Color that we have set as fill style. If one comments out the lines corresponding to moveTo() method, the fill() method works and fills the polygon with the color that we have specified.
Wanted to share.
Cheers!!
Tuesday, June 8, 2010
Subscribe to:
Posts (Atom)