Diff of /filter.h [0a87db] .. [8fbc76]  Maximize  Restore

  Switch to unified view

a/filter.h b/filter.h
...
...
42
42
43
#ifndef bzero
43
#ifndef bzero
44
    #define bzero(dest, len)   memset((dest), 0, (len))
44
    #define bzero(dest, len)   memset((dest), 0, (len))
45
#endif
45
#endif
46
46
47
48
//---------------------- Types ---------------------------------------------
49
50
#define UCHAR unsigned char
51
#define USHORT  unsigned short
52
#define ULONG   unsigned long
53
54
enum{
55
  _UCHAR,
56
  _USHORT,
57
  _ULONG
58
  };
59
47
60
//---------------------- Some useful math defines --------------------------
48
//---------------------- Some useful math defines --------------------------
61
49
62
#ifndef PI
50
#ifndef PI
63
        #define PI 3.14159265358979323846264338327950288
51
        #define PI 3.14159265358979323846264338327950288
...
...
659
void    SaveOptions         ( struct correct_Prefs * thePrefs );
647
void    SaveOptions         ( struct correct_Prefs * thePrefs );
660
int     LoadOptions         ( struct correct_Prefs * thePrefs );
648
int     LoadOptions         ( struct correct_Prefs * thePrefs );
661
void    FindScript          ( struct adjust_Prefs *thePrefs );
649
void    FindScript          ( struct adjust_Prefs *thePrefs );
662
char*   LoadScript          ( fullPath* scriptFile  );
650
char*   LoadScript          ( fullPath* scriptFile  );
663
int     WriteScript         ( char* res, fullPath* scriptFile, int launch );
651
int     WriteScript         ( char* res, fullPath* scriptFile, int launch );
652
// Write PSB and PSD files
664
int     writePSD         ( Image *im, fullPath* fname);          // On Mac: fname is FSSpec* 
653
int     writePS          ( Image *im, fullPath* fname, Boolean bBig );            // On Mac: fname is FSSpec* 
665
int     readPSD            ( Image *im, fullPath* fname, int mode);
654
int     writePSD          ( Image *im, fullPath* fname );
655
int   readPSD             ( Image *im, fullPath* fname, int mode); // Can handle both PSD and PSB
656
int   writePSwithLayer    ( Image *im, fullPath *fname, Boolean bBig);
657
int   writePSDwithLayer   ( Image *im, fullPath *fname);
658
int   addLayerToFile      ( Image *im, fullPath* sfile, fullPath* dfile, stBuf *sB); //works with PSD & PSB
659
int   readPSDMultiLayerImage( MultiLayerImage *mim, fullPath* sfile);
666
int     FindFile            ( fullPath *fname );
660
int     FindFile            ( fullPath *fname );
667
int     SaveFileAs          ( fullPath *fname, char *prompt, char *name );
661
int     SaveFileAs          ( fullPath *fname, char *prompt, char *name );
668
void    ConvFileName        ( fullPath *fname,char *string);
662
void    ConvFileName        ( fullPath *fname,char *string);
669
int   writePSDwithLayer   ( Image *im, fullPath *fname);
670
int   addLayerToFile      ( Image *im, fullPath* sfile, fullPath* dfile, stBuf *sB);
671
void    showScript          ( fullPath* scriptFile );
663
void    showScript          ( fullPath* scriptFile );
672
void    MakeTempName        ( fullPath *fspec, char *fname );
664
void    MakeTempName        ( fullPath *fspec, char *fname );
673
void    makePathForResult   ( fullPath *path );
665
void    makePathForResult   ( fullPath *path );
674
int     makePathToHost      ( fullPath *path );
666
int     makePathToHost      ( fullPath *path );
675
void    open_selection      ( fullPath *path );
667
void    open_selection      ( fullPath *path );
676
int   readPSDMultiLayerImage( MultiLayerImage *mim, fullPath* sfile);
677
int     GetFullPath         (fullPath *path, char *filename); // Somewhat confusing, for compatibility easons
668
int     GetFullPath         (fullPath *path, char *filename); // Somewhat confusing, for compatibility easons
678
int     StringtoFullPath    (fullPath *path, char *filename);
669
int     StringtoFullPath    (fullPath *path, char *filename);
679
int     IsTextFile          ( char* fname );
670
int     IsTextFile          ( char* fname );
680
int     readPositions       ( char* script, transformCoord *tP );
671
int     readPositions       ( char* script, transformCoord *tP );
681
int readJPEG            ( Image *im, fullPath *sfile );
672
int readJPEG            ( Image *im, fullPath *sfile );
...
...
740
void    SetInvMakeParams    ( struct fDesc *stack, struct MakeParams *mp, Image *im , Image *pn, int color );
731
void    SetInvMakeParams    ( struct fDesc *stack, struct MakeParams *mp, Image *im , Image *pn, int color );
741
// same as SetInvMakeParams but includes Joosts inverted changes to SetMakeParams
732
// same as SetInvMakeParams but includes Joosts inverted changes to SetMakeParams
742
void    SetInvMakeParamsCorrect( struct fDesc *stack, struct MakeParams *mp, Image *im , Image *pn, int color );
733
void    SetInvMakeParamsCorrect( struct fDesc *stack, struct MakeParams *mp, Image *im , Image *pn, int color );
743
734
744
void    GetControlPointCoordinates(int i, double *x, double *y, AlignInfo *gl );
735
void    GetControlPointCoordinates(int i, double *x, double *y, AlignInfo *gl );
745
void    ARGBtoRGBA(UCHAR* buf, int width, int bitsPerPixel);
736
void    ARGBtoRGBA(uint8_t* buf, int width, int bitsPerPixel);
746
void    RGBAtoARGB(UCHAR* buf, int width, int bitsPerPixel);
737
void    RGBAtoARGB(uint8_t* buf, int width, int bitsPerPixel);
747
int     CropImage(Image *im, PTRect *r);
738
int     CropImage(Image *im, PTRect *r);
748
void    DoColorCorrection( Image *im1, Image *im2, int mode );
739
void    DoColorCorrection( Image *im1, Image *im2, int mode );
749
740
750
// Script Reading/Parsing/Writing
741
// Script Reading/Parsing/Writing
751
742
...
...
950
941
951
942
952
// Endian stuff: Read and write numbers from and to memory (ptr)
943
// Endian stuff: Read and write numbers from and to memory (ptr)
953
944
954
#ifdef PT_BIGENDIAN
945
#ifdef PT_BIGENDIAN
946
#define   LONGLONGNUMBER( number, ptr )       *ptr++ = ((char*)(&number))[0]; \
947
                                                      *ptr++ = ((char*)(&number))[1]; \
948
                                                      *ptr++ = ((char*)(&number))[2]; \
949
                                                      *ptr++ = ((char*)(&number))[3]; \
950
                                                      *ptr++ = ((char*)(&number))[4]; \
951
                                                      *ptr++ = ((char*)(&number))[5]; \
952
                                                      *ptr++ = ((char*)(&number))[6]; \
953
                                                      *ptr++ = ((char*)(&number))[7]; 
954
955
  #define NUMBERLONGLONG( number, ptr )       ((char*)(&number))[0] = *ptr++; \
956
                                                      ((char*)(&number))[1] = *ptr++; \
957
                                                      ((char*)(&number))[2] = *ptr++; \
958
                                                      ((char*)(&number))[3] = *ptr++; \
959
                                                      ((char*)(&number))[4] = *ptr++; \
960
                                                      ((char*)(&number))[5] = *ptr++; \
961
                                                      ((char*)(&number))[6] = *ptr++; \
962
                                                      ((char*)(&number))[7] = *ptr++; 
963
955
  #define    LONGNUMBER( number, ptr )                   *ptr++ = ((char*)(&number))[0]; \
964
#define LONGNUMBER( number, ptr )                   *ptr++ = ((char*)(&number))[0]; \
956
                                                        *ptr++ = ((char*)(&number))[1]; \
965
                                                        *ptr++ = ((char*)(&number))[1]; \
957
                                                        *ptr++ = ((char*)(&number))[2]; \
966
                                                        *ptr++ = ((char*)(&number))[2]; \
958
                                                        *ptr++ = ((char*)(&number))[3]; 
967
                                                        *ptr++ = ((char*)(&number))[3]; 
959
968
960
    #define NUMBERLONG( number, ptr )                   ((char*)(&number))[0] = *ptr++; \
969
    #define NUMBERLONG( number, ptr )                   ((char*)(&number))[0] = *ptr++; \
...
...
967
976
968
    #define NUMBERSHORT( number, ptr )                  ((char*)(&number))[0] = *ptr++; \
977
    #define NUMBERSHORT( number, ptr )                  ((char*)(&number))[0] = *ptr++; \
969
                                                        ((char*)(&number))[1] = *ptr++; \
978
                                                        ((char*)(&number))[1] = *ptr++; \
970
979
971
#else
980
#else
981
  #define LONGLONGNUMBER( number, ptr )       *ptr++ = ((char*)(&number))[7]; \
982
                                                      *ptr++ = ((char*)(&number))[6]; \
983
                                                      *ptr++ = ((char*)(&number))[5]; \
984
                                                      *ptr++ = ((char*)(&number))[4]; \
985
                                                      *ptr++ = ((char*)(&number))[3]; \
986
                                                      *ptr++ = ((char*)(&number))[2]; \
987
                                                      *ptr++ = ((char*)(&number))[1]; \
988
                                                      *ptr++ = ((char*)(&number))[0]; 
989
990
  #define NUMBERLONGLONG( number, ptr )       ((char*)(&number))[7] = *ptr++; \
991
                                                      ((char*)(&number))[6] = *ptr++; \
992
                                                      ((char*)(&number))[5] = *ptr++; \
993
                                                      ((char*)(&number))[4] = *ptr++; \
994
                                                      ((char*)(&number))[3] = *ptr++; \
995
                                                      ((char*)(&number))[2] = *ptr++; \
996
                                                      ((char*)(&number))[1] = *ptr++; \
997
                                                      ((char*)(&number))[0] = *ptr++; 
998
972
    #define LONGNUMBER( number, ptr )                   *ptr++ = ((char*)(&number))[3]; \
999
    #define LONGNUMBER( number, ptr )                   *ptr++ = ((char*)(&number))[3]; \
973
                                                        *ptr++ = ((char*)(&number))[2]; \
1000
                                                        *ptr++ = ((char*)(&number))[2]; \
974
                                                        *ptr++ = ((char*)(&number))[1]; \
1001
                                                        *ptr++ = ((char*)(&number))[1]; \
975
                                                        *ptr++ = ((char*)(&number))[0]; 
1002
                                                        *ptr++ = ((char*)(&number))[0]; 
976
1003
977
    #define NUMBERLONG( number, ptr )                   ((char*)(&number))[3] = *ptr++; \
1004
    #define NUMBERLONG( number, ptr )                   ((char*)(&number))[3] = *ptr++; \
978
                                                        ((char*)(&number))[2] = *ptr++; \
1005
                                                        ((char*)(&number))[2] = *ptr++; \
979
                                                        ((char*)(&number))[1] = *ptr++; \
1006
                                                        ((char*)(&number))[1] = *ptr++; \
980
                                                        ((char*)(&number))[0] = *ptr++; 
1007
                                                        ((char*)(&number))[0] = *ptr++; 
981
1008
982
  #define    SHORTNUMBER( number, ptr )                  *ptr++ = ((char*)(&number))[1]; \
1009
#define SHORTNUMBER( number, ptr )                  *ptr++ = ((char*)(&number))[1]; \
983
                                                        *ptr++ = ((char*)(&number))[0]; \
1010
                                                        *ptr++ = ((char*)(&number))[0]; \
984
1011
985
    #define NUMBERSHORT( number, ptr )                  ((char*)(&number))[1] = *ptr++; \
1012
    #define NUMBERSHORT( number, ptr )                  ((char*)(&number))[1] = *ptr++; \
986
                                                        ((char*)(&number))[0] = *ptr++; \
1013
                                                        ((char*)(&number))[0] = *ptr++; \
987
1014
988
1015
989
1016
990
#endif // PT_BIGENDIAN
1017
#endif // PT_BIGENDIAN
991
1018
992
//TODO:  JMW These File i/o macros are to be replaced in code with the error catching functions below
1019
//TODO:  JMW These File i/o macros are to be replaced in code with the error catching functions below
1020
#if USEWRITEREADMACROS
993
#define WRITEUCHAR( theChar )       ch = theChar; count = 1; mywrite(fnum,count,&ch);
1021
#define WRITEUCHAR( theChar )       ch = theChar; count = 1; mywrite(fnum,count,&ch);
994
1022
995
#define WRITESHORT( theShort )      svar = theShort; d = data; SHORTNUMBER( svar, d ); \
1023
#define WRITESHORT( theShort )      svar = theShort; d = data; SHORTNUMBER( svar, d ); \
996
                                    count = 2; mywrite  (fnum,count,data);
1024
                                    count = 2; mywrite  (fnum,count,data);
997
1025
...
...
1000
1028
1001
#define READINT32( theLong )                count = 4; myread(src,count,data);  \
1029
#define READINT32( theLong )                count = 4; myread(src,count,data);  \
1002
                                            d = data; NUMBERLONG( var, d );     \
1030
                                            d = data; NUMBERLONG( var, d );     \
1003
                                            theLong = var;
1031
                                            theLong = var;
1004
                                    
1032
                                    
1033
#define WRITEINT64( theLong )       var64 = theLong; d = data; LONGLONGNUMBER( var64, d ); \
1034
                                    count = 8; mywrite  (fnum,count,data);
1035
1036
#define READINT64( theLong )                count = 8; myread(src,count,data);  \
1037
                                            d = data; NUMBERLONGLONG( var64, d );     \
1038
                                            theLong = var64;
1039
                                    
1005
#define READSHORT( theShort )               count = 2; myread(src,count,data);  \
1040
#define READSHORT( theShort )               count = 2; myread(src,count,data);  \
1006
                                            d = data; NUMBERSHORT( svar, d );   \
1041
                                            d = data; NUMBERSHORT( svar, d );   \
1007
                                            theShort = svar;
1042
                                            theShort = svar;
1008
1043
1009
#define READUCHAR( theChar )                count = 1; myread(src,count,&ch); theChar = ch; 
1044
#define READUCHAR( theChar )                count = 1; myread(src,count,&ch); theChar = ch; 
1010
1045
#endif
1011
// Cross platform file functions
1046
// Cross platform file functions
1012
1047
1013
#ifdef __Mac__
1048
#ifdef __Mac__
1014
1049
1015
    #include <Carbon/Carbon.h> // Kekus Digital<Files.h>
1050
    #include <Carbon/Carbon.h> // Kekus Digital<Files.h>
...
...
1057
    #endif
1092
    #endif
1058
1093
1059
#endif
1094
#endif
1060
1095
1061
/* ENDIAN aware file i/o funtions.  Used for reading and writing photoshop files */
1096
/* ENDIAN aware file i/o funtions.  Used for reading and writing photoshop files */
1062
Boolean panoWriteUCHAR(nfile_spec fnum, UCHAR   theChar );
1097
Boolean panoWriteUCHAR(file_spec fnum, uint8_t   theChar );
1063
Boolean panoWriteSHORT(nfile_spec fnum, USHORT  theShort );
1098
Boolean panoWriteSHORT(file_spec fnum, uint16_t  theShort );
1064
Boolean panoWriteINT32(nfile_spec fnum, ULONG   theLong );
1099
Boolean panoWriteINT32(file_spec fnum, uint32_t   theLong );
1100
Boolean panoWriteINT64(file_spec fnum, int64_t theLongLong );
1101
Boolean panoWriteINT32or64(file_spec fnum, int64_t theLongLong, Boolean bBig );
1065
Boolean panoReadUCHAR (nfile_spec fnum, UCHAR  *pChar );
1102
Boolean panoReadUCHAR (file_spec fnum, uint8_t  *pChar );
1066
Boolean panoReadSHORT (nfile_spec fnum, USHORT *pShort );
1103
Boolean panoReadSHORT (file_spec fnum, uint16_t *pShort );
1067
Boolean panoReadINT32 (nfile_spec fnum, ULONG  *pLong );
1104
Boolean panoReadINT32 (file_spec fnum, uint32_t  *pLong );
1068
    
1105
Boolean panoReadINT64 (file_spec fnum, int64_t  *pLongLong );
1106
Boolean panoReadINT32or64(file_spec fnum, int64_t  *pLongLong, Boolean bBig );
1107
1069
1108
1070
#define PANO_DEFAULT_PIXELS_PER_RESOLUTION  150.0
1109
#define PANO_DEFAULT_PIXELS_PER_RESOLUTION  150.0
1071
#define PANO_DEFAULT_TIFF_RESOLUTION_UNITS  RESUNIT_INCH
1110
#define PANO_DEFAULT_TIFF_RESOLUTION_UNITS  RESUNIT_INCH
1072
// this is the best compression available in all systems
1111
// this is the best compression available in all systems
1073
// better than PACKBITS
1112
// better than PACKBITS

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks