mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Applying PEAR coding standards on example code.
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@138028 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
9061086965
commit
dbdc3a86fe
1 changed files with 26 additions and 25 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<refentry id="function.imagecolorallocatealpha">
|
||||
<refnamediv>
|
||||
<refname>imagecolorallocatealpha</refname>
|
||||
|
@ -33,37 +33,38 @@
|
|||
<![CDATA[
|
||||
<?php
|
||||
$size = 300;
|
||||
$Image=imagecreatetruecolor($size, $size);
|
||||
// something to get a white background
|
||||
$back = imagecolorallocate( $Image, 255, 255, 255 );
|
||||
$border = imagecolorallocate( $Image, 0, 0, 0);
|
||||
imagefilledrectangle ( $Image, 0, 0, $size-1, $size-1, $back);
|
||||
imagerectangle ( $Image, 0, 0, $size-1, $size-1, $border);
|
||||
$image=imagecreatetruecolor($size, $size);
|
||||
|
||||
$yellowX = 100;
|
||||
$yellowY = 75;
|
||||
$redX = 120;
|
||||
$redY = 165;
|
||||
$blueX = 187;
|
||||
$blueY = 125;
|
||||
$radius = 150;
|
||||
// something to get a white background with black border
|
||||
$back = imagecolorallocate($image, 255, 255, 255);
|
||||
$border = imagecolorallocate($image, 0, 0, 0);
|
||||
imagefilledrectangle($image, 0, 0, $size - 1, $size - 1, $back);
|
||||
imagerectangle($image, 0, 0, $size - 1, $size - 1, $border);
|
||||
|
||||
$yellow_x = 100;
|
||||
$yellow_y = 75;
|
||||
$red_x = 120;
|
||||
$red_y = 165;
|
||||
$blue_x = 187;
|
||||
$blue_y = 125;
|
||||
$radius = 150;
|
||||
|
||||
// allocate colors with alpha values
|
||||
$yellow = imagecolorallocateAlpha ( $Image, 255, 255, 0,75);
|
||||
$red = ImageColorAllocateAlpha( $Image, 255, 0, 0, 75 );
|
||||
$blue = ImageColorAllocateAlpha ( $Image, 0, 0, 255,75 );
|
||||
$yellow = imagecolorallocatealpha($image, 255, 255, 0, 75);
|
||||
$red = imagecolorallocatealpha($image, 255, 0, 0, 75);
|
||||
$blue = imagecolorallocatealpha($image, 0, 0, 255, 75);
|
||||
|
||||
// drawing 3 overlapped circle
|
||||
ImageFilledEllipse($Image, $yellowX, $yellowY,$radius,$radius,$yellow);
|
||||
ImageFilledEllipse($Image, $redX, $redY,$radius,$radius,$red);
|
||||
ImageFilledEllipse($Image, $blueX, $blueY,$radius,$radius,$blue);
|
||||
imagefilledellipse($image, $yellow_x, $yellow_y, $radius, $radius, $yellow);
|
||||
imagefilledellipse($image, $red_x, $red_y, $radius, $radius, $red);
|
||||
imagefilledellipse($image, $blue_x, $blue_y, $radius, $radius, $blue);
|
||||
|
||||
// don't forget to output correct header!
|
||||
header('Content-Type: image/png');
|
||||
// don't forget to output a correct header!
|
||||
header('Content-type: image/png');
|
||||
|
||||
// output the result
|
||||
ImagePNG($Image);
|
||||
ImageDestroy($Image);
|
||||
// and finally, output the result
|
||||
imagepng($image);
|
||||
imagedestroy($image);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
|
|
Loading…
Reference in a new issue