ホームページ  >  記事  >  バックエンド開発  >  PHPのimagefilledrectangle()関数

PHPのimagefilledrectangle()関数

PHPz
PHPz転載
2023-08-30 09:05:061071ブラウズ

imagefilledrectangle() 関数は塗りつぶされた四角形を描画します。

構文

imagefilledrectangle( $img, $x1, $y1, $x2, $y2, $color )

パラメータ

  • image

    imagecreatetruecolor() を使用して空の画像を作成します。

  • #x1

    x 点 1 の座標。

  • y1

    点 1 の y 座標。

  • x2

    点 2 の x 座標。

  • y2

    点 2 の y 座標。

  • color

    塗りつぶしの色。

戻り値

imagefilledrectangle() 関数は、成功すると TRUE を返し、失敗すると FALSE を返します。

次は例です:

<?php
   // Create an image
   $img = imagecreatetruecolor(500, 300);
   $color = imagecolorallocate($img, 0, 128, 128);
   imagefilledrectangle($img, 30, 30, 470, 270, $color);
   header("Content-type: image/png");
   imagepng($img);
   imagedestroy($img);
?>

出力

次は出力です:

# #

以上がPHPのimagefilledrectangle()関数の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

声明:
この記事はtutorialspoint.comで複製されています。侵害がある場合は、admin@php.cn までご連絡ください。