📄 main2.c
字号:
#include "GrTry.c"
int main()
{
INT16 fp;
INT16 i, j;
UINT32 Width, Height, Linebytes;
UINT8 Buffer[640];
InitSVGA(); /* 图形初始化开始 */
SetSVGAMode(TRY640X480X256); /* 实现图形模式 */
if ((fp = open("mnls.bmp", O_RDONLY|O_BINARY)) == -1)
{
printf("can't open the file!");
getch();
return 0;
}
lseek(fp, 18L, SEEK_SET); /* 读取文件宽高 */
read(fp, &Width, 4);
read(fp, &Height, 4);
if (Width%4) /* 拼凑4字节倍数 */
{
Linebytes = Width+(4-Width%4);
}
else
{
Linebytes = Width;
}
lseek(fp, 1078L, SEEK_SET); /* 开始读取图形数据 */
for (i = Height; i > -1; i--)
{
read(fp, Buffer, Linebytes);/* 一次读取一行 */
for (j = 0; j < Width; j++)
{
Dot(j, i, Buffer[j]);
}
}
close(fp);
getch();
ExitSVGA(); /* 恢复原始的模式 */
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -