Subversion Repositories filter_foundry

Rev

Rev 485 | Rev 488 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. /*
  2.     This file is part of "Filter Foundry", a filter plugin for Adobe Photoshop
  3.     Copyright (C) 2003-2009 Toby Thain, toby@telegraphics.com.au
  4.     Copyright (C) 2018-2021 Daniel Marschall, ViaThinkSoft
  5.  
  6.     This program is free software; you can redistribute it and/or modify
  7.     it under the terms of the GNU General Public License as published by
  8.     the Free Software Foundation; either version 2 of the License, or
  9.     (at your option) any later version.
  10.  
  11.     This program is distributed in the hope that it will be useful,
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.     GNU General Public License for more details.
  15.  
  16.     You should have received a copy of the GNU General Public License
  17.     along with this program; if not, write to the Free Software
  18.     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  19. */
  20.  
  21. #ifndef FF_H_
  22. #define FF_H_
  23.  
  24. #include "world.h"
  25.  
  26. #include "PIFilter.h"
  27.  
  28. #include "entry.h"
  29.  
  30. #include "choosefile.h"
  31. #include "ui.h"
  32. #include "file_compat.h"
  33. #include "symtab.h"
  34. #include "PARM.h"
  35. #include "preview.h"
  36. #include "ff_misc.h"
  37.  
  38. #define HOSTSIG_GIMP 'PMIG' // sic: NOT 'GIMP'
  39. #define HOSTSIG_IRFANVIEW 'UP20'
  40. #define HOSTSIG_PHOTOSHOP '8BIM'
  41. //#define HOSTSIG_PLUGINCOMMANDER '8BIM' // meh.
  42. //#define HOSTSIG_SERIF_PHOTOPLUS '8BIM' // meh.
  43. #define HOSTSIG_JASC_PAINTSHOP_PRO_X 'PSP9'
  44. #define HOSTSIG_PAINT_NET 'NDP.'
  45. #define HOSTSIG_ADOBE_PREMIERE '8B)M'/*sic*/
  46.  
  47. enum{
  48.         TAB = 011,
  49.         LF  = 012,
  50.         CR  = 015,
  51.  
  52.         CHUNK_ROWS = 64,
  53.  
  54.         TEXT_FILETYPE = 'TEXT',
  55.         SIG_SIMPLETEXT = 'ttxt',
  56.         PS_FILTER_FILETYPE = '8BFM'
  57. };
  58.  
  59. #ifdef _WIN32
  60. typedef struct none_slider_info_ {
  61.         BOOL initialized;
  62. } none_slider_info;
  63.  
  64. typedef struct comctl_slider_info_ {
  65.         BOOL initialized;
  66.         HMODULE hLib;
  67. } comctl_slider_info;
  68.  
  69. typedef struct plugin_dll_slider_info_ {
  70.         BOOL initialized;
  71.         HMODULE hLib;
  72.         DWORD messageId;
  73. } plugin_dll_slider_info;
  74. #endif
  75.  
  76. // size: 0x2088 (8328 Bytes)
  77. typedef struct globals_t_ {
  78.         PARM_T parm;
  79.         Boolean standalone;
  80.         Boolean parmloaded; // this means that the filter is loaded, but without PARM (title, author, etc.)
  81.         Boolean obfusc;
  82. #ifdef _WIN32
  83.         HWND hWndMainDlg;
  84.         none_slider_info noneSliderInfo;
  85.         comctl_slider_info comctlSliderInfo;
  86.         plugin_dll_slider_info pluginDllSliderInfo;
  87. #endif /* _WIN32 */
  88.         OSType lastKnownBufferVersion;
  89.         OSType lastKnownHandleVersion;
  90. } globals_t;
  91.  
  92. extern globals_t *gdata;
  93.  
  94. #define NUM_CELLS 0x100
  95.  
  96. extern struct node *tree[4];
  97. extern char *err[4];
  98. extern int errpos[4],errstart[4];//,nplanes;
  99. extern uint8_t slider[8];
  100. extern value_type cell[NUM_CELLS];
  101. extern char *expr[4];
  102.  
  103. extern int tokpos,tokstart,varused[];
  104. extern char *errstr;
  105.  
  106. //#define DEBUG
  107.  
  108. typedef struct InternalState_ {
  109.         Boolean bak_obfusc;
  110.         Boolean bak_standalone;
  111.         Boolean bak_parmloaded;
  112.         char* bak_expr[4];
  113.         uint8_t bak_slider[8];
  114.         PARM_T bak_parm;
  115. } InternalState;
  116.  
  117. // from main.c
  118. unsigned long get_parm_hash(PARM_T *parm);
  119. void DoPrepare(FilterRecordPtr epb);
  120. void DoStart(FilterRecordPtr epb);
  121. OSErr DoContinue(FilterRecordPtr epb);
  122. void DoFinish(FilterRecordPtr epb);
  123. void RequestNext(FilterRecordPtr epb);
  124. InternalState saveInternalState();
  125. void restoreInternalState(InternalState state);
  126.  
  127. // from read.c
  128. Boolean readparams_afs_pff(Handle h,char **reason);
  129. void convert_premiere_to_photoshop(PARM_T* photoshop, PARM_T_PREMIERE* premiere);
  130. Boolean readfile_8bf(StandardFileReply *sfr,char **reason);
  131. Handle readfileintohandle(FILEREF r);
  132. Boolean readfile_afs_pff(StandardFileReply* sfr, char** reason);
  133. Boolean readfile_ffx(StandardFileReply* sfr, char** reason);
  134. Boolean readfile_picotxt(StandardFileReply* sfr, char** reason);
  135. Boolean readPARM(PARM_T* parm,Ptr h);
  136.  
  137. // from save.c
  138. OSErr saveparams_afs_pff(Handle h);
  139. OSErr saveparams_picotxt(Handle h, Boolean useparm);
  140. OSErr savehandleintofile(Handle h,FILEREF r);
  141. Boolean savefile_afs_pff_picotxt(StandardFileReply *sfr);
  142.  
  143. // from make_*.c
  144. OSErr make_standalone(StandardFileReply *sfr);
  145.  
  146. // from process.c
  147. Boolean setup(FilterRecordPtr pb);
  148. void evalpixel(unsigned char *outp,unsigned char *inp);
  149.  
  150. // from make.c
  151. unsigned long printablehash(unsigned long hash);
  152. size_t fixpipl(PIPropertyList *pipl,size_t origsize,char* title, long *event_id);
  153. size_t aete_generate(void* aeteptr, PARM_T *pparm, long event_id);
  154.  
  155. // from obfusc.c
  156. extern const volatile uint64_t cObfuscSeed; // this value will be manipulated during the building of each individual filter (see make_win.c)
  157. int obfuscation_version(PARM_T* pparm);
  158. uint64_t obfusc(PARM_T* pparm);
  159. void deobfusc(PARM_T* pparm);
  160.  
  161. // from loadfile_*.c
  162. Boolean loadfile(StandardFileReply *sfr,char **reason);
  163. Boolean readPARMresource(HMODULE hm,char **reason);
  164.  
  165. // from main.c
  166. int64_t maxspace();
  167. Boolean maxspace_available();
  168. Boolean host_preserves_parameters();
  169.  
  170. // from parser.y
  171. struct node *parseexpr(char *s);
  172.  
  173. // from funcs.c
  174. void factory_initialize_rnd_variables();
  175.  
  176. // from ff_misc.c
  177. void newHandle(FFHandle* hdl, size_t nBytes);
  178. void disposeHandle(FFHandle* hdl);
  179. size_t getHandleSize(FFHandle* hdl);
  180. OSErr setHandleSize(FFHandle* hdl, size_t nBytes);
  181. Ptr lockHandle(FFHandle* hdl);
  182. void unlockHandle(FFHandle* hdl);
  183. void newBuffer(FFBuffer* buf, size_t size);
  184. Ptr lockBuffer(FFBuffer* buf);
  185. void unlockBuffer(FFBuffer* buf);
  186. void disposeBuffer(FFBuffer* buf);
  187.  
  188. // Useful macros
  189. #define HAS_BIG_DOC(x) ((x)->bigDocumentData != NULL)
  190.  
  191. #define BIGDOC_IMAGE_SIZE(x) ((x)->bigDocumentData->imageSize32)
  192. #define IMAGE_SIZE(x) ((x)->imageSize)
  193.  
  194. #define BIGDOC_FILTER_RECT(x) ((x)->bigDocumentData->filterRect32)
  195. #define FILTER_RECT(x) ((x)->filterRect)
  196.  
  197. #define BIGDOC_IN_RECT(x) ((x)->bigDocumentData->inRect32)
  198. #define IN_RECT(x) ((x)->inRect)
  199.  
  200. #define BIGDOC_OUT_RECT(x) ((x)->bigDocumentData->outRect32)
  201. #define OUT_RECT(x) ((x)->outRect)
  202.  
  203. #define BIGDOC_MASK_RECT(x) ((x)->bigDocumentData->maskRect32)
  204. #define MASK_RECT(x) ((x)->maskRect)
  205.  
  206. #define BIGDOC_FLOAT_COORD(x) ((x)->bigDocumentData->floatCoord32)
  207. #define FLOAT_COORD(x) ((x)->floatCoord)
  208.  
  209. #define BIGDOC_WHOLE_SIZE(x) ((x)->bigDocumentData->wholeSize32)
  210. #define WHOLE_SIZE(x) ((x)->wholeSize)
  211.  
  212. #endif
  213.