PHP GD绘图问题,请大牛帮忙。感觉很简单,但是本人太菜,弄不懂
Jun 20, 2016 pm 12:30 PM代码如下
<?php$im = imagecreatetruecolor(400,200);$background = imagecolorallocate($im,0,0,0);$black = imagecolorallocate($im,0,255,255);imagefill($im, 100, 100, $black);header("content-type:image/png");imagepng($im);//提示:对于用 imagecreate() 建立的图像,第一次调用 imagecolorallocate() 会自动给图像填充背景色。?>
这个imagefill是从后面第二第三个参数,也就是X,Y坐标开始填充,但是为什么显示的却是整个png都填充了?
回复讨论(解决方案)
imagefill 的第二、第三个参数 是被充填区域内的一点
这个点作为种子(始发点)向周围扩散
能理解吗?
imagefill 的第二、第三个参数 是被充填区域内的一点
这个点作为种子(始发点)向周围扩散
能理解吗?
那如何才能只填充其中的一部分呢
imagefilledarc -- 画一椭圆弧且填充
imagefilledarc -- 画一椭圆弧且填充
imagefilledpolygon -- 画一多边形并填充
imagefilledrectangle -- 画一矩形并填充
imagefilltoborder -- 区域填充到指定颜色的边界为止
imagefilledarc -- 画一椭圆弧且填充
imagefilledarc -- 画一椭圆弧且填充
imagefilledpolygon -- 画一多边形并填充
imagefilledrectangle -- 画一矩形并填充
imagefilltoborder -- 区域填充到指定颜色的边界为止
你不看手册的吗?
手册中都有示例代码
你不看手册的吗?
手册中都有示例代码
不是说了么,点(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);

인기 기사

인기 기사

뜨거운 기사 태그

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

드림위버 CS6
시각적 웹 개발 도구

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)

뜨거운 주제











PHP의 컬 : REST API에서 PHP Curl Extension 사용 방법

Laravel Back End : Part 2, React가있는 React 앱 구축
