home *** CD-ROM | disk | FTP | other *** search
- /* SHDW.C
- Clipper function Shadow(), which creates "see through" shadows
- to the right and below a box, given its dimensions.
-
- Syntax : Shadow( <N top>, <N left>, <N bottom>, <N right>)
- Return : None
- Compile: I used MSC 5.1 in the following manner -
- cl /c /AL /Zl /Oalt /FPa /Gs shdw.c
- Link : I used MS Overlay Linker v3.65 -
- link /se:256 /noe test shdw,,,clipper extend
- */
-
- /* Header files required by Clipper */
- #include <nandef.h>
- #include <extend.h>
-
- /* Video mode can be found at segment 0x0040 offset 0x0049
- Mode = 7 if mono display adapter is in use
- The starting address (segments & offsets) is different
- for color vs monochrome.
- */
-
- extern _MAXROW; /* Clipper internal */
-
- #define VIDEO_MODE *(char far *)0x00400049
- #define MONO_MODE 0x07
- #define COLOR_PTR 0xB8000000
- #define MONO_PTR 0xB0000000
- #define GREY_ON_BLACK 0x07
- #define TEXT_ROWS 24
-
- /* The next line is commented out because it only works on EGA/VGA
- It is left here only as a reference to the memory location.
-
- #define TEXT_ROWS *(char far *)0x00400084 + 1
- */
-
- CLIPPER Shadow()
- {
- char far *scrn_ptr;
- unsigned int offset, top, left, bottom, right, upper_right, lower_right;
- unsigned int lower_left;
-
- /* Depending on the adapter installed, set starting address */
- scrn_ptr = ( char far *)(VIDEO_MODE == MONO_MODE ? MONO_PTR : COLOR_PTR);
-
- /* Receive parameters passed by Clipper and
- adjust for desired location of shadows. */
- top = _parni(1) + 1;
- left = _parni(2) + 1;
- bottom = _parni(3) + 1;
- right = _parni(4) + 1;
-
- /* Make sure that shadow won't go off the edge of screen */
- if( (bottom < TEXT_ROWS) && (right < 80) )
- {
-
- /* The next 3 vars aren't necessary, but they keep the FOR statements
- from running over 80 characters long & they reduce EXE size.
- */
-
- upper_right = (((top * 80) + right) * 2) + 1;
- lower_right = (((bottom * 80) + right) * 2) + 1;
- lower_left = (((bottom * 80) + left) * 2) + 1;
-
- /* shadow below the box - attribute 0x07 sets color to grey on black */
- for( offset = lower_left; offset <= lower_right; offset = offset + 2)
- *(scrn_ptr + offset) = GREY_ON_BLACK;
-
- /* shadow to the right of box */
- for( offset = upper_right; offset <= lower_right; offset = offset + 160)
- *(scrn_ptr + offset) = GREY_ON_BLACK;
- }
-
- _ret();
- }
-