Filters Unlimited and Filter Factory Language Reference

Operator Definition
, Sequence. Evaluate left side, return right side
?: Conditional if
&&, || Logical and, logical or
&, ^, | Bitwise and, bitwise exclusive or, bitwise or
==, != Equal to, not equal to
<, <=, >, >= Less than, less than or equal to, greater than, greater than or equal to
<<, >> Bitwise shift left / shift right
*, /, % Multiply, divide, modulo
+, – Add, subtract
!, ~ Logical not, bitwise not
   
Variable Definition
r, g, b Red, green, and blue channel values for the current pixel
a Alpha channel value for the current pixel (transparency)
c Value of the current channel (0 for r, 1 for g, 2 for b, 3 for a)
i, u, v Calculated channel values for the current pixel in YUV space
x, y Coordinates of the current pixel
z Channel index for the current expression (0=r, 1=g, 2=b, 3=a)
d Direction (angle) of the current pixel from the center of the image
m Distance (magnitude) from the center of the image to the current pixel
X Range of horizontal coordinates over the width of the image
Y Range of vertical coordinates over the height of the image
Z Range of channel indexes within one pixel
D Range of angles within the image (1024 always)
M Range of magnitudes with the image
   
Function Definition
src(x,y,z) Channel z for the pixel at coordinates x,y
rad(d,m,z) Channel z in the source image, m units away, at angle of d
ctl(i) Value of slider i, where i is an integer between 0 and 7, inclusive
val(i,a,b) Value of slider i, mapped onto the range a to b
min(a,b) Lesser of a and b
max(a,b) Greater of a and b
abs(a) Absolute value of a
add(a,b,c) Sum of a and b, or c, whichever is lesser
sub(a,b,c) Difference of a and b, or c, whichever is greater
dif(a,b) Absolute value of the difference of a and b
rnd(a,b) Random number between a and b, inclusive
mix(a,b,n,d) Mixture of a and b by fraction n/d, a*n/d+b*(d-n)/d
scl(a,il,ih,ol,oh) Scale a from input range (il to ih) to output range (ol to oh)
sqr(x) Square root of x
sin(x) Sine of x
cos(x) Cosine of x
tan(x) Tangent of x
r2x(d,m) x displacement of the pixel m units away, at an angle of d
r2y(d,m) y displacement of the pixel m units away, at an angle of d
c2d(x,y) Angle displacement of the pixel at coordinates x,y
c2m(x,y) Magnitude displacement of the pixel at coordinates x,y
get(i) Returns the current cell value at i
put(v,i) Puts the new value v into cell i
cnv(m11,m12, m13,m21, m22, m23,m31, m32, m33, d) Convolution kernel
   
Filters Unlimited Extensions
rst(n) Random seed.
n = -1: Initialize with current system time.
sgn(n) sign of n. n<0:-1, n>0:+1, n==0:0
srcmode(n) controls return values for access of pixels outside valid image
or bitmap region

n = 0 : edge replication (default if not explicitly set)
n = 1 : black (r = 0, g = 0, b = 0)
n = 2 : modulo image dimensions (x % X, y % Y)
n = 3 : modulo and mirror src(X+1, Y+1, z) => src(X-1, Y-1, z)

Use in “I-Section”only!

Example for the following code: src(x*2, y*2, z)

storage(n) set storage size ( put(0..n-1), get(0..n-1) )

n should never exceed 64000 elements

Use in “I-Section”only!
gamma(r,g,b) Setup gamma lookup tables.

r,g,b = 255 means gamma 1.0, r,g,b = 511 means gamma 2.0

Use in “I-Section”only!
gam(n, z) Lookup value in gamma table. n range 0..255, z range 0..2
hmin(z) minimum value of channel z of the whole image
hmax(z) maximum value of channel z of the whole image
frg(z) current foreground color, channel z
bkg(z) current background color, channel z
icnv(m11, m12, m13, m21, m22, m23, m31, m32, m33, d) Intensity convolution kernel. Involves channel 0..2
xycnv(x, y, m11, m12, m13, m21, m22, m23, m31, m32, m33, d) Convolution kernel at position x,y
i(x,y) Intensity at coordinate x,y
gradient(n) Select a gradient. n range 0..99

n = -1 activates the manual gradient selector

Use in “I-Section” only!
grad(n, z) Access gradient data. n range 0..255, z range 0..3
bmap(n, x, y) Access built-in bitmaps:

n = 0: Cloud structure
n = 1: Complex cloud structure
n = 2: Wood structure 1
n = 3: Wood structure 2
n = 4: Stones
n = 5: Puzzle

x, y range: 0..255 (reacts also on srcmode(n))
BX, BY Internal bitmap width/height
bmapsize(w,h) Resize internal bitmaps to w,h
cmap(x,y,z) Access to custom, loadable bitmap
cmapsize(w,h) Resize custom bitmap
CX, CY Custom bitmap width/height
sbd(x, y) Smallest border distance to current selection (rectangular)
case(n, c1:r1, ...) Case Expression. n gives the case, r1 returned if case c1 is true)

Examples:

case(rnd(0, 2), 0:sin(x), 1:cos(x), 2:tan(x))

case(val(0, 0, 3),
0: abs(get(0) + get(1)),
1: dif(get(0), get(1)),
2: min(get(0), get(1)),
3: max(get(0), get(1))
)
hue(n, z) Returns hue part n of channel z

n range 0..255 (should be 0..360 degrees)
z range 0..2
tri(n) Works exactly like sin(x) but returns a triangular wave instead
of a sine wave
bell(n) Access to a gaussian bell curve.

n range 0..255
output range 0..1023
med3(x,y,z) 3x3 Median at position x,y channel z
nbd(x,y,n)  Nearest Border

n = 0..1

Returns: 1 = left, 2 = top, 3 = right, 4=bottom, 0 = body
gblur(x,y,z,n) Gaussian blur at position x,y channel z radius n/10
   


I.C.NET Software GmbH
Michael Johannhanwahr
Robert-Bunsen-Str. 70
28357 Bremen, Germany

http://www.icnet.de
info@icnet.de
support@icnet.de

Filters Unlimited is Copyright © 1999-2003 I.C.NET Software GmbH. All rights reserved.
Filter Factory is Copyright © Adobe® Systems, Inc.