00001
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef _GAN_IMAGE_IO_H
00030 #define _GAN_IMAGE_IO_H
00031
00032 #include <gandalf/image/image_defs.h>
00033 #include <gandalf/image/io/png_io.h>
00034 #include <gandalf/image/io/pbm_io.h>
00035 #include <gandalf/image/io/pgm_io.h>
00036 #include <gandalf/image/io/tiff_io.h>
00037 #include <gandalf/image/io/jpeg_io.h>
00038 #include <gandalf/image/io/dpx_io.h>
00039 #include <gandalf/image/io/cineon_io.h>
00040 #include <gandalf/image/io/sgi_io.h>
00041 #include <gandalf/image/io/targa_io.h>
00042
00043 #ifdef __cplusplus
00044 extern "C" {
00045 #endif
00046
00060 typedef enum
00061 {
00062 GAN_PNG_FORMAT,
00063 GAN_PBM_FORMAT,
00064 GAN_PGM_FORMAT,
00065 GAN_PPM_FORMAT,
00066 GAN_TIFF_FORMAT,
00067 GAN_JPEG_FORMAT,
00068 GAN_DPX_FORMAT,
00069 GAN_CINEON_FORMAT,
00070 GAN_SGI_FORMAT,
00071 GAN_TARGA_FORMAT,
00072 GAN_UNKNOWN_FORMAT
00073 } Gan_ImageFileFormat;
00074
00078 typedef struct Gan_ImageReadControlStruct
00079 {
00081 Gan_Bool header_only;
00082
00084 Gan_Bool flip;
00085
00087 Gan_Bool single_field;
00088
00090 Gan_Bool upper;
00091
00093 Gan_Bool whole_image;
00094 } Gan_ImageReadControlStruct;
00095
00099 typedef struct Gan_ImageHeaderInfo
00100 {
00102 gan_uint32 time_code;
00103
00105 gan_uint32 user_bits;
00106
00108 Gan_Bool interlaced;
00109
00111 gan_float32 frame_rate;
00112
00113 #ifdef HAVE_PNG
00114 Gan_PNGHeaderStruct png;
00115 #endif
00116 #ifdef HAVE_TIFF
00117 Gan_TIFFHeaderStruct tiff;
00118 #endif
00119 #ifdef HAVE_JPEG
00120 Gan_JPEGHeaderStruct jpeg;
00121 #endif
00122 Gan_DPXHeaderStruct dpx;
00123 Gan_CineonHeaderStruct cineon;
00124 Gan_SGIHeaderStruct sgi;
00125 Gan_TargaHeaderStruct targa;
00126 } Gan_ImageHeaderInfo;
00127
00131 typedef struct Gan_ImageHeaderStruct
00132 {
00133 Gan_ImageFileFormat file_format;
00134 unsigned int width;
00135 unsigned int height;
00136 Gan_ImageFormat format;
00137 Gan_Type type;
00138 Gan_ImageHeaderInfo info;
00139 } Gan_ImageHeaderStruct;
00140
00144 typedef struct Gan_ImageWriteControlStruct
00145 {
00147 Gan_Bool flip;
00148
00150 Gan_Bool single_field;
00151
00153 Gan_Bool upper;
00154
00156 Gan_Bool whole_image;
00157
00159 Gan_Bool reverse_bytes;
00160
00162 Gan_ImageHeaderInfo info;
00163 } Gan_ImageWriteControlStruct;
00164
00165 Gan_ImageFileFormat gan_image_determine_file_format_stream ( FILE *infile );
00166 Gan_ImageFileFormat gan_image_determine_file_format ( const char *filename );
00167 Gan_ImageFileFormat gan_image_interpret_format_string ( const char *format_string );
00168 const char *gan_image_file_format_string ( Gan_ImageFileFormat format );
00169 const char *gan_image_format_string ( Gan_ImageFormat format );
00170 Gan_Bool gan_image_file_format_compressed ( Gan_ImageFileFormat format );
00171 Gan_Bool gan_image_format_type_supported ( Gan_ImageFileFormat file_format, Gan_ImageFormat image_format, Gan_Type type,
00172 const Gan_ImageHeaderInfo* info );
00173 Gan_Bool gan_image_write_field_supported ( Gan_ImageFileFormat file_format );
00174 void gan_initialise_image_read_control_struct(Gan_ImageReadControlStruct *ictrlstr);
00175 Gan_Image *gan_image_read ( const char *filename, Gan_ImageFileFormat file_format, Gan_Image *image,
00176 const Gan_ImageReadControlStruct *ictrlstr, Gan_ImageHeaderStruct *header );
00177 Gan_Image *gan_image_read_stream ( FILE *infile, Gan_ImageFileFormat file_format, Gan_Image *image,
00178 const Gan_ImageReadControlStruct *ictrlstr, Gan_ImageHeaderStruct *header );
00179 Gan_Bool gan_initialise_image_header_info(Gan_ImageHeaderInfo *ohdrinfo, Gan_ImageFormat image_format, Gan_Type type);
00180 Gan_Bool gan_initialise_image_write_control_struct(Gan_ImageWriteControlStruct *octrlstr,
00181 Gan_ImageFileFormat file_format, Gan_ImageFormat image_format, Gan_Type type);
00182 Gan_Bool gan_image_write ( const char *filename, Gan_ImageFileFormat file_format, const Gan_Image *image,
00183 const Gan_ImageWriteControlStruct *octrlstr );
00184 Gan_Bool gan_image_write_stream ( FILE *outfile, Gan_ImageFileFormat file_format, const Gan_Image *image,
00185 Gan_Bool new_file, const Gan_ImageWriteControlStruct *octrlstr );
00186
00195 #ifdef __cplusplus
00196 }
00197 #endif
00198
00199 #endif