php-doc-en/reference/imagick/imagickkernel/scale.xml
Jakub Vrana 66d9935ec5 Fix signatures
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@344121 c90b9560-bf6c-de11-be94-00142212c4b1
2018-01-30 22:40:01 +00:00

145 lines
3.6 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="imagickkernel.scale" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>ImagickKernel::scale</refname>
<refpurpose>Description</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>void</type><methodname>ImagickKernel::scale</methodname>
<methodparam><type>float</type><parameter>scale</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>normalizeFlag</parameter></methodparam>
</methodsynopsis>
<para>
ScaleKernelInfo() scales the given kernel list by the given amount, with or without
normalization of the sum of the kernel values (as per given flags).
The exact behaviour of this function depends on the normalization type being used
please see http://www.imagemagick.org/api/morphology.php#ScaleKernelInfo for details.
Flag should be one of Imagick::NORMALIZE_KERNEL_VALUE, Imagick::NORMALIZE_KERNEL_CORRELATE,
Imagick::NORMALIZE_KERNEL_PERCENT or not set.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title> <function>ImagickKernel::scale</function></title>
<programlisting role="php">
<![CDATA[
<?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 = "";
$matrix = [
[-1, 0, -1],
[ 0, 4, 0],
[-1, 0, -1],
];
$kernel = \ImagickKernel::fromMatrix($matrix);
$kernelClone = clone $kernel;
$output .= "Start kernel<br/>";
$output .= renderKernelTable($kernel->getMatrix());
$output .= "Scaling with NORMALIZE_KERNEL_VALUE. The <br/>";
$kernel->scale(2, \Imagick::NORMALIZE_KERNEL_VALUE);
$output .= renderKernelTable($kernel->getMatrix());
$kernel = clone $kernelClone;
$output .= "Scaling by percent<br/>";
$kernel->scale(2, \Imagick::NORMALIZE_KERNEL_PERCENT);
$output .= renderKernelTable($kernel->getMatrix());
$matrix2 = [
[-1, -1, 1],
[ -1, false, 1],
[1, 1, 1],
];
$kernel = \ImagickKernel::fromMatrix($matrix2);
$output .= "Scaling by correlate<br/>";
$kernel->scale(1, \Imagick::NORMALIZE_KERNEL_CORRELATE);
$output .= renderKernelTable($kernel->getMatrix());
return $output;
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->