Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> PHP

ฟังก์ชัน imagefilledellipse() ใน PHP

คำอธิบาย

ฟังก์ชัน imagefilledellipse() ใช้วาดวงรีเติมสี

รูปแบบการใช้งาน (Syntax)

imagefilledellipse($img, $cx, $cy, $width, $height, $color)

พารามิเตอร์

  • img สร้างภาพว่างด้วย imagecreatetruecolor()

  • cx พิกัด x ของจุดศูนย์กลาง

  • cy พิกัด y ของจุดศูนย์กลาง

  • width ความกว้างของวงรี

  • height ความสูงของวงรี

  • color สีที่ใช้เติม

ค่าที่คืนกลับ

ฟังก์ชัน imagefilledellipse() คืนค่า TRUE เมื่อสำเร็จ หรือ FALSE เมื่อล้มเหลว

ตัวอย่าง

<?php
   $img = imagecreatetruecolor(450, 290);
   $bgColor = imagecolorallocate($img, 140, 180, 140);
   imagefill($img, 0, 0, $bgColor);
   $ellipse = imagecolorallocate($img, 120, 50, 70);
   imagefilledellipse($img, 225, 150, 400, 250, $ellipse);
   header("Content-type: image/png");
   imagepng($img);
?>

ผลลัพธ์

ภาพแสดงวงรีเติมสีบนพื้นหลัง