00001
00002 #ifndef __JBXL_JPEG_TOOL_H_
00003 #define __JBXL_JPEG_TOOL_H_
00004
00005
00006 #include "xtools.h"
00007
00008 #ifndef HAVE_JPEGLIB_H
00009 #ifndef DISABLE_JPEGLIB
00010 #define DISABLE_JPEGLIB
00011 #endif
00012 #endif
00013
00014 #ifdef DISABLE_JPEGLIB
00015 #undef ENABLE_JPEGLIB
00016 #endif
00017
00018
00019 #ifdef ENABLE_JPEGLIB
00020
00034 #include "gdata.h"
00035 #include <jpeglib.h>
00036
00037
00038 typedef struct
00039 {
00040 int xs;
00041 int ys;
00042 int col;
00043 int state;
00044 JSAMPLE* gp;
00045 JSAMPARRAY img;
00046
00047 } JPEGImage;
00048
00049
00050
00051 #if JPEG_LIB_VERSION < 80
00052
00053 typedef struct {
00054 struct jpeg_destination_mgr pub;
00055
00056 unsigned char** outbuffer;
00057 unsigned long* outsize;
00058 unsigned char* newbuffer;
00059 JOCTET * buffer;
00060 size_t bufsize;
00061 } my_mem_destination_mgr;
00062
00063 typedef my_mem_destination_mgr * my_mem_dest_ptr;
00064
00065 #endif
00066
00067
00069
00070 JPEGImage read_jpeg_file (const char* fname);
00071 int write_jpeg_file(const char* fname, JPEGImage jp, int qulty);
00072 int write_jpeg_mem(unsigned char** buf, unsigned long* len, JPEGImage jp, int qulty);
00073
00074 WSGraph JPEGImage2WSGraph(JPEGImage jp);
00075 BSGraph JPEGImage2BSGraph(JPEGImage jp);
00076 JPEGImage WSGraph2JPEGImage(WSGraph vp);
00077 JPEGImage BSGraph2JPEGImage(BSGraph vp);
00078
00079 JPEGImage make_JPEGImage(int xs, int ys, int col);
00080 void free_JPEGImage(JPEGImage* jp);
00081
00082
00083
00084 #if JPEG_LIB_VERSION < 80
00085
00086 METHODDEF(void) mem_init_destination(j_compress_ptr cinfo);
00087 METHODDEF(boolean) mem_empty_output_buffer(j_compress_ptr cinfo);
00088 METHODDEF(void) mem_term_destination(j_compress_ptr cinfo);
00089 GLOBAL(void) jpeg_mem_dest(j_compress_ptr cinfo, unsigned char** buf, unsigned long* len);
00090
00091 #endif
00092
00093
00094 #endif // DISABLE_JPEGLIB
00095
00096 #endif // __JBXL_JPEG_TOOL_H_
00097
00098