paintFloodFillImage()函數是PHP中的內置函數,用於更改與目標匹配並且是直接鄰居的任何像素的顏色值。
用法:
bool Imagick::paintFloodFillImage( $fill, $fuzz, $bordercolor, $x, $y, $channel = Imagick::CHANNEL_DEFAULT )
注意:此函數已由Imagick::floodFillPaintImage()函數代替。
參數:該函數接受上述和以下所述的六個參數:
- $fill:它保存ImagickPixel對象或字符串值以填充顏色。
- $fuzz:它定義了模糊的數量。
- $bordercolor:它包含ImagickPixel對象或邊框像素顏色的字符串值。
- $x:它包含填充的x軸的起始位置。
- $y:它包含填充的y軸的起始位置。
- $invert:它包含布爾值TRUE或FALSE。 TRUE繪製與目標顏色不匹配的任何像素。
- $channel:它包含通道常數。可以使用按位運算符組合多個通道常量。
返回值:成功時此函數返回TRUE。
以下示例程序旨在說明PHP中的Imagick::floodFillPaintImage()函數:
程序:
<?php
// Creating an imagick object
$img = new Imagick(
'https://cdncontribute.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-9.png');
// Use Imagick::paintFloodFillImage() function to change the
// color value of the target color
$img->floodFillPaintImage('cyan', 1, 'white', 1, 1, false);
header("Content-Type: image/png");
// Display the output image
echo $img->getImageBlob();
?>
輸出:
參考: https://www.php.net/manual/en/imagick.paintfloodfillimage.php
相關用法
- PHP Imagick getImageCompose()用法及代碼示例
- PHP Imagick getImageChannelStatistics()用法及代碼示例
- PHP Imagick getImageClipMask()用法及代碼示例
- PHP Imagick setImageClipMask()用法及代碼示例
- PHP Imagick getImageChannelExtrema()用法及代碼示例
- PHP Imagick getImageChannelMean()用法及代碼示例
- PHP Imagick setImageBorderColor()用法及代碼示例
- PHP Imagick haldClutImage()用法及代碼示例
- PHP Imagick getImageBackgroundColor()用法及代碼示例
- PHP Imagick getImageChannelDistortion()用法及代碼示例
- PHP Imagick setImageBluePrimary()用法及代碼示例
- PHP Imagick getImageBorderColor()用法及代碼示例
- PHP Imagick setImageBackgroundColor()用法及代碼示例
- PHP Imagick setImageCompose()用法及代碼示例
- PHP Imagick setImageDelay()用法及代碼示例
注:本文由純淨天空篩選整理自harshvvaid1996大神的英文原創作品 PHP | Imagick paintFloodFillImage() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。