當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


PHP ImagickDraw getStrokeOpacity()用法及代碼示例

ImagickDraw::getStrokeOpacity() 函數是 PHP 中的一個內置函數,用於返回描邊對象輪廓的不透明度。

用法:

float ImagickDraw::getStrokeOpacity( void )

參數:該函數不接受任何參數。

返回值:此函數在成功時返回筆畫不透明度。

錯誤/異常:它會在出錯時拋出 ImagickException。



以下示例程序旨在說明 PHP 中的 ImagickDraw::getStrokeOpacity() 函數:

程序:


<?php
  
// Create an ImagickDraw object
$draw = new \ImagickDraw();
  
// Set the Stroke Color 
$draw->setStrokeColor('Green');
  
// Set the Fill Color
$draw->setFillColor('Red');
  
// Set the stroke width
$draw->setStrokeWidth(7);
  
// Draw the rectangle
$draw->rectangle(40, 30, 200, 260);
  
// Set the stroke opacity
$draw->setStrokeOpacity(0.5);
  
// Display the StrokeOpacity 
echo $draw->getStrokeOpacity();
?>

輸出:

0.49999237048905

參考: http://php.net/manual/en/imagickdraw.getstrokeopacity.php

相關用法


注:本文由純淨天空篩選整理自sarthak_ishu11大神的英文原創作品 PHP | ImagickDraw getStrokeOpacity() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。