PHP Conference Nagoya 2025

ImagickKernel::getMatrix

(PECL imagick >= 3.3.0)

ImagickKernel::getMatrixGet the 2d matrix of values used in this kernel

说明

public ImagickKernel::getMatrix(): array

Get the 2d matrix of values used in this kernel. The elements are either float for elements that are used or 'false' if the element should be skipped.

参数

此函数没有参数。

返回值

A matrix (2d array) of the values that represent the kernel.

示例

示例 #1 ImagickKernel::getMatrix()

<?php


function renderKernelTable($matrix) {
$output = "<table class='infoTable'>";

foreach (
$matrix as $row) {
$output .= "<tr>";
foreach (
$row as $cell) {
$output .= "<td style='text-align:left'>";
if (
$cell === false) {
$output .= "false";
}
else {
$output .= round($cell, 3);
}
$output .= "</td>";
}
$output .= "</tr>";
}

$output .= "</table>";

return
$output;
}

$output = "The built-in kernel name 'ring' with parameters of '2,3.5':<br/>";
$kernel = \ImagickKernel::fromBuiltIn(
\Imagick::KERNEL_RING,
"2,3.5"
);
$matrix = $kernel->getMatrix();
$output .= renderKernelTable($matrix);

echo
$output;

?>

添加备注

用户贡献的备注

此页面尚无用户贡献的备注。
To Top