00001 #ifndef __PIC_H__
00002 #define __PIC_H__
00003
00004
00005
00006
00007
00008
00009 #include <stdlib.h>
00010 #include <stdio.h>
00011 #include <string.h>
00012 #include <limits.h>
00013 #include <assert.h>
00014
00015 #ifdef __cplusplus
00016 extern "C"{
00017 #endif
00018
00019
00020
00021
00022
00023
00024 typedef char PicChar;
00025 typedef short PicInt;
00026 typedef unsigned short PicUint;
00027 typedef float PicFloat;
00028 typedef void* PicPointer;
00029
00030
00031 extern char _pic_compile_time_size_check[ ( 1 == sizeof( PicChar ) ) ? 1 : -1 ];
00032 extern char _pic_compile_time_size_check[ ( 2 == sizeof( PicInt ) ) ? 1 : -1 ];
00033 extern char _pic_compile_time_size_check[ ( 2 == sizeof( PicUint ) ) ? 1 : -1 ];
00034 extern char _pic_compile_time_size_check[ ( 4 == sizeof( PicFloat ) ) ? 1 : -1 ];
00035 extern char _pic_compile_time_size_check[ ( 4 == sizeof( PicPointer ) ) ? 1 : -1 ];
00036
00037
00038 typedef struct tagPICFILEHEADER
00039 {
00040 PicInt imageWidth;
00041 PicInt imageHeight;
00042 PicInt numImages;
00043 PicInt ramp1min;
00044 PicInt ramp1max;
00045 PicPointer notes;
00046
00047 PicInt byteFormat;
00048 PicInt currentImage;
00049 PicChar fileName[32];
00050 PicInt merged;
00051 PicUint color1;
00052 PicUint fileID;
00053 PicInt ramp2min;
00054 PicInt ramp2max;
00055 PicUint color2;
00056 PicInt edited;
00057 PicInt lens;
00058 PicFloat magFactor;
00059 PicChar pad[6];
00060 }
00061 PICFILEHEADER;
00062
00063
00064 #define PIC_FILE_ID 12345
00065
00066
00067
00068
00069 #define PIC_RED_LUT 0x01
00070 #define PIC_GREEN_LUT 0x02
00071 #define PIC_BLUE_LUT 0x04
00072
00073
00074
00075 #define PIC_HEADER_SIZE 76
00076
00077 extern char _pic_compile_time_size_check
00078 [
00079 ( PIC_HEADER_SIZE ==
00080 sizeof( PicInt ) +
00081 sizeof( PicInt ) +
00082 sizeof( PicInt ) +
00083 sizeof( PicInt ) +
00084 sizeof( PicInt ) +
00085 sizeof( PicPointer ) +
00086 sizeof( PicInt ) +
00087 sizeof( PicInt ) +
00088 sizeof( PicChar )*32 +
00089 sizeof( PicInt ) +
00090 sizeof( PicUint ) +
00091 sizeof( PicUint ) +
00092 sizeof( PicInt ) +
00093 sizeof( PicInt ) +
00094 sizeof( PicUint ) +
00095 sizeof( PicInt ) +
00096 sizeof( PicInt ) +
00097 sizeof( PicFloat ) +
00098 sizeof( PicChar )*6
00099 )
00100 ? 1 : -1
00101 ];
00102
00103
00104 typedef struct tagPICFILENOTE
00105 {
00106 PicInt level;
00107 PicPointer next;
00108 PicInt number;
00109 PicInt status;
00110 PicUint type;
00111 PicInt x;
00112 PicInt y;
00113 PicChar text[80];
00114 }
00115 PICFILENOTE;
00116
00117
00118 #define PIC_NOTE_SIZE 96
00119
00120 extern char _pic_compile_time_size_check
00121 [
00122 ( PIC_NOTE_SIZE ==
00123 sizeof( PicInt ) +
00124 sizeof( PicPointer ) +
00125 sizeof( PicInt ) +
00126 sizeof( PicInt ) +
00127 sizeof( PicUint ) +
00128 sizeof( PicInt ) +
00129 sizeof( PicInt ) +
00130 sizeof( PicChar )*80
00131 )
00132 ? 1 : -1
00133 ];
00134
00135
00136 typedef enum
00137 {
00138 PIC_MERGE_OFF = 0,
00139 PIC_MERGE_16 = 1,
00140 PIC_MERGE_ALTERNATE = 2,
00141 PIC_MERGE_COLUMN = 3,
00142 PIC_MERGE_ROW = 4,
00143 PIC_MERGE_MAXIMUM = 5,
00144 PIC_MERGE_OPT12 = 6,
00145 PIC_MERGE_OPT12_V2 = 7
00146
00147
00148 }
00149 PIC_MERGE_TYPE;
00150
00151
00152 typedef enum
00153 {
00154 PIC_NOTE_TYPE_LIVE = 1,
00155 PIC_NOTE_TYPE_FILE1 = 2,
00156 PIC_NOTE_TYPE_NUMBER = 3,
00157 PIC_NOTE_TYPE_USER = 4,
00158 PIC_NOTE_TYPE_LINE = 5,
00159 PIC_NOTE_TYPE_COLLECT = 6,
00160 PIC_NOTE_TYPE_FILE2 = 7,
00161 PIC_NOTE_TYPE_SCALEBAR = 8,
00162 PIC_NOTE_TYPE_MERGE = 9,
00163 PIC_NOTE_TYPE_THRUVIEW = 10,
00164 PIC_NOTE_TYPE_ARROW = 11,
00165 PIC_NOTE_TYPE_VARIABLE = 20,
00166 PIC_NOTE_TYPE_STRUCTURE = 21
00167
00168 }
00169 PIC_NOTE_TYPE;
00170
00171
00172 typedef enum
00173 {
00174 PIC_NOTE_STATUS_ALL = 0x0100,
00175 PIC_NOTE_STATUS_DISPLAY = 0x0200,
00176 PIC_NOTE_STATUS_POSITION = 0x0400
00177 }
00178 PIC_NOTE_STATUS;
00179
00180
00181 #define PIC_AXIS_TYPE_D 1
00182 #define PIC_AXIS_TYPE_T 2
00183 #define PIC_AXIS_TYPE_A 3
00184 #define PIC_AXIS_TYPE_I 4
00185 #define PIC_AXIS_TYPE_M4 5
00186 #define PIC_AXIS_TYPE_R 6
00187 #define PIC_AXIS_TYPE_LR 7
00188 #define PIC_AXIS_TYPE_P 8
00189 #define PIC_AXIS_TYPE_C 9
00190 #define PIC_AXIS_TYPE_PHOTON 10
00191 #define PIC_AXIS_TYPE_RGB 11
00192 #define PIC_AXIS_TYPE_SEQ 12
00193 #define PIC_AXIS_TYPE_6D 13
00194
00195 #define PIC_AXIS_TYPE_TC 14
00196 #define PIC_AXIS_TYPE_S 15
00197
00198 #define PIC_AXIS_TYPE_LS 16
00199
00200 #define PIC_AXIS_TYPE_MASK 0xFF
00201 #define PIC_AXIS_TYPE_XY 0x100
00202 #define PIC_AXIS_TYPE_WORD 0x200
00203
00204
00205
00206 typedef enum
00207 {
00208 PIC_NO_ERROR,
00209 PIC_ERROR_OUT_OF_MEMORY,
00210 PIC_ERROR_FILE_OPEN,
00211 PIC_ERROR_FILE_READ,
00212 PIC_ERROR_FILE_WRITE,
00213 PIC_ERROR_MAX_SIZE,
00214 PIC_ERROR_UNSUPPORTED,
00215 PIC_ERROR_FILE_INVALID
00216 }
00217 PIC_ERROR_CODE;
00218
00219
00220
00221 typedef struct tagPICLUT
00222 {
00223 unsigned char rgb[256][3];
00224 }
00225 PICLUT;
00226
00227
00228 #define PIC_LUT_SIZE 768
00229
00230 extern char _pic_compile_time_size_check[ ( PIC_LUT_SIZE == sizeof( PICLUT ) ) ? 1 : -1 ];
00231
00232
00233 typedef struct tagPICFILE
00234 {
00235 PICFILEHEADER header;
00236 unsigned bitsPerChannel;
00237 unsigned numChannels;
00238 PICFILENOTE *notes;
00239 unsigned numNotes;
00240 void *pixels;
00241 PICLUT *luts;
00242 unsigned numLuts;
00243 }
00244 PICFILE;
00245
00246
00247 void ConstructPicFile( PICFILE *const pic );
00248
00249 void DestructPicFile( PICFILE *const pic );
00250
00251
00252 PIC_ERROR_CODE ReadPicFile( PICFILE *const pic, const char *const fileName );
00253
00254 PIC_ERROR_CODE WritePicFile( const PICFILE *const pic, const char *const fileName );
00255
00256
00257
00258 PIC_ERROR_CODE GetPicFileInfo( PICFILE *const pic, const char *const fileName );
00259
00260
00261 PIC_ERROR_CODE ReadPicFileAt( PICFILE *const pic, const char *const fileName, unsigned z );
00262
00263 #ifdef __cplusplus
00264 }
00265 #endif
00266
00267 #endif
00268