Subversion Repositories filter_foundry

Rev

Rev 488 | Rev 492 | 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
 
439 daniel-mar 21
#ifndef FF_H_
22
#define FF_H_
23
 
259 daniel-mar 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"
330 daniel-mar 36
#include "ff_misc.h"
259 daniel-mar 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',
440 daniel-mar 56
        PS_FILTER_FILETYPE = '8BFM'
259 daniel-mar 57
};
58
 
480 daniel-mar 59
#ifdef _WIN32
477 daniel-mar 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;
480 daniel-mar 74
#endif
477 daniel-mar 75
 
489 daniel-mar 76
// size: 0x2090 (8336 Bytes)
456 daniel-mar 77
typedef struct globals_t_ {
480 daniel-mar 78
        PARM_T parm;
408 daniel-mar 79
        Boolean standalone;
80
        Boolean parmloaded; // this means that the filter is loaded, but without PARM (title, author, etc.)
81
        Boolean obfusc;
489 daniel-mar 82
        // (padding of 1 byte here)
83
        OSType lastKnownBufferVersion;
84
        OSType lastKnownHandleVersion;
480 daniel-mar 85
#ifdef _WIN32
259 daniel-mar 86
        HWND hWndMainDlg;
477 daniel-mar 87
        none_slider_info noneSliderInfo;
88
        comctl_slider_info comctlSliderInfo;
89
        plugin_dll_slider_info pluginDllSliderInfo;
476 daniel-mar 90
#endif /* _WIN32 */
259 daniel-mar 91
} globals_t;
92
 
93
extern globals_t *gdata;
94
 
95
#define NUM_CELLS 0x100
96
 
97
extern struct node *tree[4];
98
extern char *err[4];
99
extern int errpos[4],errstart[4];//,nplanes;
379 daniel-mar 100
extern uint8_t slider[8];
301 daniel-mar 101
extern value_type cell[NUM_CELLS];
259 daniel-mar 102
extern char *expr[4];
103
 
104
extern int tokpos,tokstart,varused[];
105
extern char *errstr;
106
 
107
//#define DEBUG
108
 
430 daniel-mar 109
typedef struct InternalState_ {
379 daniel-mar 110
        Boolean bak_obfusc;
111
        Boolean bak_standalone;
112
        Boolean bak_parmloaded;
113
        char* bak_expr[4];
114
        uint8_t bak_slider[8];
115
        PARM_T bak_parm;
430 daniel-mar 116
} InternalState;
379 daniel-mar 117
 
271 daniel-mar 118
// from main.c
276 daniel-mar 119
unsigned long get_parm_hash(PARM_T *parm);
483 daniel-mar 120
void DoPrepare(FilterRecordPtr epb);
121
void DoStart(FilterRecordPtr epb);
122
OSErr DoContinue(FilterRecordPtr epb);
123
void DoFinish(FilterRecordPtr epb);
124
void RequestNext(FilterRecordPtr epb);
430 daniel-mar 125
InternalState saveInternalState();
126
void restoreInternalState(InternalState state);
259 daniel-mar 127
 
271 daniel-mar 128
// from read.c
408 daniel-mar 129
Boolean readparams_afs_pff(Handle h,char **reason);
259 daniel-mar 130
void convert_premiere_to_photoshop(PARM_T* photoshop, PARM_T_PREMIERE* premiere);
373 daniel-mar 131
Boolean readfile_8bf(StandardFileReply *sfr,char **reason);
259 daniel-mar 132
Handle readfileintohandle(FILEREF r);
366 daniel-mar 133
Boolean readfile_afs_pff(StandardFileReply* sfr, char** reason);
134
Boolean readfile_ffx(StandardFileReply* sfr, char** reason);
385 daniel-mar 135
Boolean readfile_picotxt(StandardFileReply* sfr, char** reason);
394 daniel-mar 136
Boolean readPARM(PARM_T* parm,Ptr h);
259 daniel-mar 137
 
271 daniel-mar 138
// from save.c
389 daniel-mar 139
OSErr saveparams_afs_pff(Handle h);
140
OSErr saveparams_picotxt(Handle h, Boolean useparm);
259 daniel-mar 141
OSErr savehandleintofile(Handle h,FILEREF r);
389 daniel-mar 142
Boolean savefile_afs_pff_picotxt(StandardFileReply *sfr);
259 daniel-mar 143
 
271 daniel-mar 144
// from make_*.c
259 daniel-mar 145
OSErr make_standalone(StandardFileReply *sfr);
146
 
271 daniel-mar 147
// from process.c
259 daniel-mar 148
Boolean setup(FilterRecordPtr pb);
149
void evalpixel(unsigned char *outp,unsigned char *inp);
150
 
271 daniel-mar 151
// from make.c
259 daniel-mar 152
unsigned long printablehash(unsigned long hash);
393 daniel-mar 153
size_t fixpipl(PIPropertyList *pipl,size_t origsize,char* title, long *event_id);
259 daniel-mar 154
size_t aete_generate(void* aeteptr, PARM_T *pparm, long event_id);
292 daniel-mar 155
 
156
// from obfusc.c
347 daniel-mar 157
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 158
int obfuscation_version(PARM_T* pparm);
347 daniel-mar 159
uint64_t obfusc(PARM_T* pparm);
271 daniel-mar 160
void deobfusc(PARM_T* pparm);
259 daniel-mar 161
 
271 daniel-mar 162
// from loadfile_*.c
259 daniel-mar 163
Boolean loadfile(StandardFileReply *sfr,char **reason);
440 daniel-mar 164
Boolean readPARMresource(HMODULE hm,char **reason);
259 daniel-mar 165
 
166
// from main.c
167
int64_t maxspace();
168
Boolean maxspace_available();
169
Boolean host_preserves_parameters();
170
 
171
// from parser.y
172
struct node *parseexpr(char *s);
173
 
286 daniel-mar 174
// from funcs.c
175
void factory_initialize_rnd_variables();
176
 
271 daniel-mar 177
// Useful macros
489 daniel-mar 178
 
179
// Note: "bigDocumentData->PluginUsing32BitCoordinates" will be set by filterSelectorStart, if HAS_BIG_DOC(pb) is true
259 daniel-mar 180
#define HAS_BIG_DOC(x) ((x)->bigDocumentData != NULL)
181
 
182
#define BIGDOC_IMAGE_SIZE(x) ((x)->bigDocumentData->imageSize32)
183
#define IMAGE_SIZE(x) ((x)->imageSize)
184
 
185
#define BIGDOC_FILTER_RECT(x) ((x)->bigDocumentData->filterRect32)
186
#define FILTER_RECT(x) ((x)->filterRect)
187
 
188
#define BIGDOC_IN_RECT(x) ((x)->bigDocumentData->inRect32)
189
#define IN_RECT(x) ((x)->inRect)
190
 
191
#define BIGDOC_OUT_RECT(x) ((x)->bigDocumentData->outRect32)
192
#define OUT_RECT(x) ((x)->outRect)
193
 
194
#define BIGDOC_MASK_RECT(x) ((x)->bigDocumentData->maskRect32)
195
#define MASK_RECT(x) ((x)->maskRect)
196
 
197
#define BIGDOC_FLOAT_COORD(x) ((x)->bigDocumentData->floatCoord32)
198
#define FLOAT_COORD(x) ((x)->floatCoord)
199
 
200
#define BIGDOC_WHOLE_SIZE(x) ((x)->bigDocumentData->wholeSize32)
201
#define WHOLE_SIZE(x) ((x)->wholeSize)
202
 
439 daniel-mar 203
#endif