📄 loadbmp.h~
字号:
/*************************************************** Copyright(C), 2008 , JUST File name: loadbmp.h Author: StevenZ Version: 1.0 Date: 08/09/06 Description: loadbmp.c的头文件 利用FrameBuffer做的图片载入和定点显示 ps:只能为24位色.bmp无压缩图片 ***************************************************/#ifndef _LOADBMP_H#define _LOADBMP_H#include <fcntl.h>#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <time.h>#include <sys/types.h>#include <sys/wait.h>#include <sys/stat.h>#include <string.h>#define BI_RGB 0#define BI_RLE8 1#define BI_RLE4 2#define BI_BITFIELDS 3#define TMS 0x07f0 //详见TMS.bmp#define FB_DEVICE "/dev/fb/0"typedef struct tagRGBQUAD{/*RGB结构体*/ char rgbBlue; char rgbGreen; char rgbRed; char rgbReserved;}RGBQUAD;typedef struct tagBITMAPINFOHEADER{/*Bitmap信息头结构体*/ int biSize; int biWidth; int biHeight; short biPlanes; short biBitCount; int biCompression; int biSizeImage; int biXPelsPerMeter; int biYPelsPerMeter; int biClrUsed; int biClrImportant;}BITMAPINFOHEADER;typedef struct tagBITMAPFILEHEADER{/*Bitmap文件头结构体*/ unsigned int bfType; int bfSize; unsigned int bfReserved1; unsigned int bfReserved2; int bfOffBits;}BITMAPFILEHEADER;typedef struct tagBITMAPINFO{/*Bitmap信息结构体*/ BITMAPINFOHEADER bmiHeader; RGBQUAD bmiColors[256];}BITMAPINFO;typedef struct _BITMAP{/*24bmp图结构体*/ char bmName[40];//原想用指针,手动分配内存,可惜出现意外的错误,残念 BITMAPFILEHEADER bmBF; BITMAPINFO bmBMI; }BITMAP;/*************************************************** Function: ShowBitmapInfo Description:打印显示位图信息 Input: pBitmap--指向位图的指针 Output: 无 Return:void***************************************************/void ShowBitmapInfo(BITMAP *pBitmap);/*************************************************** Function: ClearScreen Description:以某种颜色清除屏幕 Input: color--代表某种颜色(0:白色,255黑色),范围[0,255] Output:无 Return:void Others: 例子:ClearScreen(255);***************************************************/void ClearScreen(int color);/*************************************************** Function: ShowBitmap Description:在有FrameBuffer的linux上显示一张24位色无加密的位图 Input: fbx--位图坐上角的一点在LCD上的横坐标值,[0,639] fby--位图坐上角的一点在LCD上的纵坐标值,[0,479] file_name--位图的路径及文件名 Output:无 Return:返回0表正确,其他均错误 Other: 例子:ShowBitmap(0,0,"./res/point.bmp");***************************************************/int ShowBitmap(int fbx,int fby,char *file_name);/*************************************************** Function: ClearBitmap Description:在背景位图bgbmp上清除位图file_name Input: fbx--需清除的位图坐上角的一点在LCD上的横坐标值,[0,639] fby--需清除的位图坐上角的一点在LCD上的纵坐标值,[0,479] bgbmp--背景位图的路径及文件名 file_name--需清除的位图路径及文件名 Output:无 Return:void Other: 例子:ClearBitmap(0,0,"./res/bg.bmp","./res/flower.bmp");***************************************************/void ClearBitmap(int fbx,int fby,char *bgbmp,char *file_name);/*************************************************** Function: ShowBitmapWithTS Description:以触摸屏返回的坐标值经转换使位图显示在LCD上 Input: touch_x--触摸屏返回的横坐标值 touch_y--触摸屏返回的纵坐标值 file_name--位图路径及文件名 Output:无 Return:返回0表正确,其他均错误 Other: 例子:ShowBitmapWithTS(0,0,"./res/point.bmp");***************************************************/int ShowBitmapWithTS(int touch_x,int touch_y,char *filename);#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -