;  dfill1 -  fills holes in objects
;expects:  binary image in a
;******************************************
#include timdefs.h

parms
  int windis
endparms

int num
int count
cls
era x
dest p
show p
copy a
*windispl h (windis+NO_DITHER+WINLUT1)
if (num = (label a)) == 0     ;separate objects & test image
   print @8 "Something wrong with image!"
   stop
endif
dest q
for count = 1 to num step 1
  mark p count          ;find object
  keep qc red           ;keep bitplane 1 (RED)
  binv qc red           ;invert
  bbord qc green        ;put border in bitplane 2 (GREEN)
  lpr4 qc green red     ;propagate from outside into object
  binv qc green         ;take propagated result and invert
  bit qc green          ;copy all bitplanes from green
  *windispl i (windis+NO_DITHER)
endfor
stop



