- 3
- 0
- 约1.01万字
- 约 10页
- 2016-11-28 发布于河南
- 举报
C打开图片
在TC2.0下,隶属于16位子系统,所以int是2字节,long是4字节,char是1字节。绘图系统模式是VGA,颜色当然也很有限,所以读取bmp像素后需要把像素颜色转换为“最近”的已有VGA颜色。用int GetColor(int r,int g,int b)实现返回一个颜色值(color code)。用putpixel(int x,int y,int color)绘制一个像素。
(读bmp处尚有问题,会有读取像素时未读出字节的问题出现,原因尚待查。。。。)
#include graphics.h
#include string.h
#include stdio.h
#include math.h
#include alloc.h
int MAX_Y=480;
int MAX_X=640;
int COLORS[15][4]=
{
/* Red Green Blue,code */
{ 0, 0, 0, 0}, /* Black */
{ 0, 0,255, 1}, /* Blue */
{ 0,128, 0, 2}, /* Green */
{ 0,
原创力文档

文档评论(0)