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演算 ...
随机推荐
- Monkey总结
Monkey是一个快速检查内存泄露的好工具,可以初步发现较明显的内存泄露问题. 什么是内存泄露?是指不在使用的对象持续占有内存,造成内存空间的浪费. 检查内存泄露的基本操作步骤: 1.运行Monkey ...
- mysql分页
1.查询第一行记录: select * from table limit 1 2.查询第n行到第m行记录 select * from table1 limit n-1,m-n; SELECT * FR ...
- POJ 3710 Christmas Game#经典图SG博弈
http://poj.org/problem?id=3710 (说实话对于Tarjan算法在搞图论的时候就没搞太懂,以后得找时间深入了解) (以下有关无向图删边游戏的资料来自论文贾志豪<组合游戏 ...
- Android LayoutInflater解析
在实际开发中LayoutInflater这个类还是非常有用的,它的作用类似于findViewById(). 不同点是LayoutInflater是用来找res/layout/下的xml布局文件,并且实 ...
- PHP中使用CURL(五)
curl伪造IP和来源 client.php请求server.php client.php <?php $ch = curl_init(); curl_setopt($ch, CURLOPT_U ...
- java中修饰符及其用法
1. java中的修饰符 a. 权限修饰符 private,默认的,protected,public b. 状态修饰符 static,final c. 抽象修饰符 abstract 2. 类修饰符 p ...
- 用CMD开启、关闭软件
关闭 (正常) taskkill /IM 1.100.exe 开启 : "路径"
- 利用PYTHON设计计算器功能
通过利用PYTHON 设计处理计算器的功能如: 1 - 2 * ( (60-30 +(-40/5) * (9-2*5/3 + 7 /3*99/4*2998 +10 * 568/14 ))- (-4*3 ...
- Just do it!!!
从今日起,开个开发自己个人轻量级博客,加油!!!!!
- javamail邮件发送
// 发送邮件 public static void send(String toEmail, String content) { Session session = getSession(); tr ...