ImagickKernel::getMatrix

カーネルで使用される2次元の値の行列を取得する

説明

public array ImagickKernel::getMatrix()

カーネルで使用される2次元の値の行列を取得します。各要素は、 使用される要素の場合は float、スキップすべき要素の場合は 'false' です。

パラメータ

この関数にはパラメータはありません。

戻り値

カーネルを表す値の行列(2次元配列)。

例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;

?>