bmpFile(API)

From EosPedia
Jump to: navigation, search

DataManip/bmpFile is API for Bitmap file.

constant

typedef struct bmpFileHeader {
	char  bfType[2]; 		// BM
	unsigned int   bfSize;			// FileSize [Byte]	
	char  bfReserved1[2];	
	char  bfReserved2[2];	
	unsigned int   bfOffBits;		// ImageOffset [Byte]	
} bmpFileHeader; /* 14 BYTE */

struct

typedef struct bmpFileInfoHeader {
	unsigned int biSize;
	int	biWidth;  // [Pixel]
	int	biHeight; // [Pixel]
	unsigned short biPlanes;  // 1
	unsigned short biBitCount; // bits/pixel
	unsigned int biCompression;   
	unsigned int biSizeImage;
	int biXPixPerMeter;
	int biYPixPerMeter;
	unsigned int biCirUsed;
	unsigned int biCirImportant;
} bmpFileCoreHeader;
typedef struct bmpFileColorPalette {
	char rgbBlue;
	char rgbGreen;
	char rgbRed;
	char rgbReserved;
} bmpFileColorPalette;
typedef struct bmpFile {
	bmpFileHeader 		 Header;
	bmpFileCoreHeader 	 Info;
	bmpFileColorPalette* Palette ;
	unsigned char*  Image;
	unsigned char*  ColorImage;
	int Width;
	int Width4;
	int Height;
	int numPixel;
	int numPixel4; 
	int BytesPerPixel;
	int BitsPerPixel;
	int BytesPerImage;
} bmpFile;
typedef struct lbmp2mrcInfo {
	mrcImageParaTypeRealCoord Length;	
} lbmp2mrcInfo;

API

Read Bitmap

Read Bitmap fpt, and store to in.

extern void bmpFileRead(bmpFile* in, FILE* fpt, int mode);

Convert from Bitmap

Read Bitmap in, and covert to mrcImage file out.

extern void lbmp2mrc(mrcImage* out, bmpFile* in, lbmp2mrcInfo linfo, int mode);

Output Bitmap Information

Output the all Bitmap Information in to file fpt.

extern void bmpFileInfo(FILE* fpt, bmpFile* in, int mode);

Output the Bitmap Information(in->Header) to file fpt.

extern void bmpFileFileHeaderInfo(FILE* fpt, bmpFile* in, int mode);

Output the Bitmap Information(in->Info) to file fpt.

extern void bmpFileInfoHeaderInfo(FILE* fpt, bmpFile* in, int mode);

Output the Bitmap Palette Information in to file fpt.

extern void bmpFilePaletteInfo(FILE* fpt, bmpFile* in, int mode);