2017-06-17 51 views
2

我試圖繪製一個弧形(圈的一部分),填充半透明的顏色。那可能嗎?
我發現Imagearc,但只繪製線條,並有imagefilledarc繪製3d形弧。
有eclipse繪製完整的圓圈。填充imagearc

沒有那些做我需要的。我可以用從中獲取圖像:
enter image description here

爲:(請儘量找超出了我的油漆技能)

enter image description here

我有主風向是150度的角,而風向變化120-190度,但我如何繪製半透明填充弧?
編輯;我也有中心點和線的直徑。

回答

1

實際上imagefilledarc()正確的功能。它不繪製3D形狀 - 這只是PHP手冊中給出的示例。

使用此代碼使用你的第一個圖像...

imagefilledarc(
    $im, // gd image resource 
    512, // centre point x 
    325, // centre point y 
    285, // width (keep same as height for a perfect circle) 
    285, // height (keep same as width for a perfect circle) 
    120-90, // start (-90 degrees to start from 12 o'clock) 
    190-90, // end (-90 degrees to start from 12 o'clock) 
    0x40ff0000, // colour (50% transparent red) 
    IMG_ARC_PIE 
); 

......給了我這樣的結果:

enter image description here

所有你應該需要做的就是更換您的參數計算值(中心點,直徑等)。

+1

太棒了!我目前因發燒而臥牀不起,所以我無法測試代碼,但看起來正確。我會接受我測試代碼的時間,可能明天。非常感謝你! – Andreas

+1

它工作完美!再次感謝 :-) – Andreas