Heim  >  Artikel  >  Backend-Entwicklung  >  imagefilledrectangle()-Funktion in PHP

imagefilledrectangle()-Funktion in PHP

PHPz
PHPznach vorne
2023-08-30 09:05:061071Durchsuche

Die Funktion

imagefilledrectangle() zeichnet ein gefülltes Rechteck.

Syntax

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

Parameter

  • image

    Verwenden Sie imagecreatetruecolor(), um ein leeres Bild zu erstellen.

  • x1

    x Koordinate von Punkt 1.

  • y1

    Die y-Koordinate von Punkt 1.

  • x2

    Die x-Koordinate von Punkt 2.

  • y2

    Die y-Koordinate von Punkt 2.

  • Farbe

    Füllfarbe.

Rückgabewert

Die Funktion imagefilledrectangle() gibt TRUE zurück, wenn sie erfolgreich ist, und FALSE, wenn sie fehlschlägt.

Beispiel

Hier ist ein Beispiel:

<?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);
?>

Ausgabe

Hier ist die Ausgabe:

imagefilledrectangle()-Funktion in PHP

Das obige ist der detaillierte Inhalt vonimagefilledrectangle()-Funktion in PHP. Für weitere Informationen folgen Sie bitte anderen verwandten Artikeln auf der PHP chinesischen Website!

Stellungnahme:
Dieser Artikel ist reproduziert unter:tutorialspoint.com. Bei Verstößen wenden Sie sich bitte an admin@php.cn löschen