00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 #ifndef MICROSOFTBMPMONO_H
00042 #define MICROSOFTBMPMONO_H
00043
00044
00045 #include <stdio.h>
00046 #include <string.h>
00047
00048 #define IMAGE_DATA_OFFSET_M 62
00049 #define HEADER_SIZE_M 40
00050 #define NO_OF_IMAGE_PLANES_M 1
00051 #define BITS_PER_PIXEL_M 1
00052 #define COMPRESSION_METHOD_M 0
00053 #define SIZE_OF_BITMAP_M 0
00054 #define NO_COLOURS_USED_M 0
00055 #define NO_SIGNIFICANT_COLS_M 0
00056 #define PALETTE0_R 0
00057 #define PALETTE0_G 0
00058 #define PALETTE0_B 0
00059 #define PALETTE0_GREY 0
00060 #define PALETTE1_R 255
00061 #define PALETTE1_G 255
00062 #define PALETTE1_B 255
00063 #define PALETTE1_GREY 255
00064
00065 #define MAX_FILENAME_LEN 99
00066
00067 class MicrosoftMonoBMP_RT
00068 {
00069 public:
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089 unsigned int FileSize;
00090
00091
00092
00093 unsigned int ImageWidth;
00094 unsigned int ImageHeight;
00095 unsigned int HorizResolution;
00096 unsigned int VertResolution;
00097 unsigned char pallete_false_r;
00098 unsigned char pallete_false_g;
00099 unsigned char pallete_false_b;
00100 unsigned char pallete_false_grey;
00101 unsigned char pallete_true_r;
00102 unsigned char pallete_true_g;
00103 unsigned char pallete_true_b;
00104 unsigned char pallete_true_grey;
00105
00106
00107
00108 unsigned char type1;
00109 unsigned char type2;
00110 unsigned int reserved;
00111 unsigned int data_off;
00112 unsigned int head_size;
00113 unsigned int no_planes;
00114 unsigned int bits_per_pixel;
00115 unsigned int comp_method;
00116 unsigned int bitmap_size;
00117 unsigned int no_cols;
00118 unsigned int no_sig_cols;
00119
00120 private:
00121
00122
00123 char file_name[MAX_FILENAME_LEN+1];
00124 FILE *file_pnt;
00125 char *raw_data;
00126
00127 public:
00128
00129 MicrosoftMonoBMP_RT(const char *filename);
00130 ~MicrosoftMonoBMP_RT();
00131
00132 bool read();
00133 bool write();
00134 void extract_data(int *);
00135 void extract_data_grey(int *);
00136 void put_data(int *);
00137 void put_data_grey(int *);
00138 bool set_size(unsigned int, unsigned int);
00139 void set_filename(const char *);
00140
00141 private:
00142
00143 bool read_byte(unsigned char *);
00144 bool read_word(unsigned int *);
00145 bool read_dword(unsigned int *);
00146 bool write_byte(char);
00147 bool write_word(unsigned int);
00148 bool write_dword(unsigned int);
00149 bool allocate_storage();
00150 void calculate_filesize();
00151 bool check_header_valid();
00152 };
00153
00154 #endif