Subversion Repositories filter_foundry

Rev

Rev 502 | 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-2022 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 FUNCS_H_
  22. #define FUNCS_H_
  23.  
  24. #include <math.h>
  25.  
  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, and v are 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, vmin, and vmax are 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 are intentionally not equal to Filter Factory (this has been documented).
  38. //#define use_filterfactory_implementation_U
  39. //#define use_filterfactory_implementation_V
  40. // dmin and dmax are intentionally not equal to Filter Factory (this has been documented).
  41. //#define use_filterfactory_implementation_d_minmax
  42. // D is intentionally not equal to Filter Factory (this has been documented).
  43. //#define use_filterfactory_implementation_D
  44. // get(i) is intentionally not equal to Filter Factory (this has been documented).
  45. //#define use_filterfactory_implementation_get
  46. // The 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. #define use_filterfactory_implementation_val
  61. #endif
  62.  
  63.  
  64. #ifndef M_PI
  65. #define M_PI 3.14159265358979323846264338327
  66. #endif
  67.  
  68.  
  69. #include "symtab.h"
  70.  
  71. #define TANTABSIZE 512
  72. #define COSTABSIZE 1024
  73.  
  74. void init_trigtab();
  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.  
  89. void initialize_rnd_variables();
  90.  
  91. // Functions
  92. value_type ff_src(value_type x,value_type y,value_type z);
  93. value_type ff_rad(value_type d,value_type m,value_type z);
  94. value_type ff_ctl(value_type i);
  95. value_type ff_val(value_type i,value_type a,value_type b);
  96. value_type ff_map(value_type i,value_type n);
  97. value_type ff_min(value_type a,value_type b);
  98. value_type ff_max(value_type a,value_type b);
  99. value_type ff_abs(value_type a);
  100. value_type ff_add(value_type a,value_type b,value_type c);
  101. value_type ff_sub(value_type a,value_type b,value_type c);
  102. value_type ff_dif(value_type a,value_type b);
  103. value_type ff_rnd(value_type a,value_type b);
  104. value_type ff_mix(value_type a,value_type b,value_type n,value_type d);
  105. value_type ff_scl(value_type a,value_type il,value_type ih,
  106.                                   value_type ol,value_type oh);
  107. value_type ff_sqr(value_type x);
  108. value_type ff_sin(value_type x);
  109. value_type ff_cos(value_type x);
  110. value_type ff_tan(value_type x);
  111. value_type ff_r2x(value_type d,value_type m);
  112. value_type ff_r2y(value_type d,value_type m);
  113. value_type ff_c2d(value_type d,value_type m);
  114. value_type ff_c2m(value_type d,value_type m);
  115. value_type ff_get(value_type i);
  116. value_type ff_put(value_type v,value_type i);
  117. value_type ff_cnv(value_type m11,value_type m12,value_type m13,
  118.                                   value_type m21,value_type m22,value_type m23,
  119.                                   value_type m31,value_type m32,value_type m33,
  120.                                   value_type d );
  121. value_type ff_rst(value_type seed);
  122.  
  123. // Variables
  124. value_type ff_i();
  125. value_type ff_u();
  126. value_type ff_v();
  127. value_type ff_D();
  128. value_type ff_d();
  129. value_type ff_M();
  130. value_type ff_m();
  131.  
  132. extern value_type min_val_i;
  133. extern value_type max_val_i;
  134. extern value_type min_val_u;
  135. extern value_type max_val_u;
  136. extern value_type min_val_v;
  137. extern value_type max_val_v;
  138. extern value_type min_val_d;
  139. extern value_type max_val_d;
  140. extern value_type val_D;
  141. extern value_type val_I;
  142. extern value_type val_U;
  143. extern value_type val_V;
  144.  
  145. #endif
  146.