home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a013 / 1.ddi / SOURCE.EXE / F_SHADOW.PRG < prev    next >
Encoding:
Text File  |  1991-01-25  |  1.7 KB  |  65 lines

  1.  
  2.  
  3. STATIC counter := 0, screens := { {''}, {''} }
  4.  
  5. *****************************************************************
  6. FUNCTION SHADOW (top, left, bottom, right, attribute)
  7. *****************************************************************
  8.  
  9. * Display a shadow (in any color) below and right of boxed area
  10.  
  11. * Copyright(c) 1991 -- James Occhiogrosso
  12.  
  13. LOCAL pointer := shad_cnt := shad_len := 0, shadow := ''
  14.  
  15. * Increment shadow counter, shadow coordinates and stack array
  16. counter++ ; bottom++ ; right++
  17. ASIZE(screens[1], counter) ; ASIZE(screens[2], counter)
  18.  
  19. * Use attribute if passed, otherwise default is black background
  20. attribute = IF(VALTYPE(attribute) == 'N', attribute, 7)
  21.  
  22. * Push shadow area on screen stack for restoring
  23. screens[1, counter] = SCRNSAVE(bottom, left+1, bottom, right+1)
  24. screens[2, counter] = SCRNSAVE(top+1, right, bottom, right+1)
  25.  
  26. * Display shadow only if coordinates are on screen
  27.  
  28. IF bottom <= MAXROW() .AND. right <= MAXCOL() - 1
  29.  
  30.     FOR shad_cnt = 1 TO 2
  31.  
  32.         * Create vertical and horizontal shadows
  33.         shad_len = LEN(screens[shad_cnt, counter])
  34.         shadow = screens[shad_cnt, counter]
  35.  
  36.         * Stuff new attribute in shadow variable
  37.         FOR pointer = 6 TO shad_len STEP 2
  38.             shadow = STUFF(shadow, pointer, 1, CHR(attribute))
  39.         NEXT
  40.  
  41.         * Display shadow screen
  42.         SCRNREST(shadow)
  43.     NEXT
  44. ENDIF
  45.  
  46. RETURN NIL
  47.  
  48.  
  49. *****************************************************************
  50. FUNCTION CLRSHADOW
  51. *****************************************************************
  52.  
  53. * Restore shadowed screen areas
  54.  
  55. IF counter > 0
  56.  
  57.     SCRNREST(screens[1, counter])
  58.     SCRNREST(screens[2, counter])
  59.  
  60.     * Decrement screen counter
  61.     counter--
  62. ENDIF
  63. RETURN NIL
  64.  
  65.