int grad2D(int x, int y, int X, int Y, int grad, int dist, int repeat)
Returns the gradient value at the coordinates (x,y)
This is a gradient engine. It lets you choose between currently 12 gradient types and contains a parameter for switching between linear and sine distributed output. Additionally there's a parameter for setting the number of gradient repetitions. grad2D() returns a grayscaled gradient value. To produce color gradients, you have to scale the output for the r, g and b values yourself or use the function for each r, g and b value individually. You could also use grad2d() twice with different parameters and use blend() to merge the gradients. So there are a lot of different possibilities. Currently only returns 8-bit color values.
%ffp ctl(0): COMBOBOX(vscroll), Action=preview, Color=#FFFFFF, Fontcolor=#0000ff, Size=(60,200), Text="Horizontal\nVertical\n" "Diagonal\nDiagonal2\nRadial\n" "Ellipsoid\nPyramid\nBeam\n" "Angular\nStar\nQuarterPyramid1\n" "QuarterPyramid2\nQuarter Radial", Val=0 ctl(5): "Repeat", Pos=(270,30), Range=(0,128) ctl(1): CHECKBOX, Text="Invert", Pos=(270,40) ctl(2): CHECKBOX, Text="Sine Distribution", Pos=(270,50) ctl(3): CHECKBOX, Text="Do Some Color Mixing", Pos=(270,70) ForEveryTile: { int gradient, col; for (y=y_start; y < y_end; y++) { updateProgress(y,y_end); for (x=x_start; x < x_end; x++) { for (z=0; z < Z; z++) { if (ctl(3)) col=(z+1); else col=1; gradient = grad2D(x, y, X*col, Y*col, ctl(0), ctl(2), ctl(5)); if (ctl(1)) gradient = 255 - gradient; pset(x, y, z, gradient); } } } return true; }