当前位置: 首页>>编程示例 >>用法及示例精选 >>正文


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。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。