svn: /phpdoc/en/trunk/reference/image/ functions/imageistruecolor.xml functions/imagepalettetotruecolor.xml versions.xml

From: Date: Wed, 27 Mar 2013 03:25:21 +0000
Subject: svn: /phpdoc/en/trunk/reference/image/ functions/imageistruecolor.xml functions/imagepalettetotruecolor.xml versions.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-11156@lists.php.net to get a copy of this message
kalle Wed, 27 Mar 2013 03:25:21 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=329936 Log: Documented imagepalettetotruecolor() available as of 5.5.0 Changed paths: U phpdoc/en/trunk/reference/image/functions/imageistruecolor.xml A phpdoc/en/trunk/reference/image/functions/imagepalettetotruecolor.xml U phpdoc/en/trunk/reference/image/versions.xml Modified: phpdoc/en/trunk/reference/image/functions/imageistruecolor.xml =================================================================== --- phpdoc/en/trunk/reference/image/functions/imageistruecolor.xml 2013-03-26 23:06:00 UTC (rev 329935) +++ phpdoc/en/trunk/reference/image/functions/imageistruecolor.xml 2013-03-27 03:25:21 UTC (rev 329936) @@ -47,11 +47,14 @@ // Create a new true color image instance $tc = imagecreatetruecolor(imagesx($im), imagesy($im)); + // Copy over the pixels imagecopy($tc, $im, 0, 0, 0, 0, imagesx($im), imagesy($im)); imagedestroy($im); $im = $tc; $tc = NULL; + + // OR use imagepalettetotruecolor() } // Continue working with image instance @@ -70,6 +73,7 @@ <para> <simplelist> <member><function>imagecreatetruecolor</function></member> + <member><function>imagepalettetotruecolor</function></member> </simplelist> </para> </refsect1> Added: phpdoc/en/trunk/reference/image/functions/imagepalettetotruecolor.xml =================================================================== --- phpdoc/en/trunk/reference/image/functions/imagepalettetotruecolor.xml (rev 0) +++ phpdoc/en/trunk/reference/image/functions/imagepalettetotruecolor.xml 2013-03-27 03:25:21 UTC (rev 329936) @@ -0,0 +1,127 @@ +<?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>resource</type><parameter>src</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="examples"> + &reftitle.examples; + <para> + <example> + <title> + Converts any image resource 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; + } +} + +// 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; + <para> + <simplelist> + <member><function>imagecreatetruecolor</function></member> + <member><function>imageistruecolor</function></member> + </simplelist> + </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 +--> Property changes on: phpdoc/en/trunk/reference/image/functions/imagepalettetotruecolor.xml ___________________________________________________________________ Added: svn:keywords + Id Rev Revision Date LastChangedDate LastChangedRevision Author LastChangedBy HeadURL URL Added: svn:eol-style + native Modified: phpdoc/en/trunk/reference/image/versions.xml =================================================================== --- phpdoc/en/trunk/reference/image/versions.xml 2013-03-26 23:06:00 UTC (rev 329935) +++ phpdoc/en/trunk/reference/image/versions.xml 2013-03-27 03:25:21 UTC (rev 329936) @@ -80,6 +80,7 @@ <function name='imageline' from='PHP 4, PHP 5'/> <function name='imageloadfont' from='PHP 4, PHP 5'/> <function name='imagepalettecopy' from='PHP 4 &gt;= 4.0.1, PHP 5'/> + <function name='imagepalettetotruecolor' from='PHP &gt;= 5.5.0'/> <function name='imagepng' from='PHP 4, PHP 5'/> <function name='imagepolygon' from='PHP 4, PHP 5'/> <function name='imagepsbbox' from='PHP 4, PHP 5'/>

« previous php.doc.cvs (#11156) next »