METHODDEF(void)
init_destination(j_compress_ptr cinfo)
{
my_dest_ptr dest = (my_dest_ptr)cinfo->dest;
/* Allocate the output buffer --- it will be released when done with image */
dest->buffer = (JOCTET *)
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
OUTPUT_BUF_SIZE * sizeof(JOCTET));
/* Write any data remaining in the buffer */ if (datacount > 0) { if (fwrite(dest->buffer, 1, datacount, dest->outfile) != datacount)
ERREXIT(cinfo, JERR_FILE_WRITE);
}
fflush(dest->outfile); /* Make sure we wrote the output file OK */ if (ferror(dest->outfile))
ERREXIT(cinfo, JERR_FILE_WRITE);
}
METHODDEF(void)
term_mem_destination(j_compress_ptr cinfo)
{
my_mem_dest_ptr dest = (my_mem_dest_ptr)cinfo->dest;
/* The destination object is made permanent so that multiple JPEG images *canbewrittentothesamefilewithoutre-executingjpeg_stdio_dest.
*/ if (cinfo->dest == NULL) { /* first time for this JPEG object? */
cinfo->dest = (struct jpeg_destination_mgr *)
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT, sizeof(my_destination_mgr));
} elseif (cinfo->dest->init_destination != init_destination) { /* It is unsafe to reuse the existing destination manager unless it was *createdbythisfunction.Otherwise,thereisnoguaranteethatthe *opaquestructureistherightsize.Notethatwecouldjustcreatea *newstructure,buttheoldstructurewouldnotbefreeduntil *jpeg_destroy_compress()wascalled.
*/
ERREXIT(cinfo, JERR_BUFFER_SIZE);
}
/* The destination object is made permanent so that multiple JPEG images *canbewrittentothesamebufferwithoutre-executingjpeg_mem_dest.
*/ if (cinfo->dest == NULL) { /* first time for this JPEG object? */
cinfo->dest = (struct jpeg_destination_mgr *)
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT, sizeof(my_mem_destination_mgr));
} elseif (cinfo->dest->init_destination != init_mem_destination) { /* It is unsafe to reuse the existing destination manager unless it was *createdbythisfunction.
*/
ERREXIT(cinfo, JERR_BUFFER_SIZE);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.