一些嘗試後,我通過編輯gwt-g2d源找到了解決方案。
gwt-g2d爲每個Surface創建一個帶有畫布的div。 現在我將Surface更改爲僅創建一個位置爲絕對的畫布。現在我只是創建多個畫布並使用其功能IsPointInPath。
Chnages在Surface.java:
public Surface(int width, int height) {
canvas = Document.get().createElement("canvas").cast();
setElement(Document.get().createDivElement());
getElement().appendChild(canvas);
canvasInitializer.init(canvas, width, height);
setStylePrimaryName("g2d-Surface");
this.width = width;
this.height = height;
context = canvas.getContext2D();
}
TO:
public Surface(int width, int height) {
canvas = Document.get().createElement("canvas").cast();
canvas.setAttribute("style", "position:absolute;");
setElement(canvas);
canvasInitializer.init(canvas, width, height);
setStylePrimaryName("g2d-Surface");
this.width = width;
this.height = height;
context = canvas.getContext2D();
}
謝謝你的提示,但我搜索一個內置的功能,因爲如果我通過G2D添加一個圓弧它有可能會有其他點比我的claculatet弧。 – Wowa 2011-06-06 16:15:08