. .

    @Mail.ru -

PHP

» PHP 5 » PHP

, . , , , GD.

( 13.5).

13.5. .

‹?php
header("Content-type: image/png");
$image = imagecreatetruecolor (100, 100);
//
$white = imagecolorallocate($image, 255, 255, 255);
//
imageline($image, 0, 0, 99, 99, $white);
imageline($image, 0, 99, 99, 0, $white);
//
imagepng($image);
//
imagedestroy($image);
?›

, , imagecolorallocate(), , ( 0 255), . , , .

imageline(), , . . 13.3.

    PHP

, , . , ( 13.6.).

13.6. .

‹?php
header("Content-type: image/png");
//
$image = imagecreate (100, 100);
//
$green = imagecolorallocate($image, 0, 128, 0);
//
$white = imagecolorallocate($image, 255, 255, 255);
//
imagearc($image, 49, 49, 90, 90, 0, 360, $white);
imagearc($image, 49, 70, 50, 20, 0, 180, $white);
imagearc($image, 49, 49, 5, 20, 0, 360, $white);
imagearc($image, 29, 30, 20, 5, 0, 360, $white);
imagearc($image, 69, 30, 20, 5, 0, 360, $white);
//
imagepng($image);
//
imagedestroy($image);
?›

, imagecreate(), . .

imagearc() . , , , , , . .

$green = imagecolorallocate($image, 0, 128, 0)

GD imagerectangle() imagepolygon(), . , , imagefilledrectangle() imagefilledpolygon().

, . imagefill. , ( 13.7).

13.7. .

‹?php
header("Content-type: image/png");
$image = imagecreate (100, 100);
$green = imagecolorallocate($image, 0, 128, 0);
$yellow = imagecolorallocate($image, 255, 255, 0);
$black = imagecolorallocate($image, 0, 0, 0);
imagearc($image, 49, 49, 90, 90, 0, 360, $black);
imagearc($image, 49, 70, 50, 20, 0, 180, $black);
//
imagefill ($image, 49, 49, $yellow);
imagearc($image, 49, 49, 5, 20, 0, 360, $black);
imagearc($image, 29, 30, 20, 5, 0, 360, $black);
imagearc($image, 69, 30, 20, 5, 0, 360, $black);
//
imagepng($image);
//
imagedestroy($image);
?›

, .

imagefill() . , , .

imagefillborder(), , .