reference/image/functions/imagecolorallocatealpha.xml
593ea510e853ff034e03f78a4be0daa41661c9d4
...
...
@@ -8,8 +8,8 @@
8
8
<refsect1 role="description">
9
9
&reftitle.description;
10
10
<methodsynopsis>
11
-
<type>int</type><methodname>imagecolorallocatealpha</methodname>
12
-
<methodparam><type>resource</type><parameter>image</parameter></methodparam>
11
+
<type class="union"><type>int</type><type>false</type></type><methodname>imagecolorallocatealpha</methodname>
12
+
<methodparam><type>GdImage</type><parameter>image</parameter></methodparam>
13
13
<methodparam><type>int</type><parameter>red</parameter></methodparam>
14
14
<methodparam><type>int</type><parameter>green</parameter></methodparam>
15
15
<methodparam><type>int</type><parameter>blue</parameter></methodparam>
...
...
@@ -55,8 +55,9 @@
55
55
</listitem>
56
56
</varlistentry>
57
57
</variablelist>
58
-
The colors parameters are integers between 0 and 255 or hexadecimals
59
-
between 0x00 and 0xFF.
58
+
The <parameter>red</parameter>, <parameter>green</parameter>
59
+
and <parameter>blue</parameter> parameters are integers
60
+
between 0 and 255 or hexadecimals between 0x00 and 0xFF.
60
61
</para>
61
62
</refsect1>
62
63
<refsect1 role="returnvalues">
...
...
@@ -66,35 +67,29 @@
66
67
</para>
67
68
&return.falseproblem;
68
69
</refsect1>
70
+

69
71
<refsect1 role="changelog">
70
72
&reftitle.changelog;
71
-
<para>
72
-
<informaltable>
73
-
<tgroup cols="2">
74
-
<thead>
75
-
<row>
76
-
<entry>&Version;</entry>
77
-
<entry>&Description;</entry>
78
-
</row>
79
-
</thead>
80
-
<tbody>
81
-
<row>
82
-
<entry>Prior to 5.1.3</entry>
83
-
<entry>
84
-
Returns -1 if the allocation failed.
85
-
</entry>
86
-
</row>
87
-
</tbody>
88
-
</tgroup>
89
-
</informaltable>
90
-
</para>
73
+
<informaltable>
74
+
<tgroup cols="2">
75
+
<thead>
76
+
<row>
77
+
<entry>&Version;</entry>
78
+
<entry>&Description;</entry>
79
+
</row>
80
+
</thead>
81
+
<tbody>
82
+
&gd.changelog.image-param;
83
+
</tbody>
84
+
</tgroup>
85
+
</informaltable>
91
86
</refsect1>
87
+

92
88
<refsect1 role="examples">
93
89
&reftitle.examples;
94
-
<para>
95
-
<example>
96
-
<title>Example of using <function>imagecolorallocatealpha</function></title>
97
-
<programlisting role="php">
90
+
<example>
91
+
<title>Example of using <function>imagecolorallocatealpha</function></title>
92
+
<programlisting role="php">
98
93
<![CDATA[
99
94
<?php
100
95
$size = 300;
...
...
@@ -132,32 +127,51 @@ imagepng($image);
132
127
imagedestroy($image);
133
128
?>
134
129
]]>
135
-
</programlisting>
136
-
&example.outputs.similar;
137
-
<mediaobject>
138
-
<alt>Output of example : Example of using imagecolorallocatealpha()</alt>
139
-
<imageobject>
140
-
<imagedata fileref="en/reference/image/figures/imagecolorallocatealpha.png"/>
141
-
</imageobject>
142
-
</mediaobject>
143
-
</example>
144
-
</para>
145
-
</refsect1>
146
-
<refsect1 role="notes">
147
-
&reftitle.notes;
148
-
&note.gd.2;
130
+
</programlisting>
131
+
&example.outputs.similar;
132
+
<mediaobject>
133
+
<alt>Output of example : Example of using imagecolorallocatealpha()</alt>
134
+
<imageobject>
135
+
<imagedata fileref="en/reference/image/figures/imagecolorallocatealpha.png"/>
136
+
</imageobject>
137
+
</mediaobject>
138
+
</example>
139
+
<example xml:id="imagecolorallocatealpha.example.convert">
140
+
<title>Convert typical alpha values for use with <function>imagecolorallocatealpha</function></title>
141
+
<para>
142
+
Usually alpha values of <literal>0</literal> designate fully transparent pixels,
143
+
and the alpha channel has 8 bits. To convert such alpha values to be compatible
144
+
with <function>imagecolorallocatealpha</function>, some simple arithmetic is
145
+
sufficient:
146
+
</para>
147
+
<programlisting role="php">
148
+
<![CDATA[
149
+
<?php
150
+
$alpha8 = 0; // fully transparent
151
+
var_dump(127 - ($alpha8 >> 1));
152
+
$alpha8 = 255; // fully opaque
153
+
var_dump(127 - ($alpha8 >> 1));
154
+
?>
155
+
]]>
156
+
</programlisting>
157
+
&example.outputs;
158
+
<screen>
159
+
<![CDATA[
160
+
int(127)
161
+
int(0)
162
+
]]>
163
+
</screen>
164
+
</example>
149
165
</refsect1>
166
+

150
167
<refsect1 role="seealso">
151
168
&reftitle.seealso;
152
-
<para>
153
-
<simplelist>
154
-
<member><function>imagecolorallocate</function></member>
155
-
<member><function>imagecolordeallocate</function></member>
156
-
</simplelist>
157
-
</para>
169
+
<simplelist>
170
+
<member><function>imagecolorallocate</function></member>
171
+
<member><function>imagecolordeallocate</function></member>
172
+
</simplelist>
158
173
</refsect1>
159
174
</refentry>
160
-

161
175
<!-- Keep this comment at the end of the file
162
176
Local variables:
163
177
mode: sgml
164
178