PHP ImagickDraw getStrokeOpacity()函数用法指南

2021年3月9日16:05:01 发表评论 603 次浏览

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


木子山

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: