~ubuntu-branches/ubuntu/maverick/atlc/maverick

« back to all changes in this revision

Viewing changes to src/non_gui/write_bitmap_out.c

  • Committer: Bazaar Package Importer
  • Author(s): Bdale Garbee
  • Date: 2005-06-03 04:53:28 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050603045328-pohnuy5yryiv9s6o
Tags: 4.6.0-1
* new upstream version
* move make check from binary to build target so it doesn't run as root
* lose --with-threads from configure call, since it causes regression suite
  to fail many tests and upstream's README.threads is discouraging
* various tweaks to make lintian happier

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
19
19
USA.
20
20
 
21
 
Dr. David Kirkby, e-mail drkirkby@ntlworld.com 
 
21
Dr. David Kirkby, e-mail drkirkby at ntlworld.com 
22
22
 
23
23
*/
24
24
 
 
25
#include "config.h"
 
26
 
25
27
#ifdef HAVE_STRING_H
26
28
#include <string.h>
27
29
#endif
87
89
   Bitmap_Head.biClrUsed=0;
88
90
   Bitmap_Head.biClrImp=0;
89
91
 
90
 
   buff[0x00] = Bitmap_File_Head.zzMagic[0];
91
 
   buff[0x01] = Bitmap_File_Head.zzMagic[1];
92
 
 
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;
97
 
 
98
 
   buff[0x06] = Bitmap_File_Head.zzHotX;
99
 
   buff[0x07] = Bitmap_File_Head.zzHotX >> 8;
100
 
 
101
 
   buff[0x08] = Bitmap_File_Head.zzHotY;
102
 
   buff[0x09] = Bitmap_File_Head.zzHotY >> 8;
103
 
 
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;
108
 
 
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]);
 
94
/*
 
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);
 
99
   */
 
100
 
 
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);
 
105
 
 
106
 
 
107
   buff[0x06] = (unsigned char) (Bitmap_File_Head.zzHotX);
 
108
   buff[0x07] = (unsigned char) (Bitmap_File_Head.zzHotX >> 8);
 
109
 
 
110
   buff[0x08] = (unsigned char) (Bitmap_File_Head.zzHotY);
 
111
   buff[0x09] = (unsigned char) (Bitmap_File_Head.zzHotY >> 8);
 
112
 
 
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);
 
117
 
 
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);
113
122
 
114
123
   /* Write contents of Bitmap_Head_Struct */
115
124
 
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;
120
 
 
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;
125
 
 
126
 
   buff[0x1a] = Bitmap_Head.biPlanes;
127
 
   buff[0x1b] = Bitmap_Head.biPlanes>> 8;
128
 
 
129
 
   buff[0x1c] = Bitmap_Head.biBitCnt;
130
 
   buff[0x1d] = Bitmap_Head.biBitCnt>> 8;
131
 
 
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;
136
 
 
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;
141
 
 
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;
146
 
 
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;
151
 
 
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;
156
 
 
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;
161
 
 
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);
 
129
 
 
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);
 
134
 
 
135
   buff[0x1a] = (unsigned char) (Bitmap_Head.biPlanes);
 
136
   buff[0x1b] = (unsigned char) (Bitmap_Head.biPlanes>> 8);
 
137
 
 
138
   buff[0x1c] = (unsigned char) (Bitmap_Head.biBitCnt);
 
139
   buff[0x1d] = (unsigned char) (Bitmap_Head.biBitCnt>> 8);
 
140
 
 
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);
 
145
 
 
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);
 
150
 
 
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);
 
155
 
 
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);
 
160
 
 
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);
 
165
 
 
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);
 
170
 
 
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);
 
173
 
163
174
 
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);
168
180
}