PHP图形处理函数试题
一.问答题
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图形处理函数试题的更多相关文章
- PHP数据库扩展mysqli的函数试题
1.mysqli链接数据库的方式是什么? 2.mysqli获取链接错误号的属性是什么? 3.mysqli获取链接错误信息的属性是什么? 4.mysqli执行sql语句的函数是什么? 5.mysqli获 ...
- PHP数组函数试题
使用Ctrl+A查看答案 1.将数组的键名全部转换成小写和大写的函数是什么?答:array_change_key_case($array [,CASE_LOWER|CASE_UPPER]) 2.创建一 ...
- PHP字符串函数试题
Ctrl+A查看答案 1.把ASCII字符的字符串转换为十六进制值的函数是什么?答:bin2hex($string),例如bin2hex('ab') = 6162 2.ASCII码转字符,字符转ASC ...
- PHP数学函数试题
1.求绝对值的函数是什么? 2.在任意进制之间转换数字的函数是什么? 3.二进制转换为十进制,十进制转换为二进制,十六进制转换为十进制,十进制转换为十六进制,八进制转换为十进制,十进制转换为八进制的函 ...
- C++的虚函数试题,常考!!
#include <iostream> #include <cstring> #include <string.h> #include <stdio.h> ...
- PHP之图形处理
图形处理 PHP 的图形处理,主要功能集中在 PHP 的图形处理函数. 需要先掌握一些要点.什么叫图片,怎么显示图片. 所谓的图片,其实也是一种文件,只是内容不是我们肉眼直接可见的.如果我们用记事本打 ...
- php提示Fatal error: Call to undefined function imagecreate()
在php中imagecreate函数是一个图形处理函数,主要用于新建一个基于调色板的图像了,然后在这个基础上我们可以创建一些图形数字字符之类的,但这个函数需要GD库支持,如果没有开启GD库使用时会 / ...
- 安装GD库解决ThinkPHP 验证码Call to undefined function Think\imagecreate()出错
在php中imagecreate函数是一个图形处理函数,主要用于新建一个基于调色板的图像了,然后在这个基础上我们可以创建一些图形数字字符之类的,但这个函数需要GD库支持,如果没有开启GD库使用时会提示 ...
- Android - Animation 贝塞尔曲线之美
概述 贝塞尔曲线于1962,由法国工程师皮埃尔·贝塞尔所广泛发表,他运用贝塞尔曲线来为汽车的主体进行设计.贝塞尔曲线最初由Paul de Casteljau于1959年运用de Casteljau演算 ...
随机推荐
- TortoiseGit 错误信息Aborting commit due to empty commit message.解决
错误信息: Aborting commit due to empty commit message. git不能完全退出(退出码 1) (47 ms @ 2016/2/19 14:03:24) 解决办 ...
- jdbc连接数据库的步骤
1.加载JDBC驱动程序: 在连接数据库之前,首先要加载想要连接的数据库的驱动到JVM(Java虚拟机), 这通过java.lang.Class类的静态方法forName(String classN ...
- String类之substring--->查找某位置对应的字
以下方法都是java内置类String类的内置方法(不是构造方法哦,就是普通的方法),不需要我们写,直接拿过来用即可. substring方法对应Api介绍 查找字符串中的 从int beginI ...
- 《JS权威指南学习总结--9.1 类和模板》
内容要点: 一.JS类 在JS中,类的所有实例对象都从同一个原型对象上继承属性.因此,原型对象是类的核心.在例6.1 原型中定义了inherit()函数(通过原型继承创建一个新对象),这个函数返回一个 ...
- 数学#素数判定Miller_Rabin+大数因数分解Pollard_rho算法 POJ 1811&2429
素数判定Miller_Rabin算法详解: http://blog.csdn.net/maxichu/article/details/45458569 大数因数分解Pollard_rho算法详解: h ...
- CentOS postgresql9.4
yum install http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-redhat94-9.4-1.noarch.rpm Once t ...
- osg + cuda
#include <osg/Notify> #include <osgViewer/Viewer> #include <osgCompute/Memory> #in ...
- 转Rollback后undo到底做了些什么?
转自:http://biancheng.dnbcw.info/oracle/309191.html Rollback后undo到底做了些什么? 从概念上讲,undo正好与redo相对.当你对数据执行修 ...
- Java判断PC端还是移动端
package com.*.*.*; import java.io.IOException;import java.util.regex.Matcher;import java.util.regex. ...
- Python字符串连接方式
python中有很多字符串连接方式,总结一下: 1 最原始的字符串连接方式:str1 + str22 python 新字符串连接语法:str1, str23 奇怪的字符串方式:str1 str24 % ...