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演算 ...
随机推荐
- Intent的几种Flag的不同
冬天有点冷,不想写博客. 研究下Intent的几种Flag的不同: 1,FLAG_ACTIVITY_CLEAR_TOP:会清理掉目标activity栈上面所有的activity Intent inte ...
- How to solve java.net.SocketTimeoutException:60000millis problem in HDFS
Many HDFS users encounter the following error when DFSClient ready file from a certain Data Node. & ...
- React Redux学习笔记
React Router React Router 使用教程 Redux中间件middleware [译]深入浅出Redux中间件 Redux学习之一:何为middleware? ES6 ES6新特性 ...
- 使用PhotoShop
详细请看:http://blog.sina.com.cn/s/blog_73dc36510101ahim.html
- 实验吧Web-天网管理系统
笔记 == : 比较运算符号 不会检查条件式的表达式的类型 ===: 恒等计算符 , 同时检查表达式的值与类型.(会检查表达式类型,如bool) PHP序列化与反序列化serialize() 对输 ...
- PostgreSQL ----- No relations found.
本篇文章可能有错,尚未细细研究 运行\d出错: No relations found. \d只显示可见的表,也就是该数据库的schema在search_path中. SHOW search_path; ...
- php 异步
.post(handle,{username: username.val(),content: content.val()},function(data){ },'json');
- linux php安装
Linux下配置安装PHP环境 参考别人的做法,遇到问题上网查,下面就是安装步骤. 一.安装Apache2.2.221.到官网下载 http://httpd.apache.org/download. ...
- 搭建AVL树
#include<iostream> using namespace std; struct TreeNode { int height; //每一个结点都要保存自己的高度 int dat ...
- JavaScript加减计算方法和显示千分位
Math.formatFloat = function (f, digit) { var m = Math.pow(10, digit); return parseInt(f * m, 10) / m ...