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演算 ...
随机推荐
- 下载、安装jdk8(Windows下)并配置变量环境
一.官网下载地址:http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html 点击下图中的downloa ...
- 初学者必知的HTML规范
一.整体结构 用div代替table布局 结构.表现.行为三者分离,避免内联 良好的树形结构四个空格代替一个tab 能并列就不嵌套<div></div><div>& ...
- for循环---几种写法
最常见的写法 <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> < ...
- Vue.js 组件笔记
Vue 组件总结笔记 一. 创建组件 1. 使用组件三部曲 ( 创建, 注册, 使用 ) 2. 全局组件:Vue.component('tag', {}); 3. 局部组件: components 属 ...
- C#数组和元组
声明数组 int[] myArray; 初始化数组 myArray = new int[4]; 数组是引用类型当初始化完毕后,将在托管堆上分配内存空间,其结构图如下
- 7.hibernat实现双向一对多(多对一)
1.创建如下项目结构 2.在项目的src下创建hibernate.cfg.xml主配置文件 <?xml version="1.0" encoding="UTF-8& ...
- Logistic Regression:银行贷款申请审批实例
问题定义 这是一个贷款的审批问题,假设你是一个银行的贷款审批员,现在有客户需要一定额度的贷款,他们填写了个人的信息(信息在datas.txt中给出),你需要根据他们的信息,建立一个分类模型,判断是否可 ...
- [ An Ac a Day ^_^ ] CodeForces 525B Pasha and String 技巧
题意就是一次次翻转字符串 然后输出最终的字符串 暴力一发O(n*m)果然超时了 因为每次翻转的的都是a-1到对称位置 所以一个位置翻转两次等于没有操作 所以只需要记录一下len/2的位置前的操作次数 ...
- MySQL binlog 查看信息
1)按时间筛选 mysqlbinlog --start-datetime="2009-09-14 0:20:00" --stop-datetim="2009-09-15 ...
- 【CRC校验】学习笔记
#include<stdio.h> unsigned ]= { 0x01,0x02,0x03,0x04,0x05,0x06 }; ] = { 0x0000, 0x1021, 0x2042, ...