19 #ifdef TARGA_SUPPORTED 27 #if BITS_IN_JSAMPLE != 8 28 Sorry,
this code only copes with 8-bit JSAMPLEs.
64 targaheader[5] = (char) (num_colors & 0xFF);
65 targaheader[6] = (char) (num_colors >> 8);
69 targaheader[12] = (char) (cinfo->output_width & 0xFF);
70 targaheader[13] = (char) (cinfo->output_width >> 8);
71 targaheader[14] = (char) (cinfo->output_height & 0xFF);
72 targaheader[15] = (char) (cinfo->output_height >> 8);
73 targaheader[17] = 0x20;
88 if (
JFWRITE(dinfo->output_file, targaheader, 18) != (size_t) 18)
89 ERREXIT(cinfo, JERR_FILE_WRITE);
105 register char * outptr;
108 inptr = dest->pub.buffer[0];
109 outptr = dest->iobuffer;
110 for (col = cinfo->output_width; col > 0; col--) {
114 inptr += 3, outptr += 3;
116 (
void)
JFWRITE(dest->pub.output_file, dest->iobuffer, dest->buffer_width);
126 register char * outptr;
129 inptr = dest->pub.buffer[0];
130 outptr = dest->iobuffer;
131 for (col = cinfo->output_width; col > 0; col--) {
134 (
void)
JFWRITE(dest->pub.output_file, dest->iobuffer, dest->buffer_width);
149 register char * outptr;
150 register JSAMPROW color_map0 = cinfo->colormap[0];
153 inptr = dest->pub.buffer[0];
154 outptr = dest->iobuffer;
155 for (col = cinfo->output_width; col > 0; col--) {
158 (
void)
JFWRITE(dest->pub.output_file, dest->iobuffer, dest->buffer_width);
177 if (cinfo->quantize_colors)
181 }
else if (cinfo->out_color_space ==
JCS_RGB) {
182 if (cinfo->quantize_colors) {
184 num_colors = cinfo->actual_number_of_colors;
185 if (num_colors > 256)
186 ERREXIT1(cinfo, JERR_TOO_MANY_COLORS, num_colors);
189 outfile = dest->pub.output_file;
190 for (
i = 0;
i < num_colors;
i++) {
201 ERREXIT(cinfo, JERR_TGA_COLORSPACE);
214 fflush(dinfo->output_file);
215 if (ferror(dinfo->output_file))
216 ERREXIT(cinfo, JERR_FILE_WRITE);
240 dest->buffer_width = cinfo->output_width * cinfo->output_components;
241 dest->iobuffer = (
char *)
243 (
size_t) (dest->buffer_width *
SIZEOF(
char)));
246 dest->pub.buffer = (*cinfo->mem->alloc_sarray)
248 dest->pub.buffer_height = 1;
put_gray_rows(j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, JDIMENSION rows_supplied)
struct jpeg_common_struct * j_common_ptr
#define GETJSAMPLE(value)
#define ERREXIT(cinfo, code)
typedef void(APIENTRY *GLDEBUGPROCARB)(GLenum source
#define JFWRITE(file, buf, sizeofbuf)
jpeg_calc_output_dimensions(j_decompress_ptr cinfo)
start_output_tga(j_decompress_ptr cinfo, djpeg_dest_ptr dinfo)
tga_dest_struct * tga_dest_ptr
put_pixel_rows(j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, JDIMENSION rows_supplied)
finish_output_tga(j_decompress_ptr cinfo, djpeg_dest_ptr dinfo)
#define ERREXIT1(cinfo, code, p1)
write_header(j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, int num_colors)
#define MEMZERO(target, size)
put_demapped_gray(j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, JDIMENSION rows_supplied)
jinit_write_targa(j_decompress_ptr cinfo)