1
A
回答
2
這裏是畫虛線circle.enjoy的
<?php
function dashedcircle($im, $cx, $cy, $radius, $colour, $dashsize=5) {
$dash=false;
for ($angle=0; $angle<=(180+$dashsize); $angle+=$dashsize) {
$x = ($radius * cos(deg2rad($angle)));
$y = ($radius * sin(deg2rad($angle)));
if ($dash) {
imageline($im, $cx+$px, $cy+$py, $cx+$x, $cy+$y, $colour);
imageline($im, $cx-$px, $cx-$py, $cx-$x, $cy-$y, $colour);
}
$dash=!$dash;
$px=$x;
$py=$y;
}
}
?>
多一個辦法!
<?php
header("Content-type: image/jpeg");
$im = imagecreate(100,100);
$b = imagecolorallocate ($im, 0, 0, 0);
$w = imagecolorallocate ($im, 255, 255, 255);
$style = array ($b,$b,$b,$b,$b,$w,$w,$w,$w,$w);
imagesetstyle ($im, $style);
imagearc($im,50,50,100,100,0,360,IMG_COLOR_STYLED);
imagejpeg($im);
imagedestroy($im);
?>
1
這裏是我用來做什麼的代碼。
<?php
$thick = 10;
// create a 200*200 image
$img = imagecreatetruecolor(200, 200);
// Add antialias
imageantialias ($img, true);
// allocate some colors
$white = imagecolorallocate($img, 255, 255, 255);
// draw the dashed circle
for($t = 1;$t<($thick+1);$t++) {
for($i = 0;$i<360;$i+=10) {
imagearc($img, 100, 100, 200-($t/5), 200-($t/5), $i, $i+5, $white);
imagearc($img, 100, 100, 200+($t/5), 200+($t/5), $i, $i+5, $white);
}
}
// output image in the browser
header("Content-type: image/png");
imagepng($img);
// free memory
imagedestroy($img);
?>
0
相關問題
- 1. 如何在iphone sdk中使用圖形繪製虛線圓圈?
- 2. 使用邊框半徑繪製圓圈
- 3. 使用OpenCV繪製虛線/虛線圓圈
- 4. Android:圓圈繪製切割邊框
- 5. 繪製虛線邊框
- 6. 用php繪製圓圈imagemagick
- 7. 在directx中繪製一個圓圈9
- 8. 使用JavaScript在谷歌地圖上繪製虛線圓圈
- 9. 在Android視圖中繪製虛線圓圈
- 10. 如何在圓圈內繪製圓形?
- 11. cv:圓圈函數用一次調用繪製多個圓圈
- 12. 如何使用座標在silverlight中繪製一個圓圈?
- 13. 如何在Swift中爲macOS應用繪製一個圓圈?
- 14. 虛線邊框邊框圓角
- 15. 如何在android中繪製圓圈?
- 16. 如何在Unity3D中繪製圓圈?
- 17. 如何在gnuplot中繪製圓圈
- 18. 如何在cocos2dx中繪製圓圈
- 19. 在C++中繪製圓圈
- 20. 在android中繪製圓圈
- 21. 在MATLAB中繪製圓圈
- 22. Corona SDK繪製線條使用圓圈
- 23. 如何在python中的圓圈中繪製一個隨機點?
- 24. 如何在兩個圓圈之間動態繪製線條
- 25. 爲UITableViewCell繪製虛線邊框底部
- 26. 在UIView框架內繪製圓圈
- 27. 如何繪製邊緣相交的兩個圓圈?
- 28. 繪製多個圓圈
- 29. HTML5畫布 - 繪製線段和圓圈 - 一個圓圈的不同顏色
- 30. 如何使用PlayN在屏幕上繪製一個圓圈?
兩個代碼並不會自動爲我工作。 – Smart 2011-05-06 13:05:19
你得到什麼錯誤? – diEcho 2011-05-06 13:05:46
嘗試了第一個:'dashedcircle($ im,70,80,20,$ green,1);'但它只在cx和cy相同時才起作用。 http://viper-7.com/8zXkCK – Veda 2015-06-29 16:39:49