Subversion Repositories filter_foundry

Rev

Rev 439 | Rev 444 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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