PHP GD繪圖問題,請大牛幫忙。感覺很簡單,但是本人太菜,弄不懂

來源:互聯網
上載者:User
代碼如下
 


這個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);

恩,知道了 ,明白了
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.