imagesetpixel()在指定的坐标处绘制像素。
语法
PHP imagesetpixel()函数具有以下语法。
bool imagesetpixel ( resource $image , int $x , int $y , int $color )
参数
PHP imagesetpixel()函数具有以下参数。
- image - 由图像创建函数(如imagecreatetruecolor())返回的图像资源。
- x-x坐标。
- y-y坐标。
- color - 使用imagecolorallocate()创建的颜色标识符。
返回值
成功时返回TRUE,失败时返回FALSE。
实例
<?php
/*
http://www.manongjc.com/article/1758.html
作者:码农教程
*/
$myImage = imagecreatetruecolor( 200, 100 );
$myGray = imagecolorallocate( $myImage, 204, 204, 204 );
$myBlack = imagecolorallocate( $myImage, 0, 0, 0 );
imagesetpixel( $myImage, 120, 60, $myBlack );
header( \"Content-type: image/png\" );
imagepng( $myImage );
imagedestroy( $myImage );
?> 继续阅读与本文标签相同的文章
-
当科技时代的到来银行数据仓库将如何让发展
2026-05-15栏目: 教程
-
若5G时代到来了,会带来哪些创业机会?你会成为风口上的飞猪吗?
2026-05-15栏目: 教程
-
腾讯视频用国际化视野讲好中国故事
2026-05-15栏目: 教程
-
你知道苹果的Siri为什么叫Siri吗?
2026-05-15栏目: 教程
-
计算机科学与技术专业开设的云计算方向涉及到哪些内容
2026-05-15栏目: 教程
