资源描述:
《用c语言读取并显示bmp图像1.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、个人收集整理勿做商业用途如何在WIN-TC中或TC++3.0中把一张BMP格式的图片显示出来?下面的是<<C& C++编程实例>>随书光盘上的代码,我在TC2.0下编译通过.它是利用了抖动技术显示了8bit和24bit的位图(也就是256色和16M色位图),应该能满足你的需要.不过,我想问下,你老师教过抖动显示吗? ﻫ#include#include<dos.h>ﻫ#include<stdio.h>#include <conio.h> ﻫﻫ#defineNoError 0 #defineErrorFileOpen1ﻫ#defineErrorFileType2
2、ﻫ#define ErrorImageColor3ﻫﻫtypedef structtagBITMAPFILEHEADER{ﻫunsignedint bfType;ﻫunsigned longbfSize;ﻫunsigned intbfReserved1; unsignedintbfReserved2;unsignedlong bfoffBits;}BITMAPFILEHEADER;ﻫtypedef structtagBITMAPINFOHEADER ﻫ{unsignedlongbiSize;unsignedlongbiWidth; unsignedlongbiHeight;ﻫ
3、unsigned int biPlanes;unsignedintbiBitCount;unsignedlongbiCompression;ﻫunsignedlongbiSizeImage;unsigned longbiXPelsPerMeter;ﻫunsignedlongbiYPelsPerMeter;unsignedlong biClrUsed;unsignedlongbiClrImportant;}BITMAPINFOHEADER;ﻫtypedefstructtagRGBQUADﻫ{ ﻫunsignedchar rgbBlue; unsignedchar rgbGree
4、n; unsigned charrgbRed; ﻫunsignedcharrgbReserved;ﻫ} RGBQUAD;ﻫunsignedcharPalReg[17]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0}; unsignedcharStandardPal[48]= {ﻫ0,0,0,32, 0, 0,0,32,0,32,32,0,0,0,32,32,0,32,0,32,32,32,32, 32,48,48,48, 63,0,0,0,63,0,63,63,0,0, 0,63,63, 0,63,0,63,63,63,63,63,}; ﻫ
5、unsignedcharLightnessMatrix[16][16]= {{0,235,59,219,15,231,55,215,2,232,56,217,12,229,52,213},ﻫ{128,64,187,123,143,79,183,119,130,66,184,120,140,76,180,116},{33,192,16,251,47,207,31,247,34,194,18,248,44,204,28,244},{161,97,144,80,175,111,159,95,162,98,146,82,172,108,156,92}, {8,225,48,208,5
6、,239,63,223,10,226,50,210,6,236,60,220},ﻫ{136,72,176,112,133,69,191,127,138,74,178,114,134,70,188,124}, ﻫ{41,200,24,240,36,197,20,255,42,202,26,242,38,198,22,252}, {169,105,152,88,164,100,148,84,170,106,154,90,166,102,150,86},ﻫ{3,233,57,216,13,228,53,212,1,234,58,218,14,230,54,214},ﻫ{131,67
7、,185,121,141,77,181,117,129,65,186,122,142,78,182,118},个人收集整理勿做商业用途{35,195,19,249,45,205,29,245,32,193,17,250,46,206,30,246},ﻫ{163,99,147,83,173,109,157,93,160,96,145,81,174,110,158,94},{11,227,51,211,7,237,61,221,9,224,49,209,4,238,62,222},{139,75,179,1