31#if BITS_IN_JSAMPLE != 8
32 Sorry,
this code only copes with 8-bit JSAMPLEs.
57typedef bmp_dest_struct * bmp_dest_ptr;
61LOCAL(
void) write_colormap
63 int map_colors,
int map_entry_size));
76 bmp_dest_ptr
dest = (bmp_dest_ptr) dinfo;
82 outptr = * (*cinfo->mem->access_virt_sarray) ((
j_common_ptr) cinfo,
84 dest->cur_output_row++;
89 inptr =
dest->pub.buffer[0];
98 pad =
dest->pad_bytes;
108 bmp_dest_ptr
dest = (bmp_dest_ptr) dinfo;
114 outptr = * (*cinfo->mem->access_virt_sarray) ((
j_common_ptr) cinfo,
116 dest->cur_output_row++;
119 inptr =
dest->pub.buffer[0];
121 *outptr++ = *inptr++;
125 pad =
dest->pad_bytes;
155 char bmpfileheader[14];
156 char bmpinfoheader[40];
157#define PUT_2B(array, offset, value) \
158 (array[offset] = (char) ((value) & 0xFF), \
159 array[offset+1] = (char) (((value) >> 8) & 0xFF))
160#define PUT_4B(array, offset, value) \
161 (array[offset] = (char) ((value) & 0xFF), \
162 array[offset+1] = (char) (((value) >> 8) & 0xFF), \
163 array[offset+2] = (char) (((value) >> 16) & 0xFF), \
164 array[offset+3] = (char) (((value) >> 24) & 0xFF))
165 INT32 headersize, bfSize;
166 int bits_per_pixel, cmap_entries;
185 headersize = 14 + 40 + cmap_entries * 4;
193 bmpfileheader[0] = 0x42;
194 bmpfileheader[1] = 0x4D;
195 PUT_4B(bmpfileheader, 2, bfSize);
197 PUT_4B(bmpfileheader, 10, headersize);
200 PUT_2B(bmpinfoheader, 0, 40);
203 PUT_2B(bmpinfoheader, 12, 1);
204 PUT_2B(bmpinfoheader, 14, bits_per_pixel);
211 PUT_2B(bmpinfoheader, 32, cmap_entries);
214 if (
JFWRITE(
dest->pub.output_file, bmpfileheader, 14) != (
size_t) 14)
215 ERREXIT(cinfo, JERR_FILE_WRITE);
216 if (
JFWRITE(
dest->pub.output_file, bmpinfoheader, 40) != (
size_t) 40)
217 ERREXIT(cinfo, JERR_FILE_WRITE);
219 if (cmap_entries > 0)
220 write_colormap(cinfo,
dest, cmap_entries, 4);
228 char bmpfileheader[14];
229 char bmpcoreheader[12];
230 INT32 headersize, bfSize;
231 int bits_per_pixel, cmap_entries;
250 headersize = 14 + 12 + cmap_entries * 3;
258 bmpfileheader[0] = 0x42;
259 bmpfileheader[1] = 0x4D;
260 PUT_4B(bmpfileheader, 2, bfSize);
262 PUT_4B(bmpfileheader, 10, headersize);
265 PUT_2B(bmpcoreheader, 0, 12);
268 PUT_2B(bmpcoreheader, 8, 1);
269 PUT_2B(bmpcoreheader, 10, bits_per_pixel);
271 if (
JFWRITE(
dest->pub.output_file, bmpfileheader, 14) != (
size_t) 14)
272 ERREXIT(cinfo, JERR_FILE_WRITE);
273 if (
JFWRITE(
dest->pub.output_file, bmpcoreheader, 12) != (
size_t) 12)
274 ERREXIT(cinfo, JERR_FILE_WRITE);
276 if (cmap_entries > 0)
277 write_colormap(cinfo,
dest, cmap_entries, 3);
288 int map_colors,
int map_entry_size)
295 if (colormap !=
NULL) {
298 for (
i = 0;
i < num_colors;
i++) {
302 if (map_entry_size == 4)
307 for (
i = 0;
i < num_colors;
i++) {
311 if (map_entry_size == 4)
317 for (
i = 0;
i < 256;
i++) {
321 if (map_entry_size == 4)
327 ERREXIT1(cinfo, JERR_TOO_MANY_COLORS,
i);
328 for (;
i < map_colors;
i++) {
332 if (map_entry_size == 4)
341 bmp_dest_ptr
dest = (bmp_dest_ptr) dinfo;
350 write_os2_header(cinfo,
dest);
352 write_bmp_header(cinfo,
dest);
361 data_ptr = * (*cinfo->mem->access_virt_sarray) ((
j_common_ptr) cinfo,
363 for (col =
dest->row_width; col > 0; col--) {
374 ERREXIT(cinfo, JERR_FILE_WRITE);
389 dest = (bmp_dest_ptr) (*cinfo->mem->alloc_small)
391 dest->pub.start_output = start_output_bmp;
392 dest->pub.finish_output = finish_output_bmp;
397 dest->pub.put_pixel_rows = put_gray_rows;
401 dest->pub.put_pixel_rows = put_gray_rows;
403 dest->pub.put_pixel_rows = put_pixel_rows;
406 ERREXIT(cinfo, JERR_BMP_COLORSPACE);
414 dest->data_width = row_width;
415 while ((row_width & 3) != 0) row_width++;
416 dest->row_width = row_width;
417 dest->pad_bytes = (
int) (row_width -
dest->data_width);
420 dest->whole_image = (*cinfo->mem->request_virt_sarray)
423 dest->cur_output_row = 0;
424 if (cinfo->progress !=
NULL) {
430 dest->pub.buffer = (*cinfo->mem->alloc_sarray)
432 dest->pub.buffer_height = 1;
struct cdjpeg_progress_mgr * cd_progress_ptr
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
_Check_return_opt_ _CRTIMP int __cdecl putc(_In_ int _Ch, _Inout_ FILE *_File)
jpeg_calc_output_dimensions(j_decompress_ptr cinfo)
#define ERREXIT1(cinfo, code, p1)
#define JFWRITE(file, buf, sizeofbuf)
#define GETJSAMPLE(value)
struct jpeg_common_struct * j_common_ptr
struct jpeg_progress_mgr pub
int completed_extra_passes
J_COLOR_SPACE out_color_space
int actual_number_of_colors
#define MEMZERO(addr, type, size)