Subversion Repositories filter_foundry

Rev

Rev 193 | Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1. /*
  2.         This file is part of a common library
  3.     Copyright (C) 1990-2009 Toby Thain, toby@telegraphics.com.au
  4.  
  5.     This program is free software; you can redistribute it and/or modify
  6.     it under the terms of the GNU General Public License as published by
  7.     the Free Software Foundation; either version 2 of the License, or
  8.     (at your option) any later version.
  9.  
  10.     This program is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.     GNU General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU General Public License
  16.     along with this program; if not, write to the Free Software
  17.     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  18. */
  19.  
  20. #include "pitypes.h"
  21. #include "pigeneral.h"
  22.  
  23. #if PRAGMA_STRUCT_ALIGN
  24.         #pragma options align=mac68k
  25. #endif
  26.  
  27. enum{PS_pixels,PS_inches,PS_cm,PS_points,PS_picas,PS_columns};
  28.  
  29. // perfectly good mode constants in pigeneral.h
  30. //enum{PS_bitmap,PS_grey,PS_indexed,PS_RGB,PS_CMYK,PS_HSL,PS_HSB,PS_multi,PS_duo};
  31.  
  32. typedef struct{
  33.         short channels,rows,columns,depth,mode;
  34. }mode_info;
  35.  
  36. typedef struct ResolutionInfo
  37.         {
  38.  
  39.         Fixed   hRes;
  40.         int16   hResUnit;
  41.         int16   widthUnit;
  42.  
  43.         Fixed   vRes;
  44.         int16   vResUnit;
  45.         int16   heightUnit;
  46.  
  47.         } ResolutionInfo;
  48. enum{ SIZEOF_RESINFO = 16 };
  49.  
  50. // photoshop 2.5 file format
  51.  
  52. enum{Raw_Data,RLE_compressed};
  53. enum{
  54.         PHOTOSHOP_25_SIGNATURE = '8BPS',
  55.         PHOTOSHOP_25_FILE_TYPE = '8BPS',
  56.         PHOTOSHOP_25_FILE_CREATOR = '8BIM',
  57.         PHOTOSHOP_25_RSRC_TYPE = '8BIM',
  58.         COLOUR_TABLE_LENGTH = 768,
  59.  
  60.         MODE_INFO_ID = 1000,
  61.         COLOUR_TABLE_ID = 1003,
  62.         RES_INFO_ID = 1005
  63. };
  64.  
  65. #if 0
  66. typedef struct{
  67.         struct{
  68.                 long Signature;
  69.                 short Version;
  70.                 char Reserved[6];
  71.                 short Channels;
  72.                 long Rows,Columns;
  73.                 short Depth,Mode;
  74.         }part1;
  75.        
  76.         long Mode_Data_length;
  77.         // mode data
  78.  
  79.         long Image_Resources_length;
  80.         // image resources
  81.  
  82.         long Reserved_Data_length;
  83.         // reserved data
  84.  
  85.         short Compression;
  86.         // image data
  87. }photoshop25_header;
  88.  
  89. #else
  90. typedef struct{
  91.         long Signature;
  92.         short Version;
  93.         char Reserved[6];
  94.         short Channels;
  95.         long Rows,Columns;
  96.         short Depth,Mode;
  97. }photoshop25_header;
  98. #endif
  99.  
  100. typedef struct{
  101.         long type;
  102.         short ID;
  103.         char name[2];
  104.         long size;
  105.         // resource data (resource size bytes plus padding to make the size even)
  106. }resource_block;
  107.  
  108. // from ILLUSTRATOREXPORT.H
  109. #define kClosedSubpathLength 0
  110. #define kSmoothClosedKnot    1
  111. #define kCuspClosedKnot      2
  112. #define kOpenSubpathLength   3
  113. #define kSmoothOpenKnot      4
  114. #define kCuspOpenKnot        5
  115.  
  116. typedef struct{
  117.         int32 y,x;
  118. } path_pt;
  119.  
  120. typedef struct{
  121.         path_pt before,anchor,after;
  122. } path_knot;
  123.  
  124. typedef struct{
  125.         Fixed top,left,bottom,right,res;
  126. } path_clipboard;
  127.  
  128. typedef struct{
  129.         int16 kind;
  130.         union {
  131.                 int16 subpath_length; /* record types 0 and 3 */
  132.                 path_knot knot;
  133.                 path_clipboard clipboard; /* record type 7 */
  134.         } data;
  135. } ATTRIBUTE_PACKED SavedPathElement ;
  136.  
  137. #ifdef macintosh
  138.  
  139. #define SRP(i,t) STACK_ROUTINE_PARAMETER(i,SIZE_CODE(sizeof(t)))
  140. #define RES(t) RESULT_SIZE(SIZE_CODE(sizeof(t)))
  141.  
  142. enum{
  143. //      pascal void UpdateProgress (long done, long total);
  144.         PROGRESS_PROCINFO = kPascalStackBased | SRP(1,long) | SRP(2,long)
  145.         ,
  146. //      pascal Boolean TestAbort ();
  147.         ABORT_PROCINFO = kPascalStackBased | RES(Boolean)
  148.         ,
  149. /*
  150.         typedef MACPASCAL OSErr (*GetPropertyProc) (OSType signature,
  151.                                                                                                 OSType key,
  152.                                                                                                 int32 index,
  153.                                                                                                 int32 *simpleProperty,
  154.                                                                                                 Handle *complexProperty);
  155. */
  156.         GETPROP_PROCINFO = kPascalStackBased
  157.                 | SRP(1,OSType) | SRP(2,OSType) | SRP(3,int32) | SRP(4,int32*) | SRP(5,Handle*)
  158.                 | RES(OSErr)
  159.         ,
  160. // typedef MACPASCAL void (*DisposePIHandleProc) (Handle h);
  161.         PI_DISPOSE_PROCINFO = kPascalStackBased | SRP(1,Handle)
  162.         ,
  163. // typedef MACPASCAL int32 (*GetPIHandleSizeProc) (Handle h);
  164.         PI_GETSIZE_PROCINFO = kPascalStackBased | SRP(1,Handle) | RES(int32)
  165.         ,
  166. // typedef MACPASCAL Ptr (*LockPIHandleProc) (Handle h, Boolean moveHigh);
  167.         PI_LOCK_PROCINFO = kPascalStackBased | SRP(1,Handle) | SRP(2,Boolean) | RES(Ptr)
  168. };
  169.  
  170.         #ifdef CALL_ZERO_PARAMETER_UPP
  171.                 #define CALL_ABORTPROC(x) CALL_ZERO_PARAMETER_UPP(x,ABORT_PROCINFO)
  172.                 #define CALL_PROGRESSPROC(x, done,total) CALL_TWO_PARAMETER_UPP(x,PROGRESS_PROCINFO, done,total)
  173.                 #define CALL_GETPROPPROC(x, a,b,c,d,e) CALL_FIVE_PARAMETER_UPP(x,GETPROP_PROCINFO, a,b,c,d,e)
  174.                 #define CALL_PI_DISPOSE(x, h) CALL_ONE_PARAMETER_UPP(x,PI_DISPOSE_PROCINFO, h)
  175.                 #define CALL_PI_GETSIZE(x, h) CALL_ONE_PARAMETER_UPP(x,PI_GETSIZE_PROCINFO, h)
  176.                 #define CALL_PI_LOCK(x, h,mh) CALL_TWO_PARAMETER_UPP(x,PI_LOCK_PROCINFO, h,mh)
  177.         #else
  178.                 #define CALL_ABORTPROC(x) CallUniversalProc(x,ABORT_PROCINFO)
  179.                 #define CALL_PROGRESSPROC(x, done,total) CallUniversalProc(x,PROGRESS_PROCINFO, done,total)
  180.                 #define CALL_GETPROPPROC(x, a,b,c,d,e) CallUniversalProc(x,GETPROP_PROCINFO, a,b,c,d,e)
  181.                 #define CALL_PI_DISPOSE(x, h) CallUniversalProc(x,PI_DISPOSE_PROCINFO, h)
  182.                 #define CALL_PI_GETSIZE(x, h) CallUniversalProc(x,PI_GETSIZE_PROCINFO, h)
  183.                 #define CALL_PI_LOCK(x, h,mh) CallUniversalProc(x,PI_LOCK_PROCINFO, h,mh)
  184.         #endif
  185.        
  186. #else
  187.         // not macintosh
  188.         #define CALL_ABORTPROC(x) (*(TestAbortProc)x)()
  189.         #define CALL_PROGRESSPROC(x, done,total) (*(ProgressProc)x)(done,total)
  190.         #define CALL_GETPROPPROC(x, a,b,c,d,e) (*(GetPropertyProc)x)(a,b,c,d,e)
  191.         #define CALL_PI_DISPOSE(x, h) (*(DisposePIHandleProc)x)(h)
  192.         #define CALL_PI_GETSIZE(x, h) (*(GetPIHandleSizeProc)x)(h)
  193.         #define CALL_PI_LOCK(x, h,mh) (*(LockPIHandleProc)x)(h,mh)
  194.  
  195. #endif
  196.  
  197. #if PRAGMA_STRUCT_ALIGN
  198. #pragma options align=reset
  199. #endif
  200.