?? 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 + -