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


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

ImagickDraw::getStrokeWidth() 函數是 PHP 的內置函數,用於返回用於繪製對象輪廓的筆劃寬度。

用法:

float ImagickDraw::getStrokeWidth( void )

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

返回值:此函數在成功時返回筆畫寬度。

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



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

程序:


<?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 opacity
$draw->setStrokeOpacity(0.5);
  
// Draw the rectangle
$draw->rectangle(40, 30, 200, 260);
  
// Set the stroke width
$draw->setStrokeWidth(7);
  
// Display the StrokeWidth 
echo $draw->getStrokeWidth();
?>

輸出:

7

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

相關用法


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