mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00
143 lines
3.2 KiB
XML
143 lines
3.2 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<refentry xml:id="function.imagepalettetotruecolor" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>imagepalettetotruecolor</refname>
|
|
<refpurpose>Converts a palette based image to true color</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>bool</type><methodname>imagepalettetotruecolor</methodname>
|
|
<methodparam><type>GdImage</type><parameter>image</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Converts a palette based image, created by functions like
|
|
<function>imagecreate</function> to a true color image, like
|
|
<function>imagecreatetruecolor</function>.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
&gd.image.description;
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Returns &true; if the convertion was complete, or if the source image already
|
|
is a true color image, otherwise &false; is returned.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
&gd.changelog.image-param;
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>
|
|
Converts any image object to true color
|
|
</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
// Backwards compatiblity
|
|
if(!function_exists('imagepalettetotruecolor'))
|
|
{
|
|
function imagepalettetotruecolor(&$src)
|
|
{
|
|
if(imageistruecolor($src))
|
|
{
|
|
return(true);
|
|
}
|
|
|
|
$dst = imagecreatetruecolor(imagesx($src), imagesy($src));
|
|
|
|
imagecopy($dst, $src, 0, 0, 0, 0, imagesx($src), imagesy($src));
|
|
imagedestroy($src);
|
|
|
|
$src = $dst;
|
|
|
|
return(true);
|
|
}
|
|
}
|
|
|
|
// Helper closure
|
|
$typeof = function() use($im)
|
|
{
|
|
echo 'typeof($im) = ' . (imageistruecolor($im) ? 'true color' : 'palette'), PHP_EOL;
|
|
};
|
|
|
|
// Create a palette based image
|
|
$im = imagecreate(100, 100);
|
|
$typeof();
|
|
|
|
// Convert it to true color
|
|
imagepalettetotruecolor($im);
|
|
$typeof();
|
|
|
|
// Free the memory
|
|
imagedestroy($im);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
typeof($im) = palette
|
|
typeof($im) = true color
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<simplelist>
|
|
<member><function>imagecreatetruecolor</function></member>
|
|
<member><function>imageistruecolor</function></member>
|
|
</simplelist>
|
|
</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
|
|
-->
|