87
89
Bitmap_Head.biClrUsed=0;
88
90
Bitmap_Head.biClrImp=0;
90
buff[0x00] = Bitmap_File_Head.zzMagic[0];
91
buff[0x01] = Bitmap_File_Head.zzMagic[1];
93
buff[0x02] = Bitmap_File_Head.bfSize;
94
buff[0x03] = Bitmap_File_Head.bfSize >> 8;
95
buff[0x04] = Bitmap_File_Head.bfSize >> 16;
96
buff[0x05] = Bitmap_File_Head.bfSize >> 24;
98
buff[0x06] = Bitmap_File_Head.zzHotX;
99
buff[0x07] = Bitmap_File_Head.zzHotX >> 8;
101
buff[0x08] = Bitmap_File_Head.zzHotY;
102
buff[0x09] = Bitmap_File_Head.zzHotY >> 8;
104
buff[0x0a] = Bitmap_File_Head.bfOffs;
105
buff[0x0b] = Bitmap_File_Head.bfOffs>> 8;
106
buff[0x0c] = Bitmap_File_Head.bfOffs>> 16;
107
buff[0x0d] = Bitmap_File_Head.bfOffs>> 24;
109
buff[0x0e] = Bitmap_File_Head.biSize;
110
buff[0x0f] = Bitmap_File_Head.biSize>> 8;
111
buff[0x10] = Bitmap_File_Head.biSize>> 16;
112
buff[0x11] = Bitmap_File_Head.biSize>> 24;
92
buff[0x00] = (unsigned char) (Bitmap_File_Head.zzMagic[0]);
93
buff[0x01] = (unsigned char) (Bitmap_File_Head.zzMagic[1]);
95
buff[0x02] = Bitmap_File_Head.bfSize);
96
buff[0x03] = Bitmap_File_Head.bfSize >> 8);
97
buff[0x04] = Bitmap_File_Head.bfSize >> 16);
98
buff[0x05] = Bitmap_File_Head.bfSize >> 24);
101
buff[0x02] = (unsigned char) (Bitmap_File_Head.bfSize);
102
buff[0x03] = (unsigned char) (Bitmap_File_Head.bfSize >> 8);
103
buff[0x04] = (unsigned char) (Bitmap_File_Head.bfSize >> 16);
104
buff[0x05] = (unsigned char) (Bitmap_File_Head.bfSize >> 24);
107
buff[0x06] = (unsigned char) (Bitmap_File_Head.zzHotX);
108
buff[0x07] = (unsigned char) (Bitmap_File_Head.zzHotX >> 8);
110
buff[0x08] = (unsigned char) (Bitmap_File_Head.zzHotY);
111
buff[0x09] = (unsigned char) (Bitmap_File_Head.zzHotY >> 8);
113
buff[0x0a] = (unsigned char) (Bitmap_File_Head.bfOffs);
114
buff[0x0b] = (unsigned char) (Bitmap_File_Head.bfOffs>> 8);
115
buff[0x0c] = (unsigned char) (Bitmap_File_Head.bfOffs>> 16);
116
buff[0x0d] = (unsigned char) (Bitmap_File_Head.bfOffs>> 24);
118
buff[0x0e] = (unsigned char) (Bitmap_File_Head.biSize);
119
buff[0x0f] = (unsigned char) (Bitmap_File_Head.biSize>> 8);
120
buff[0x10] = (unsigned char) (Bitmap_File_Head.biSize>> 16);
121
buff[0x11] = (unsigned char) (Bitmap_File_Head.biSize>> 24);
114
123
/* Write contents of Bitmap_Head_Struct */
116
buff[0x12] = Bitmap_Head.biWidth;
117
buff[0x13] = Bitmap_Head.biWidth>> 8;
118
buff[0x14] = Bitmap_Head.biWidth>> 16;
119
buff[0x15] = Bitmap_Head.biWidth>> 24;
121
buff[0x16] = Bitmap_Head.biHeight;
122
buff[0x17] = Bitmap_Head.biHeight>> 8;
123
buff[0x18] = Bitmap_Head.biHeight>> 16;
124
buff[0x19] = Bitmap_Head.biHeight>> 24;
126
buff[0x1a] = Bitmap_Head.biPlanes;
127
buff[0x1b] = Bitmap_Head.biPlanes>> 8;
129
buff[0x1c] = Bitmap_Head.biBitCnt;
130
buff[0x1d] = Bitmap_Head.biBitCnt>> 8;
132
buff[0x1e] = Bitmap_Head.biCompr;
133
buff[0x1f] = Bitmap_Head.biCompr>> 8;
134
buff[0x20] = Bitmap_Head.biCompr>> 16;
135
buff[0x21] = Bitmap_Head.biCompr>> 24;
137
buff[0x22] = Bitmap_Head.biSizeIm;
138
buff[0x23] = Bitmap_Head.biSizeIm>> 8;
139
buff[0x24] = Bitmap_Head.biSizeIm>> 16;
140
buff[0x25] = Bitmap_Head.biSizeIm>> 24;
142
buff[0x26] = Bitmap_Head.biXPels;
143
buff[0x27] = Bitmap_Head.biXPels>> 8;
144
buff[0x28] = Bitmap_Head.biXPels>> 16;
145
buff[0x29] = Bitmap_Head.biXPels>> 24;
147
buff[0x2a] = Bitmap_Head.biYPels;
148
buff[0x2b] = Bitmap_Head.biYPels>> 8;
149
buff[0x2c] = Bitmap_Head.biYPels>> 16;
150
buff[0x2d] = Bitmap_Head.biYPels>> 24;
152
buff[0x2e] = Bitmap_Head.biClrUsed;
153
buff[0x2f] = Bitmap_Head.biClrUsed>> 8;
154
buff[0x30] = Bitmap_Head.biClrUsed>> 16;
155
buff[0x31] = Bitmap_Head.biClrUsed>> 24;
157
buff[0x32] = Bitmap_Head.biClrImp;
158
buff[0x33] = Bitmap_Head.biClrImp>> 8;
159
buff[0x34] = Bitmap_Head.biClrImp>> 16;
160
buff[0x35] = Bitmap_Head.biClrImp>> 24;
162
fwrite((void *) buff, 0x36, 1, image_data_fp);
125
buff[0x12] = (unsigned char) (Bitmap_Head.biWidth);
126
buff[0x13] = (unsigned char) (Bitmap_Head.biWidth>> 8);
127
buff[0x14] = (unsigned char) (Bitmap_Head.biWidth>> 16);
128
buff[0x15] = (unsigned char) (Bitmap_Head.biWidth>> 24);
130
buff[0x16] = (unsigned char) (Bitmap_Head.biHeight);
131
buff[0x17] = (unsigned char) (Bitmap_Head.biHeight>> 8);
132
buff[0x18] = (unsigned char) (Bitmap_Head.biHeight>> 16);
133
buff[0x19] = (unsigned char) (Bitmap_Head.biHeight>> 24);
135
buff[0x1a] = (unsigned char) (Bitmap_Head.biPlanes);
136
buff[0x1b] = (unsigned char) (Bitmap_Head.biPlanes>> 8);
138
buff[0x1c] = (unsigned char) (Bitmap_Head.biBitCnt);
139
buff[0x1d] = (unsigned char) (Bitmap_Head.biBitCnt>> 8);
141
buff[0x1e] = (unsigned char) (Bitmap_Head.biCompr);
142
buff[0x1f] = (unsigned char) (Bitmap_Head.biCompr>> 8);
143
buff[0x20] = (unsigned char) (Bitmap_Head.biCompr>> 16);
144
buff[0x21] = (unsigned char) (Bitmap_Head.biCompr>> 24);
146
buff[0x22] = (unsigned char) (Bitmap_Head.biSizeIm);
147
buff[0x23] = (unsigned char) (Bitmap_Head.biSizeIm>> 8);
148
buff[0x24] = (unsigned char) (Bitmap_Head.biSizeIm>> 16);
149
buff[0x25] = (unsigned char) (Bitmap_Head.biSizeIm>> 24);
151
buff[0x26] = (unsigned char) (Bitmap_Head.biXPels);
152
buff[0x27] = (unsigned char) (Bitmap_Head.biXPels>> 8);
153
buff[0x28] = (unsigned char) (Bitmap_Head.biXPels>> 16);
154
buff[0x29] = (unsigned char) (Bitmap_Head.biXPels>> 24);
156
buff[0x2a] = (unsigned char) (Bitmap_Head.biYPels);
157
buff[0x2b] = (unsigned char) (Bitmap_Head.biYPels>> 8);
158
buff[0x2c] = (unsigned char) (Bitmap_Head.biYPels>> 16);
159
buff[0x2d] = (unsigned char) (Bitmap_Head.biYPels>> 24);
161
buff[0x2e] = (unsigned char) (Bitmap_Head.biClrUsed);
162
buff[0x2f] = (unsigned char) (Bitmap_Head.biClrUsed>> 8);
163
buff[0x30] = (unsigned char) (Bitmap_Head.biClrUsed>> 16);
164
buff[0x31] = (unsigned char) (Bitmap_Head.biClrUsed>> 24);
166
buff[0x32] = (unsigned char) (Bitmap_Head.biClrImp);
167
buff[0x33] = (unsigned char) (Bitmap_Head.biClrImp>> 8);
168
buff[0x34] = (unsigned char) (Bitmap_Head.biClrImp>> 16);
169
buff[0x35] = (unsigned char) (Bitmap_Head.biClrImp>> 24);
171
if( fwrite((void *) buff, 0x36, 1, image_data_fp) != 1)
172
exit_with_msg_and_exit_code("Error#1: Failed to write bitmap file in write_bitmap_out.c",WRITE_FAILURE);
164
175
/* Now the reader is written, finally write the image */
165
fwrite(byte_aligned_image_data,(size_t) sizeof_image,1,image_data_fp);
176
if( fwrite(byte_aligned_image_data,(size_t) sizeof_image,1,image_data_fp) != 1)
177
exit_with_msg_and_exit_code("Error#1: Failed to write bitmap file in write_bitmap_out.c",WRITE_FAILURE);
166
178
if( fclose(image_data_fp) != 0)
167
179
exit_with_msg_and_exit_code("failed to close file in write_bitmap_out.c",CANT_CLOSE_FILE);