;distort  --  demonstrates geometric operations using general TIM routines
;expects:     image in a, LUTs initialized by '*ini*
;*********************************
#include timdefs.h

parms
  int windis
endparms

int err
float fx1 = 99.0
float fy1 = 11.0
float fx2 = 222.0
float fy2 = 22.0
float xstep = 1.0001
float ystep = 1.1
ibuf er
era x
cls
dest q
show q
cstr a 
era 1
*windispl h (windis+WINLUT1)
dest p
copy q s
*selut 3
;err = chk lut 2 3
int lno = 0
dis q
drln q fy1 fx1 fy2 fx2 red
while lno < 158
  rdln s fy1 fx1 fy2 fx2        ;get pixels along line
  ihis p lno                     ;write into p (in line)
  bgm q red fy1 fx1                ;write single dot into q
  bgm q red fy2 fx2
  drln r fy1 fx1 fy2 fx2 red       ;draw line in other image for control
  fy1 += ystep
  fy2 += ystep
  xstep *= 1.005
  fx1 = fx1 + 1 - xstep
  fx2 = fx2 + 1 - xstep
  lno += 1
endw
drln q fy1 fx1 fy2 fx2 red
dest q
*windispl h (windis+WINLUT3+BITCOPY1)
dest p
*windispl i windis
stop

