ImagickDraw::skewY()函數是PHP中的一個內置函數,用於在垂直方向上傾斜當前坐標係。
用法:
bool ImagickDraw::skewY( $degrees )
參數:此函數接受單個參數$degrees,該參數用於保存傾斜度。
返回值:此函數不返回返回任何值。
以下示例程序旨在說明PHP中的ImagickDraw::skewY()函數:
程序1:
<?php
// require_once('path/vendor/autoload.php');
// Create an ImagickDraw object.
$draw = new ImagickDraw();
// Set the image filled color
$draw->setFillColor('blue');
$points = [['x' => 40 * 5, 'y' => 10 * 5],
['x' => 70 * 5, 'y' => 50 * 5],
['x' => 60 * 5, 'y' => 15 * 5], ];
// Draw the polygon
$draw->polygon($points);
// Set the image filled color
$draw->setFillColor('red');
$draw->skewY(-60);
$points = [['x' => 40 * 5, 'y' => 10 * 5],
['x' => 70 * 5, 'y' => 50 * 5],
['x' => 60 * 5, 'y' => 15 * 5], ];
// Draw the polygon
$draw->polygon($points);
// Set the image filled color
$draw->setFillColor('green');
$draw->skewY(30);
$points = [['x' => 40 * 5, 'y' => 10 * 5],
['x' => 70 * 5, 'y' => 50 * 5],
['x' => 60 * 5, 'y' => 15 * 5], ];
// Draw the polygon
$draw->polygon($points);
// Create new Imagick object
$image = new Imagick();
// Set the image dimensions
$image->newImage(500, 500, 'white');
// Set the image format
$image->setImageFormat("png");
// Draw the image
$image->drawImage($draw);
header("Content-Type: image/png");
// Display the image
echo $image->getImageBlob();
?>
輸出:
程序2:
<?php
// require_once('path/vendor/autoload.php');
// Create an ImagickDraw object
$draw = new ImagickDraw();
// Set the stroke color
$draw->setStrokeColor('black');
// Set the image filled color
$draw->setFillColor('red');
// Draw the circle
$draw->circle(250, 250, 100, 150);
// Set the image filled color
$draw->setFillColor('green');
$draw->skewY(-30);
// Draw the circle
$draw->circle(250, 250, 100, 150);
// Set the image filled color
$draw->setFillColor('yellow');
$draw->skewY(-60);
// Draw the circle
$draw->circle(250, 250, 100, 150);
// Create new Imagick object
$image = new Imagick();
// Set the image dimensions
$image->newImage(700, 700, 'white');
// Set the image format
$image->setImageFormat("png");
// Draw the image
$image->drawImage($draw);
header("Content-Type: image/png");
// Display the image
echo $image->getImageBlob();
?>
輸出:
參考: http://php.net/manual/en/imagickdraw.skewy.php
相關用法
- CSS skewY()用法及代碼示例
- PHP ImagickDraw arc()用法及代碼示例
- PHP ImagickDraw pop()用法及代碼示例
- PHP ImagickDraw setClipRule()用法及代碼示例
- PHP ImagickDraw getFontSize()用法及代碼示例
- PHP ImagickDraw getFontFamily()用法及代碼示例
- PHP ImagickDraw getFillOpacity()用法及代碼示例
- PHP ImagickDraw ellipse()用法及代碼示例
- PHP ImagickDraw __construct()用法及代碼示例
- PHP ImagickDraw getStrokeWidth()用法及代碼示例
- PHP ImagickDraw getStrokeOpacity()用法及代碼示例
- PHP ImagickDraw setVectorGraphics()用法及代碼示例
- PHP ImagickDraw setTextAlignment()用法及代碼示例
- PHP ImagickDraw setStrokeColor()用法及代碼示例
- PHP ImagickDraw rotate()用法及代碼示例
注:本文由純淨天空篩選整理自sarthak_ishu11大神的英文原創作品 PHP | ImagickDraw skewY() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。