ฟังก์ชัน imagecolorset() ตั้งค่าสีสำหรับ palette index ที่ระบุ ใช้สร้างเอฟเฟกต์ flood-fill ใน palette images
ไวยากรณ์
imagecolorset (img, index, red, green, blue, alpha)
พารามิเตอร์
- img: ภาพจาก imagecreatetruecolor()
- index: Index ใน palette
- red: ค่าสีแดง
- green: ค่าสีเขียว
- blue: ค่าสีน้ำเงิน
- alpha: ความโปร่งใส (0-127)
คืนค่า
ไม่คืนค่า (void)
ตัวอย่าง
<?php
$img = imagecreate(550, 400);
imagecolorallocate($img, 0, 0, 0);
$bgcolor = imagecolorat($img, 70, 85);
imagecolorset($img, $bgcolor, 30, 110, 150);
header('Content-Type: image/png');
imagepng($img);
imagedestroy($img);
?>
ผลลัพธ์
