0
我想要開發熱圖,現在最初我將不得不繪製強度蒙版,並且由於我使用了GWT,所以我隨機生成了一些座標並將我的圓圈(需要漸變)放置在這些位置,所以輸出成爲彼此重疊的圓圈。如果我從Dylan Vester看強度掩模,它會變得非常光滑我怎樣繪製我的熱圖?另外如何實現類似於Dylan Vester的輸出?問題還在於如果我畫圓圈,那麼如何在兩個或更多個圓的交點處確定強度,他們是如何實現的?這裏是我的代碼如何爲熱圖創建強度遮罩?
// creating the object for the heat points
Heat_Point x = new Heat_Point();
// Variables for random locations
int Min = 1,Max = 300;
int randomx,randomy;
// Generating set of random values
for(int i = 0 ; i < 100 ; i++) {
// Generating random x and y coordinates
randomx = Min + (int)(Math.random() * ((Max - Min) + 1));
randomy = Min + (int)(Math.random() * ((Max - Min) + 1));
// Drawing the heat points at generated locations
x.Draw_Heatpoint(c1, randomx, randomy);
}
,這裏是我如何策劃我的熱點是Heat_Point類
Context con1 = c1.getContext2d(); // c1 is my canvas
CanvasGradient x1;
x1 = ((Context2d) con1).createRadialGradient(x,y,10,x,y,20);
x1.addColorStop(0,"black");
x1.addColorStop(1,"white");
((Context2d) con1).beginPath();
((Context2d) con1).setFillStyle(x1);
((Context2d) con1).arc(x,y,20, 0, Math.PI * 2.0, true);
((Context2d) con1).fill();
((Context2d) con1).closePath();`
這裏我應該添加一些圖片,但我沒有足夠的聲譽: D:P