bitmap.h

来自「RMI的处理器au1200系列所用的BOOTLOAD,包括SD卡启动USB启动硬」· C头文件 代码 · 共 60 行

H
60
字号
#ifndef BITMAP_H
#define BITMAP_H

#include <string>
#include <fstream>
#include <vector>

typedef signed char int8;
typedef signed short int16;
typedef signed int int32;
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;

#pragma pack(1)			//byte align structures

struct BMPFileHeader 
 {    
uint16 identifier;    
uint32 fileSize;    
uint32 reserved;    
uint32 dataOffset;    
uint32 headerSize;
};

struct BMPInfoHeader 
 {    
uint32 width;    
uint32 height;    
uint16 planes;    
uint16 bitsPerPixel;    
uint32 compression;    
uint32 bitmapDataSize;    
uint32 hresolution;    
uint32 vresolution;    
uint32 colors;    
uint32 importantColors;
};

struct Pixel 
 {    
char red;    
char green;    
char blue;
};


typedef std::vector < Pixel > BitmapRow;
typedef std::vector < BitmapRow > BitmapRows;

struct Bitmap 
 {    
BMPFileHeader fileHeader;    
BMPInfoHeader infoHeader;    
BitmapRows rows;
};

typedef std::vector < Bitmap > BitmapVector;

class BitmapConverter 
 {  
public:
int load(const std::string & dibPath);    
int save(const std::string & path, int colorDepth);  
private:
BitmapVector bitmaps_;    
void display_headers(const Bitmap & bitmap);    
int output_bitmap(std::ofstream & f_out, Bitmap & bitmap,		       int colorDepth);    
int convertColor(int color, int orig, int conv);    
int bytesPerPixel_;
};

#endif				/* 
 */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?