ImagickDraw::pathEllipticArcAbsolute()函數是PHP中的一個內置函數,用於使用絕對坐標從當前點到(x,y)繪製橢圓弧。
用法:
bool ImagickDraw::pathEllipticArcAbsolute( float $rx, float $ry, float $x_axis_rotation, bool $large_arc_flag, bool $sweep_flag, float $x, float $y )
參數:此函數接受上述和以下所述的七個參數:
- $rx:它指定x-radius。
 - $ry:它指定y-radius
 - $x_axis_rotation:它指定x軸旋轉
 - $large_arc_flag:它指定是否繪製較大的可用弧。
 - $sweep_flag:它指定是否繪製與順時針旋轉匹配的圓弧。
 - $x:它指定x坐標。
 - $y:它指定y坐標。
 
返回值:成功時此函數返回TRUE。
異常:該函數在錯誤時引發ImagickException。
下麵給出的程序說明了PHP中的ImagickDraw::pathEllipticArcAbsolute()函數:
程序1:
<?php 
  
// Create a new imagick object 
$imagick = new Imagick(); 
  
// Create a image on imagick object 
$imagick->newImage(800, 250, 'green'); 
  
// Create a new ImagickDraw object 
$draw = new ImagickDraw(); 
  
$draw->setFillColor('blue'); 
  
// Set the stroke color 
$draw->setStrokeColor('red'); 
  
// Set the stroke width 
$draw->setStrokeWidth(15); 
  
// Draw elliptic arc 
$draw->pathStart(); 
$draw->pathEllipticArcAbsolute(420, 250, 10, true, true, 40, 40); 
$draw->pathClose(); 
$draw->pathFinish(); 
  
// Render the draw commands 
$imagick->drawImage($draw); 
  
// Show the output 
$imagick->setImageFormat('png'); 
header("Content-Type:image/png"); 
echo $imagick->getImageBlob(); 
?>輸出:

程序2:
<?php 
  
// Create a new imagick object 
$imagick = new Imagick(); 
  
// Create a image on imagick object 
$imagick->newImage(800, 250, '#E57733'); 
  
// Create a new ImagickDraw object 
$draw = new ImagickDraw(); 
  
// Set the width of stroke 
$draw->setStrokeWidth(1); 
  
// Set the color of stroke 
$draw->setStrokeColor('#E57733'); 
  
// Set the fill color 
$draw->setFillColor('black'); 
  
// Set the fill rule 
$draw->setFillRule(Imagick::FILLRULE_NONZERO); 
  
// Draw a sunset cartoon 
$draw->pathStart(); 
$draw->pathMoveToAbsolute(0, 100); 
$draw->pathEllipticArcAbsolute(420, 400, 410, true, true, 0, 900); 
$draw->pathMoveToAbsolute(300, 250); 
$draw->pathEllipticArcAbsolute(420, 600, 410, true, true, 0, 900); 
$draw->pathClose(); 
$draw->pathFinish(); 
$draw->setFillColor('yellow'); 
$draw->translate(30, 0); 
$draw->circle(300, 100, 300, 150); 
  
// Render the draw commands 
$imagick->drawImage($draw); 
  
// Show the output 
$imagick->setImageFormat('png'); 
header("Content-Type:image/png"); 
echo $imagick->getImageBlob(); 
?>輸出:

參考: https://www.php.net/manual/en/imagickdraw.pathellipticarcabsolute.php
相關用法
- PHP ImagickDraw arc()用法及代碼示例
 - PHP ImagickDraw pop()用法及代碼示例
 - PHP ImagickDraw pathCurveToQuadraticBezierSmoothAbsolute()用法及代碼示例
 - PHP ImagickDraw setStrokeMiterLimit()用法及代碼示例
 - PHP ImagickDraw getStrokeMiterLimit()用法及代碼示例
 - PHP ImagickDraw setStrokeLineCap()用法及代碼示例
 - PHP ImagickDraw setFontSize()用法及代碼示例
 - PHP ImagickDraw pathStart()用法及代碼示例
 - PHP ImagickDraw getStrokeLineJoin()用法及代碼示例
 - PHP ImagickDraw getStrokeLineCap()用法及代碼示例
 - PHP ImagickDraw setFontWeight()用法及代碼示例
 - PHP ImagickDraw setTextAntialias()用法及代碼示例
 - PHP ImagickDraw setTextDecoration()用法及代碼示例
 - PHP ImagickDraw polygon()用法及代碼示例
 - PHP ImagickDraw roundRectangle()用法及代碼示例
 
注:本文由純淨天空篩選整理自gurrrung大神的英文原創作品 PHP | ImagickDraw pathEllipticArcAbsolute() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
