Subversion Repositories filter_foundry

Rev

Rev 335 | Rev 489 | 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 FUNCS_H_
22
#define FUNCS_H_
23
 
259 daniel-mar 24
#include <math.h>
25
 
335 daniel-mar 26
// Strict compatibility to Filter Factory by using an alternative
27
// implementation which is a 100% replica of the Filter Factory 3.0.4
28
// for Windows.
29
#ifdef WIN_ENV
30
// i,u,v intentionally not equal to Filter Factory (this has been documented).
31
//#define use_filterfactory_implementation_i
32
//#define use_filterfactory_implementation_u
33
//#define use_filterfactory_implementation_v
34
// umin,umax and vmin,vmax intentionally not equal to Filter Factory (this has been documented).
35
//#define use_filterfactory_implementation_u_minmax
36
//#define use_filterfactory_implementation_v_minmax
37
// U and V intentionally not equal to Filter Factory (this has been documented).
38
//#define use_filterfactory_implementation_U
39
//#define use_filterfactory_implementation_V
40
// dmin,dmax intentionally not equal to Filter Factory (this has been documented).
41
//#define use_filterfactory_implementation_d_minmax
42
// D intentionally not equal to Filter Factory (this has been documented).
43
//#define use_filterfactory_implementation_D
44
// get(i) intentionally not equal to Filter Factory (this has been documented).
45
//#define use_filterfactory_implementation_get
46
// Following functions are implemented as 100% replicas
47
#define use_filterfactory_implementation_rad
48
#define use_filterfactory_implementation_rnd
49
#define use_filterfactory_implementation_c2d
50
#define use_filterfactory_implementation_c2m
51
#define use_filterfactory_implementation_r2x
52
#define use_filterfactory_implementation_r2y
53
#define use_filterfactory_implementation_cos
54
#define use_filterfactory_implementation_sin
55
#define use_filterfactory_implementation_tan
56
#define use_filterfactory_implementation_sqr
57
#define use_filterfactory_implementation_d
58
#define use_filterfactory_implementation_m
59
#define use_filterfactory_implementation_M
60
#endif
259 daniel-mar 61
 
335 daniel-mar 62
 
259 daniel-mar 63
#ifndef M_PI
268 daniel-mar 64
#define M_PI 3.14159265358979323846264338327
259 daniel-mar 65
#endif
66
 
67
 
68
#include "symtab.h"
69
 
70
enum{ COSTABSIZE=1024,TANTABSIZE=512 };
71
 
72
void init_trigtab();
73
 
74
extern double costab[],tantab[];
75
 
76
#define DEG2RAD(x) ((x)*M_PI/180.)
77
#define RAD2DEG(x) ((x)*180./M_PI)
78
 
79
/* [trig functions return] an integer between -512 and 512, inclusive (Windows)
80
        or -1024 and 1024, inclusive (Mac OS) */
81
#ifdef WIN_ENV
82
#define TRIGAMP 512
83
#else
84
#define TRIGAMP 1024
85
#endif
86
#define FFANGLE(v) ((v)*M_PI/512.)
87
#define TO_FFANGLE(v) ((v)*512./M_PI)
88
 
294 daniel-mar 89
#define INITRANDSEED() initialize_rnd_variables()
90
void initialize_rnd_variables();
259 daniel-mar 91
 
294 daniel-mar 92
// Functions
259 daniel-mar 93
value_type ff_src(value_type x,value_type y,value_type z);
94
value_type ff_rad(value_type d,value_type m,value_type z);
95
value_type ff_ctl(value_type i);
96
value_type ff_val(value_type i,value_type a,value_type b);
97
value_type ff_map(value_type i,value_type n);
98
value_type ff_min(value_type a,value_type b);
99
value_type ff_max(value_type a,value_type b);
100
value_type ff_abs(value_type a);
101
value_type ff_add(value_type a,value_type b,value_type c);
102
value_type ff_sub(value_type a,value_type b,value_type c);
103
value_type ff_dif(value_type a,value_type b);
104
value_type ff_rnd(value_type a,value_type b);
105
value_type ff_mix(value_type a,value_type b,value_type n,value_type d);
106
value_type ff_scl(value_type a,value_type il,value_type ih,
107
                                  value_type ol,value_type oh);
108
value_type ff_sqr(value_type x);
109
value_type ff_sin(value_type x);
110
value_type ff_cos(value_type x);
111
value_type ff_tan(value_type x);
112
value_type ff_r2x(value_type d,value_type m);
113
value_type ff_r2y(value_type d,value_type m);
294 daniel-mar 114
value_type ff_c2d(value_type d,value_type m);
259 daniel-mar 115
value_type ff_c2m(value_type d,value_type m);
116
value_type ff_get(value_type i);
117
value_type ff_put(value_type v,value_type i);
118
value_type ff_cnv(value_type m11,value_type m12,value_type m13,
119
                                  value_type m21,value_type m22,value_type m23,
120
                                  value_type m31,value_type m32,value_type m33,
121
                                  value_type d );
122
value_type ff_rst(value_type seed);
294 daniel-mar 123
 
124
// Variables
125
value_type ff_i();
126
value_type ff_u();
127
value_type ff_v();
128
value_type ff_D();
129
value_type ff_d();
130
value_type ff_M();
131
value_type ff_m();
304 daniel-mar 132
 
335 daniel-mar 133
extern value_type min_val_i;
134
extern value_type max_val_i;
135
extern value_type min_val_u;
136
extern value_type max_val_u;
137
extern value_type min_val_v;
138
extern value_type max_val_v;
139
extern value_type min_val_d;
140
extern value_type max_val_d;
141
extern value_type val_D;
142
extern value_type val_I;
143
extern value_type val_U;
144
extern value_type val_V;
439 daniel-mar 145
 
146
#endif