Subversion Repositories filter_foundry

Rev

Rev 373 | Rev 376 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
259 daniel-mar 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
#include "world.h"
22
 
23
#include "PIFilter.h"
24
 
25
#include "entry.h"
26
 
27
#include "choosefile.h"
28
#include "ui.h"
29
#include "file_compat.h"
30
#include "symtab.h"
31
#include "PARM.h"
32
#include "preview.h"
330 daniel-mar 33
#include "ff_misc.h"
259 daniel-mar 34
 
35
#ifndef INCLUDED_FF_H
36
#define INCLUDED_FF_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
 
375 daniel-mar 54
#ifdef MAC_ENV
55
        PARM_TYPE = 'PARM', // Note: There is also a Rez type in PARM.h
56
        PARM_ID_OLD = 16000,
57
        PARM_ID_NEW = 16, // Filter Factory compatibility
58
#else
59
        PARM_TYPE = "PARM",
60
        PARM_ID_OLD = MAKEINTRESOURCE(16000),
61
        PARM_ID_NEW = MAKEINTRESOURCE(16), // Filter Factory compatibility
62
#endif
63
 
64
#ifdef MAC_ENV
65
        OBFUSCDATA_TYPE_OLD = 'DATA';
66
        OBFUSCDATA_TYPE_NEW = 'obFS';
67
        OBFUSCDATA_ID_OLD = 16001,
68
        OBFUSCDATA_ID_NEW = 16,
69
#else
70
        OBFUSCDATA_TYPE_OLD = RT_RCDATA;
71
        OBFUSCDATA_TYPE_NEW = "OBFS";
72
        OBFUSCDATA_ID_OLD = MAKEINTRESOURCE(16001),
73
        OBFUSCDATA_ID_NEW = MAKEINTRESOURCE(16),
74
#endif
75
 
259 daniel-mar 76
        TEXT_FILETYPE = 'TEXT',
77
        SIG_SIMPLETEXT = 'ttxt',
78
        PS_FILTER_FILETYPE = '8BFM',
79
 
271 daniel-mar 80
        // Obfuscated data will be read, but it will not be read if it is additionally protected
259 daniel-mar 81
        READ_OBFUSC = 1
82
};
83
 
84
typedef struct{
85
        Boolean standalone,parmloaded,obfusc;
86
        PARM_T parm;
87
        #ifdef _WIN32
88
        HWND hWndMainDlg;
89
        #endif /* _WIN32 */
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;
301 daniel-mar 99
extern uint8_t slider[8],map[4][0x100];
100
extern value_type cell[NUM_CELLS];
259 daniel-mar 101
extern char *expr[4];
102
// extern long maxSpace;
103
 
104
extern int tokpos,tokstart,varused[];
105
extern char *errstr;
106
 
107
#define DBG(x) {}
108
//#define DEBUG
109
 
271 daniel-mar 110
// from main.c
276 daniel-mar 111
unsigned long get_parm_hash(PARM_T *parm);
373 daniel-mar 112
void get_temp_afs(char* outfilename, Boolean isStandalone, PARM_T* parm);
259 daniel-mar 113
void DoPrepare (FilterRecordPtr epb);
114
void DoStart (FilterRecordPtr epb);
115
OSErr DoContinue (FilterRecordPtr epb);
116
void DoFinish (FilterRecordPtr epb);
117
void RequestNext (FilterRecordPtr epb,long);
118
 
271 daniel-mar 119
// from read.c
259 daniel-mar 120
Boolean readparams(Handle h,Boolean alerts,char **reason);
121
void convert_premiere_to_photoshop(PARM_T* photoshop, PARM_T_PREMIERE* premiere);
373 daniel-mar 122
Boolean readfile_8bf(StandardFileReply *sfr,char **reason);
259 daniel-mar 123
Handle readfileintohandle(FILEREF r);
366 daniel-mar 124
Boolean readfile_afs_pff(StandardFileReply* sfr, char** reason);
125
Boolean readfile_ffx(StandardFileReply* sfr, char** reason);
259 daniel-mar 126
Boolean readPARM(Ptr h,PARM_T *parm,char **reasonstr,int fromwin);
127
 
271 daniel-mar 128
// from save.c
259 daniel-mar 129
OSErr saveparams(Handle h);
130
OSErr savehandleintofile(Handle h,FILEREF r);
369 daniel-mar 131
Boolean savefile_afs_pff(StandardFileReply *sfr);
259 daniel-mar 132
 
271 daniel-mar 133
// from make_*.c
259 daniel-mar 134
OSErr make_standalone(StandardFileReply *sfr);
135
 
271 daniel-mar 136
// from process.c
259 daniel-mar 137
Boolean setup(FilterRecordPtr pb);
138
void evalpixel(unsigned char *outp,unsigned char *inp);
139
 
271 daniel-mar 140
// from make.c
259 daniel-mar 141
unsigned long printablehash(unsigned long hash);
142
size_t fixpipl(PIPropertyList *pipl,size_t origsize,StringPtr title, long *event_id);
143
size_t aete_generate(void* aeteptr, PARM_T *pparm, long event_id);
292 daniel-mar 144
 
145
// from obfusc.c
347 daniel-mar 146
extern const volatile uint64_t cObfuscSeed; // this value will be manipulated during the building of each individual filter (see make_win.c)
293 daniel-mar 147
int obfuscation_version(PARM_T* pparm);
347 daniel-mar 148
uint64_t obfusc(PARM_T* pparm);
271 daniel-mar 149
void deobfusc(PARM_T* pparm);
259 daniel-mar 150
 
271 daniel-mar 151
// from loadfile_*.c
259 daniel-mar 152
Boolean loadfile(StandardFileReply *sfr,char **reason);
153
Boolean readPARMresource(HMODULE hm,char **reason,int readobfusc);
154
 
155
// from main.c
156
int64_t maxspace();
157
Boolean maxspace_available();
158
Boolean host_preserves_parameters();
159
 
160
// from parser.y
161
struct node *parseexpr(char *s);
162
 
286 daniel-mar 163
// from funcs.c
164
void factory_initialize_rnd_variables();
165
 
271 daniel-mar 166
// Useful macros
259 daniel-mar 167
#define HAS_BIG_DOC(x) ((x)->bigDocumentData != NULL)
168
 
169
#define BIGDOC_IMAGE_SIZE(x) ((x)->bigDocumentData->imageSize32)
170
#define IMAGE_SIZE(x) ((x)->imageSize)
171
 
172
#define BIGDOC_FILTER_RECT(x) ((x)->bigDocumentData->filterRect32)
173
#define FILTER_RECT(x) ((x)->filterRect)
174
 
175
#define BIGDOC_IN_RECT(x) ((x)->bigDocumentData->inRect32)
176
#define IN_RECT(x) ((x)->inRect)
177
 
178
#define BIGDOC_OUT_RECT(x) ((x)->bigDocumentData->outRect32)
179
#define OUT_RECT(x) ((x)->outRect)
180
 
181
#define BIGDOC_MASK_RECT(x) ((x)->bigDocumentData->maskRect32)
182
#define MASK_RECT(x) ((x)->maskRect)
183
 
184
#define BIGDOC_FLOAT_COORD(x) ((x)->bigDocumentData->floatCoord32)
185
#define FLOAT_COORD(x) ((x)->floatCoord)
186
 
187
#define BIGDOC_WHOLE_SIZE(x) ((x)->bigDocumentData->wholeSize32)
188
#define WHOLE_SIZE(x) ((x)->wholeSize)
189
 
190
#endif /* INCLUDED_FF_H */