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

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

คำอธิบาย

ฟังก์ชัน imagedashedline() ใช้วาดเส้นประ

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

imagedashedline($image, $x1, $y1, $x2, $y2, $color)

พารามิเตอร์

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

  • x1
    พิกัด x มุมซ้ายบน

  • y1
    พิกัด y มุมซ้ายบน

  • x2
    พิกัด x มุมขวาล่าง

  • y2
    พิกัด y มุมขวาล่าง

  • color
    สีของเส้น

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

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

ตัวอย่าง

<?php
   $image = imagecreatetruecolor(500, 370);
   $bgcolor = imagecolorallocate($image, 70, 90, 120);
   imagefill($image, 0, 0, $bgcolor);
   $color = imagecolorallocate($image, 90, 220, 175);
   imagedashedline($image, 0, 0, 150, 50, $color);
   header("Content-type: image/png");
   imagepng($image);
?>

ผลลัพธ์

ภาพแสดงเส้นประบนพื้นหลังสี