代碼如下
這個imagefill是從後面第二第三個參數,也就是X,Y座標開始填充,但是為什麼顯示的卻是整個png都填充了?
回複討論(解決方案)
imagefill 的第二、第三個參數 是被充填地區內的一點
這個點作為種子(始發點)向周圍擴散
能理解嗎?
imagefill 的第二、第三個參數 是被充填地區內的一點
這個點作為種子(始發點)向周圍擴散
能理解嗎?
那如何才能只填充其中的一部分呢
imagefilledarc -- 畫一橢圓弧且填充
imagefilledarc -- 畫一橢圓弧且填充
imagefilledpolygon -- 畫一多邊形並填充
imagefilledrectangle -- 畫一矩形並填充
imagefilltoborder -- 地區填充到指定顏色的邊界為止
imagefilledarc -- 畫一橢圓弧且填充
imagefilledarc -- 畫一橢圓弧且填充
imagefilledpolygon -- 畫一多邊形並填充
imagefilledrectangle -- 畫一矩形並填充
imagefilltoborder -- 地區填充到指定顏色的邊界為止
那能在跟我講一下imagefill嗎 上面你說的那個擴散只是一知半解 。
你不看手冊的嗎?
手冊中都有範例程式碼
你不看手冊的嗎?
手冊中都有範例程式碼
imagefill() 在 image 映像的座標 x,y(映像左上方為 0, 0)處用 color 顏色執列區域填充(即與 x, y 點顏色相同且相鄰的點都會被填充)。 手冊上這麼寫,看不太明白
不是說了麼,點(x,y)是種子,種子當然只會繁衍出相同的後代
如果點(x,y) 是紅色,那麼與他相鄰的紅色的點都會被改變
這個你的自己動動手,光是冥想是理解不了的
$im = imagecreatetruecolor(300, 200);$white = imagecolorallocate($im, 255, 255, 255);$red = imagecolorallocate($im, 255, 0, 0);$green = imagecolorallocate($im, 0, 255, 0);$blue = imagecolorallocate($im, 0, 0, 255);imagefill($im, 0, 0, $white);imagerectangle($im, 50, 30, 250, 170, $red);imagefill($im, 51, 31, $green);imagepng($im);
這個你的自己動動手,光是冥想是理解不了的
$im = imagecreatetruecolor(300, 200);$white = imagecolorallocate($im, 255, 255, 255);$red = imagecolorallocate($im, 255, 0, 0);$green = imagecolorallocate($im, 0, 255, 0);$blue = imagecolorallocate($im, 0, 0, 255);imagefill($im, 0, 0, $white);imagerectangle($im, 50, 30, 250, 170, $red);imagefill($im, 51, 31, $green);imagepng($im);
恩,知道了 ,明白了