开发者

ellipse vs circle



        Canvas canvas = Canvas.createIfSupported();开发者_开发技巧

        canvas.setWidth("200px");
        canvas.setHeight("200px");

        RootPanel.get().add(canvas);

        Context2d context = canvas.getContext2d();
        context.setStrokeStyle("black");

        context.arc(50, 50, 20, 0, Math.PI*2);

        context.stroke();

Why I have ellipse instead of circle here?


You'll also have to set the coordinate space, to make it match the aspect ratio of your canvas. So you can add the following lines:

canvas.setCoordinateSpaceWidth(200);
canvas.setCoordinateSpaceHeight(200);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜