Nice, somehow this is faster than my ARYOP version...
Anyway there are a few minor mistakes:
- FOR I=0 TO H should be FOR I=0 TO W-1
- F = ABS(N-1) can be F = 1-N (Results are the same, but it's simpler)
- Y+H and X+W should be Y+H-1 and X+H-1
And you should make this into a function:
DEF GRADIENT X,Y,W,H,C1,C2,VERTICAL IF VERTICAL THEN SWAP W,H VAR R1,G1,B1,R2,G2,B2 RGBREAD C1 OUT R1,G1,B1 RGBREAD C2 OUT R2,G2,B2 VAR I FOR I=0 TO W-1 VAR N=I/(W-1) VAR F=1-N VAR R=R1*F+R2*N VAR G=G1*F+G2*N VAR B=B1*F+B2*N IF VERTICAL THEN GLINE X,Y+I,X+H-1,Y+I,RGB(R,G,B) ELSE GLINE X+I,Y,X+I,Y+H-1,RGB(R,G,B) ENDIF END