Note the requirements of setting the background colour and fix example

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@204359 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Matt Li 2006-01-02 09:14:22 +00:00
parent 6f7cff7c56
commit ff74fde99d

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.8 $ -->
<!-- $Revision: 1.9 $ -->
<!-- splitted from ./en/functions/image.xml, last change in rev 1.36 -->
<refentry id="function.imagecolorallocate">
<refnamediv>
@ -18,9 +18,8 @@
<para>
<function>imagecolorallocate</function> returns a color
identifier representing the color composed of the given
<acronym>RGB</acronym> components. The <parameter>image</parameter>
argument is the return from the <function>imagecreatetruecolor</function>
function. <parameter>red</parameter>, <parameter>green</parameter> and
<acronym>RGB</acronym> components.
<parameter>red</parameter>, <parameter>green</parameter> and
<parameter>blue</parameter> are the values of the red, green and blue
component of the requested color respectively. These parameters are
integers between 0 and 255 or hexadecimals between 0x00 and 0xFF.
@ -31,7 +30,8 @@
<note>
<para>
The first call to <function>imagecolorallocate</function> fills
the background color.
the background color in palette-based images - images created using
<function>imagecreate</function>.
</para>
</note>
<para>
@ -40,9 +40,11 @@
<![CDATA[
<?php
$im = imagecreatetruecolor('example.jpg');
$im = imagecreatetruecolor('example.jpg', 100, 100);
// sets background to red
$background = imagecolorallocate($im, 255, 0, 0);
$red = imagecolorallocate($im, 255, 0, 0);
imagefill($im, 0, 0, $red);
// sets some colors
$white = imagecolorallocate($im, 255, 255, 255);