標籤:
一.問答題
1.取得當前安裝的 GD 庫的資訊的函數是?
2.取得映像大小的函數是?
3.為一幅映像分配顏色 + alpha的函數是?
4.建立一個基於調色盤的映像的函數是?
5.建立一個黑色映像的函數是?
6.用給定角度旋轉映像的函數是?
7.水平地畫一行字串的函數是?
8.載入一新字型的函數是?
9.取得某像素的色彩索引值的函數是?
二.編程題
請畫出下列圖片
答案:
一.問答題
1.array gd_info ( void )
2.array getimagesize ( string $filename [, array &$imageinfo ] )
3.int imagecolorallocatealpha ( resource $image , int $red , int $green , int $blue , int $alpha )
第一次對 imagecolorallocatealpha() 的調用會給基於調色盤的映像填充背景色,即用 imagecreate() 建立的映像
4.resource imagecreate ( int $x_size , int $y_size )
5.resource imagecreatetruecolor ( int $width , int $height )
6.resource imagerotate ( resource $image , float $angle , int $bgd_color [, int$ignore_transparent = 0 ] )
7.bool imagestring ( resource $image , int $font , int $x , int $y , string $s , int $col )
如果 font 是 1,2,3,4 或 5,則使用內建字型
8.int imageloadfont ( string $file )
9.int imagecolorat ( resource $image , int $x , int $y )
二.編程題
圖一
<?php$image = imagecreatetruecolor(200, 200);// 分配一些顏色$white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);$gray = imagecolorallocate($image, 0xC0, 0xC0, 0xC0);$darkgray = imagecolorallocate($image, 0x90, 0x90, 0x90);$navy = imagecolorallocate($image, 0x00, 0x00, 0x80);$darknavy = imagecolorallocate($image, 0x00, 0x00, 0x50);$red = imagecolorallocate($image, 0xFF, 0x00, 0x00);$darkred = imagecolorallocate($image, 0x90, 0x00, 0x00);// 建立 3D 效果for ($i = 110; $i > 100; $i--) { imagefilledarc($image, 100, $i, 100, 50, 0, 45, $darknavy, IMG_ARC_PIE); imagefilledarc($image, 100, $i, 100, 50, 45, 75 , $darkgray, IMG_ARC_PIE); imagefilledarc($image, 100, $i, 100, 50, 75, 360 , $darkred, IMG_ARC_PIE);}imagefilledarc($image, 100, 100, 100, 50, 0, 45, $navy, IMG_ARC_PIE);imagefilledarc($image, 100, 100, 100, 50, 45, 75 , $gray, IMG_ARC_PIE);imagefilledarc($image, 100, 100, 100, 50, 75, 360 , $red, IMG_ARC_PIE);// 輸出映像header(‘Content-type: image/png‘);imagepng($image);imagedestroy($image);
PHP圖形處理函數試題