= 4.0.6, PHP 5, PHP 7, PHP 8)imagesetthickness — 設(shè)定畫線的寬度說明imagesetthickness(resource $image, int $thickness): boolimagesetthi">
(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)
imagesetthickness — 設(shè)定畫線的寬度
$image
, int $thickness
): bool
imagesetthickness()
把畫矩形,多邊形,橢圓等等時(shí)所用的線寬設(shè)為
thickness
個(gè)像素。成功時(shí)返回 true
, 或者在失敗時(shí)返回 false
。
image
由圖象創(chuàng)建函數(shù)(例如imagecreatetruecolor())返回的 GdImage 對象。
thickness
Thickness, in pixels.
成功時(shí)返回 true
, 或者在失敗時(shí)返回 false
。
示例 #1 imagesetthickness() example
<?php
// Create a 200x100 image
$im = imagecreatetruecolor(200, 100);
$white = imagecolorallocate($im, 0xFF, 0xFF, 0xFF);
$black = imagecolorallocate($im, 0x00, 0x00, 0x00);
// Set the background to be white
imagefilledrectangle($im, 0, 0, 299, 99, $white);
// Set the line thickness to 5
imagesetthickness($im, 5);
// Draw the rectangle
imagerectangle($im, 14, 14, 185, 85, $black);
// Output image to the browser
header('Content-Type: image/png');
imagepng($im);
imagedestroy($im);
?>
以上例程的輸出類似于: