[php]imagecolorallocate — 為一幅圖像分配顏色
官方例子
<?php
$im = imagecreate('example.jpg', 100, 100);
// 背景設為紅色
$background = imagecolorallocate($im, 255, 0, 0);
// 設定一些顏色
$white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
// 十六進制方式
$white = imagecolorallocate($im, 0xFF, 0xFF, 0xFF);
$black = imagecolorallocate($im, 0x00, 0x00, 0x00);
?>
全站熱搜