For Filter Factory compatibility only
int map(int i, int n)
The pixel value mapped to the narrower range of values.
The map function takes two consecutive STANDARD values and maps the given pixel value between them. Lowering the Map 1 slider value causes the image to brighten, while raising the Map 2 slider value causes it to darken, if applied to an entire image.
Internally, the map function works like this:
(n < MAP2) ? 0 : (n > MAP1) ? 255 : (MAP1 == MAP2) ? 255 : (n-MAP2)*255/(MAP1-MAP2);
%ffp ctl[2]: "Map 1", Range=(0,255), Val=255 ctl[3]: "Map 2", Range=(0,255), Val=0 ForEveryTile: { for (y = y_start; y < y_end; y++) { for (x = x_start; x < x_end; x++) { for (z=0; z < 3; z++) { pset(x,y,z, map(1, src(x,y,z)) ); } } } return true; }