Diff of /file.c [3af83f] .. [15dc8a]  Maximize  Restore

Switch to unified view

a/file.c b/file.c
...
...
64
static int              writeChannelData        ( Image *im, file_spec fnum, int channel, PTRect *r );
64
static int              writeChannelData        ( Image *im, file_spec fnum, int channel, PTRect *r );
65
static int              writeLayerAndMask       ( Image *im, file_spec fnum );
65
static int              writeLayerAndMask       ( Image *im, file_spec fnum );
66
static void             getImageRectangle       ( Image *im, PTRect *r );
66
static void             getImageRectangle       ( Image *im, PTRect *r );
67
static int              fileCopy                ( file_spec src, file_spec dest, size_t numBytes, unsigned char *buf);
67
static int              fileCopy                ( file_spec src, file_spec dest, size_t numBytes, unsigned char *buf);
68
static void             orAlpha                 ( unsigned char* alpha, unsigned char *buf, Image *im, PTRect *r );
68
static void             orAlpha                 ( unsigned char* alpha, unsigned char *buf, Image *im, PTRect *r );
69
static void             writeWhiteBackground    ( pt_int32 width, pt_int32 height, file_spec fnum );
69
static void             writeWhiteBackground    ( uint32_t width, uint32_t height, file_spec fnum );
70
static int              addLayer                ( Image *im, file_spec src, file_spec fnum , stBuf *sB);
70
static int              addLayer                ( Image *im, file_spec src, file_spec fnum , stBuf *sB);
71
static int              hasFeather              ( Image *im );
71
static int              hasFeather              ( Image *im );
72
static int              writeTransparentAlpha   ( Image *im, file_spec fnum, PTRect *theRect );
72
static int              writeTransparentAlpha   ( Image *im, file_spec fnum, PTRect *theRect );
73
73
74
74
...
...
116
116
117
117
118
118
119
#define PSDHLENGTH 26
119
#define PSDHLENGTH 26
120
120
121
int panoPSDResourceWrite(file_spec fnum, pt_uint16 resource, pt_uint16 len, pt_uint16 dataLen, char *resourceData)
121
int panoPSDResourceWrite(file_spec fnum, uint16_t resource, uint16_t len, uint16_t dataLen, char *resourceData)
122
{
122
{
123
//struct _ColorModeDataBlock
123
//struct _ColorModeDataBlock
124
//{
124
//{
125
//    BYTE Type[4];  /* Always "8BIM" */
125
//    BYTE Type[4];  /* Always "8BIM" */
126
//    WORD ID;       /* (See table below) */
126
//    WORD ID;       /* (See table below) */
...
...
132
  int rtn = 0;
132
  int rtn = 0;
133
  unsigned char  ch;
133
  unsigned char  ch;
134
  size_t  count;
134
  size_t  count;
135
  short   svar;
135
  short   svar;
136
  char    data[12], *d;
136
  char    data[12], *d;
137
  pt_uint32   var;
137
  uint32_t   var;
138
  WRITEUCHAR( '8' );
138
  WRITEUCHAR( '8' );
139
  rtn += count;
139
  rtn += count;
140
  WRITEUCHAR( 'B' );
140
  WRITEUCHAR( 'B' );
141
  rtn += count;
141
  rtn += count;
142
  WRITEUCHAR( 'I' );
142
  WRITEUCHAR( 'I' );
...
...
157
  }
157
  }
158
158
159
  return rtn;
159
  return rtn;
160
}
160
}
161
161
162
int panoPSDPICTResourceWrite(file_spec fnum, unsigned char resource, unsigned char record, pt_uint16 len, char *recordData)
162
int panoPSDPICTResourceWrite(file_spec fnum, unsigned char resource, unsigned char record, uint16_t len, char *recordData)
163
{
163
{
164
  // See IPTC Information Intercharge Model Exchange Version 4.
164
  // See IPTC Information Intercharge Model Exchange Version 4.
165
  int rtn = 0;
165
  int rtn = 0;
166
  unsigned char  ch;
166
  unsigned char  ch;
167
  size_t  count;
167
  size_t  count;
...
...
203
{
203
{
204
  int     rtn = 0;
204
  int     rtn = 0;
205
  char    data[12], *d;
205
  char    data[12], *d;
206
  short   svar = 0;
206
  short   svar = 0;
207
  size_t  count;
207
  size_t  count;
208
  pt_uint32   var;
208
  uint32_t   var;
209
  int saveLocation = 0;
209
  int saveLocation = 0;
210
  int saveLocationForSize=0;
210
  int saveLocationForSize=0;
211
  int temp;
211
  int temp;
212
212
213
213
...
...
296
{
296
{
297
    file_spec   fnum;
297
    file_spec   fnum;
298
    char    data[12], *d;
298
    char    data[12], *d;
299
    short   svar;
299
    short   svar;
300
    size_t  count;
300
    size_t  count;
301
    pt_uint32   var;
301
    uint32_t   var;
302
    unsigned char  ch;
302
    unsigned char  ch;
303
    int     channels, BitsPerChannel;
303
    int     channels, BitsPerChannel;
304
    
304
    
305
    GetChannels( im, channels );
305
    GetChannels( im, channels );
306
    GetBitsPerChannel( im, BitsPerChannel );
306
    GetBitsPerChannel( im, BitsPerChannel );
...
...
369
int writePSDwithLayer(Image *im, char *sfile )
369
int writePSDwithLayer(Image *im, char *sfile )
370
{
370
{
371
    file_spec   fnum;
371
    file_spec   fnum;
372
    char        data[12], *d;
372
    char        data[12], *d;
373
    size_t      count;
373
    size_t      count;
374
    pt_uint32   var;
374
    uint32_t   var;
375
    unsigned char  ch;
375
    unsigned char  ch;
376
    short       svar;
376
    short       svar;
377
    int         BitsPerChannel;
377
    int         BitsPerChannel;
378
378
379
    //Determine if this is a "cropped" tiff, and, if so, what is 
379
    //Determine if this is a "cropped" tiff, and, if so, what is 
...
...
442
    file_spec   fnum;
442
    file_spec   fnum;
443
    Image       sim;            //  background image
443
    Image       sim;            //  background image
444
    char        header[128], *h;
444
    char        header[128], *h;
445
    size_t      count, len, i, srcCount = 0;
445
    size_t      count, len, i, srcCount = 0;
446
    unsigned char **buf;
446
    unsigned char **buf;
447
    pt_uint32   var;
447
    uint32_t   var;
448
    char        data[12], *d;
448
    char        data[12], *d;
449
    int         BitsPerChannel, result = 0;
449
    int         BitsPerChannel, result = 0;
450
450
451
    // Jim Watters 2003/11/18: Photoshop CS does 16bit channels if 16 bit in, allow 16 bit out
451
    // Jim Watters 2003/11/18: Photoshop CS does 16bit channels if 16 bit in, allow 16 bit out
452
    // TwoToOneByte( im ); // Multilayer image format doesn't support 16 bit channels
452
    // TwoToOneByte( im ); // Multilayer image format doesn't support 16 bit channels
...
...
670
}
670
}
671
671
672
672
673
// Write white background, RLE-compressed
673
// Write white background, RLE-compressed
674
674
675
static void writeWhiteBackground( pt_int32 width, pt_int32 height, file_spec fnum )
675
static void writeWhiteBackground( uint32_t width, uint32_t height, file_spec fnum )
676
{
676
{
677
    short           svar;
677
    short           svar;
678
    pt_int32        w8, w;
678
    uint32_t        w8, w;
679
    size_t          count;
679
    size_t          count;
680
    char            data[12], *d, **scanline;
680
    char            data[12], *d, **scanline;
681
    
681
    
682
    int numChannels = 3, i, bytecount, dim = height*numChannels;
682
    int numChannels = 3, i, bytecount, dim = height*numChannels;
683
    
683
    
...
...
736
{
736
{
737
    file_spec   src;
737
    file_spec   src;
738
    char    header[128], *h;
738
    char    header[128], *h;
739
    long    len, i;
739
    long    len, i;
740
    size_t  count;
740
    size_t  count;
741
    pt_uint32 var;
741
    uint32_t var;
742
    char    data[12], *d;
742
    char    data[12], *d;
743
743
744
744
745
    if( myopen( sfile, read_bin, src ) )
745
    if( myopen( sfile, read_bin, src ) )
746
    {   
746
    {   
...
...
962
962
963
// Write image as separate first layer
963
// Write image as separate first layer
964
964
965
static int writeLayerAndMask( Image *im, file_spec fnum )
965
static int writeLayerAndMask( Image *im, file_spec fnum )
966
{
966
{
967
    pt_uint32       var;
967
    uint32_t       var;
968
    PTRect          theRect;
968
    PTRect          theRect;
969
    int             channelLength;
969
    int             channelLength;
970
    size_t          count;
970
    size_t          count;
971
    short           svar;
971
    short           svar;
972
    char            data[12], *d;
972
    char            data[12], *d;
...
...
1151
    unsigned char           **ch;
1151
    unsigned char           **ch;
1152
    register unsigned char  *c, *idata;
1152
    register unsigned char  *c, *idata;
1153
    size_t                  count;
1153
    size_t                  count;
1154
    short                   svar;
1154
    short                   svar;
1155
    char                    data[12], *d;
1155
    char                    data[12], *d;
1156
    pt_int32                outputRegionWidth, outputRegionHeight;
1156
    uint32_t                 outputRegionWidth, outputRegionHeight;
1157
1157
1158
    GetBitsPerChannel( im, BitsPerChannel );
1158
    GetBitsPerChannel( im, BitsPerChannel );
1159
    GetChannels( im, channels );
1159
    GetChannels( im, channels );
1160
    
1160
    
1161
    // Write Compression info
1161
    // Write Compression info
...
...
1427
// There must be one valid layer structure, and the
1427
// There must be one valid layer structure, and the
1428
// filepointer is at the beginning of it in both src and dest
1428
// filepointer is at the beginning of it in both src and dest
1429
1429
1430
static int addLayer( Image *im, file_spec src, file_spec fnum, stBuf *sB )
1430
static int addLayer( Image *im, file_spec src, file_spec fnum, stBuf *sB )
1431
{
1431
{
1432
    pt_uint32       var;
1432
    uint32_t       var;
1433
    PTRect          theRect, *nRect = NULL;
1433
    PTRect          theRect, *nRect = NULL;
1434
    int             channelLength,  bpp, oddSized = 0, oddSizedOld = 0;
1434
    int             channelLength,  bpp, oddSized = 0, oddSizedOld = 0;
1435
    int             result = 0;
1435
    int             result = 0;
1436
    size_t          count;
1436
    size_t          count;
1437
    short           svar;
1437
    short           svar;
...
...
2118
    file_spec       src;
2118
    file_spec       src;
2119
2119
2120
    char            header[128], *h;
2120
    char            header[128], *h;
2121
    size_t          chlength;
2121
    size_t          chlength;
2122
    size_t          count, iul, kul;
2122
    size_t          count, iul, kul;
2123
    pt_uint32       var;
2123
    uint32_t       var;
2124
    char            data[12], *d;
2124
    char            data[12], *d;
2125
    short           svar;
2125
    short           svar;
2126
    int             i, k, result = 0,nchannel, odd = 0;
2126
    int             i, k, result = 0,nchannel, odd = 0;
2127
    unsigned char       **buf = NULL, ch;
2127
    unsigned char       **buf = NULL, ch;
2128
    Image           im;
2128
    Image           im;

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

Sign up for the SourceForge newsletter:





No, thanks