?? imgbmpprocess.h
字號:
/*
* Filename: ImgReadBMP.h
*
* Read bmp file using standard C.
*
* Author: gomo
* Date: 2007-05-16
*/
#ifndef __ImgReadBMP_H
#define __ImgReadBMP_H
#include "dh_def.h"
#define DIB_HEADER_MARKER ((short int) ('M' << 8) | 'B')
struct _BmpFileHeader
{
short int bfType; //Specifies the file type. It must be BM
int bfSize; //Specifies the size, in bytes, of the bitmap file
short int bfReserved1; //Reserved; must be zero
short int bfReserved2; //Reserved; must be zero
int bfOffBits; //Specifies the offset, in bytes, from the BITMAPFILEHEADER structure to the bitmap bits
}__attribute__((packed,aligned(2)));
typedef struct _BmpFileHeader BmpFileHeader;
struct _BmpInfoHeader
{
long int biSize; //Specifies the number of bytes required by the structure.
long int biWidth; //biWidth Specifies the width of the bitmap.
long int biHeight; //Specifies the height of the bitmap, in pixels.
short int biPlanes; //Specifies the number of planes for the target device. This value must be set to 1.
short int biBitCount ; //Specifies the number of bits per pixel,such as 1,4,8,24 .
long int biCompression;//Specifies the type of compression for a compressed bottom-up bitmap
//(top-down DIBs cannot be compressed). This member can be one of the
//following values: BI_RGB,BI_RLE8,BI_RLE4,BI_BITFIELDS,BI_JPEG.
long int biSizeImage; //Specifies the size, in bytes, of the image. This may be set to zero for BI_RGB bitmaps.
long int biXPelsPerMeter;//Specifies the horizontal resolution, in pixels per meter, of the target device for the
//bitmap. An application can use this value to select a bitmap from a resource
//group that best matches the characteristics of the current device.
long int biYPelsPerMeter;//Specifies the vertical resolution, in pixels per meter, of the target device for the bitmap.
long int biClrUsed; //Specifies the number of color indexes in the color table that are actually used by the bitmap.
//If this value is zero, the bitmap uses the maximum number of colors corresponding
//to the value of the biBitCount member for the compression mode specified by biCompression.
long int biClrImportant; //Specifies the number of color indexes that are required for displaying the bitmap. If this value is zero,
//all colors are required.
}__attribute__((packed,aligned(2)));
typedef struct _BmpInfoHeader BmpInfoHeader;
struct _RGBQuad
{
unsigned char rgbBlue; //Specifies the intensity of blue in the color.
unsigned char rgbGreen; //Specifies the intensity of green in the color.
unsigned char rgbRed; //Specifies the intensity of red in the color.
unsigned char rgbReserved; //Reserved; must be zero.
}__attribute__((packed,aligned(2)));
typedef struct _RGBQuad RGBQuad;
/*
* This function DhReadBMPImg read bmp file information.
*
* Parameters:
* char *FileName: Input bmp file name;
* BmpFileHeader *BmpFH:Save bmp file herder;
* BmpInfoHeader *BmpIH:Save bmp file Information herder;
*
*
* Return value:
* 0: Success;
* -1: File cannot open;
* -2: Alloc memory failed;
* -3: Read bmp file header failed;
* -4: The format of file is not bmp;
* -5: Read bmp file information header failed;
* -6: Bits count invalid.
* -7: Bmp file offset is wrong.
*/
int
DhReadBMPImgInfo(
IN char *pFileName,
OUT BmpFileHeader *pBmpFH,
OUT BmpInfoHeader *pBmpIH
);
/*
* RGB2BGR
*
* Convert 24bits RGB data to 24bits BGR data
*/
int
RGB2BGR(
INOUT unsigned char *pBbuf,
IN int iWidthPix,
IN int iHeightPix
);
/*
* BGR2RGB
*
* Convert 24bits BGR data to 24bits RGB data
*/
int
BGR2RGB(
INOUT unsigned char *pBbuf,
IN int iWidthPix,
IN int iHeightPix
);
/*
* Convert reading BMP file data to normal order, Including BMP 8bits and BMP24bits.
*
* Parameters:
*
* iBuffer: BMP image file data buffer;
* iWidth: image width;
* iHeight: image height;
* iBits: bitscount, such as 8,24
*
*/
int
BMPBufBottomToUp(
INOUT unsigned char*pBuffer,
IN int iWidth,
IN int iHeight,
IN int iBits
);
#endif //end __ImgReadBMP_H
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -