home *** CD-ROM | disk | FTP | other *** search
/ Power CD-ROM!! 7 / POWERCD7.ISO / prgmming / clipper / shadow.c < prev    next >
Text File  |  1993-05-10  |  3KB  |  103 lines

  1. /*
  2.  * File......: SHADOW.C
  3.  * Author....: Ian 'UnNamedDude' Day (L&W Computer Services Ltd.)
  4.  * BBS.......: The Dark Knight Returns
  5.  * Net/Node..: 050/069
  6.  * User Name.: Ian Day
  7.  * Date......: 02-25-92
  8.  * Revision..: 1.0
  9.  * Log file..: N/A
  10.  *
  11.  * This is an original work by [Ian Day] and is placed in the
  12.  * public domain.
  13.  *
  14.  * Modification history:
  15.  * ---------------------
  16.  *
  17.  * 04-30-93
  18.  * Initial Release
  19.  */
  20.  
  21. /*  $DOC$
  22.  *  $FUNCNAME$
  23.  *     GT_CSHADOW()
  24.  *  $CATEGORY$
  25.  *     Video
  26.  *  $ONELINER$
  27.  *     'C' Shadow routine that works with DISPBEGIN()/DISPEND()
  28.  *  $SYNTAX$
  29.  *     GT_CShadow(<nTop>, <nBottom>, <nLeft>, <nRight>) --> NIL
  30.  *  $ARGUMENTS$
  31.  *     <nTop> Top of box
  32.  *
  33.  *     <nLeft> Left of box
  34.  *
  35.  *     <nBottom> Bottom of box
  36.  *
  37.  *     <nRight> Right of box
  38.  *  $RETURNS$
  39.  *     NIL
  40.  *  $DESCRIPTION$
  41.  *     Draws a shadow around a box area (1 character on bottom and 2 on the
  42.  *     right.
  43.  *
  44.  *     Note: The module also includes a C/ASM callable function equivelant
  45.  *           in the form of:
  46.  *
  47.  *              void gt_Shadow (int t, int l, int b, int r);
  48.  *  $EXAMPLES$
  49.  *     @ 10, 20 TO 16, 60 DOUBLE
  50.  *     GT_CShadow(10, 20, 16, 60)
  51.  *  $SEEALSO$
  52.  *     GT_COLORWIN()
  53.  *  $INCLUDE$
  54.  *
  55.  *  $END$
  56.  */
  57.  
  58. #include "extend.h"
  59.  
  60. void gt_Shadow (int t, int l, int b, int r);
  61. static void ShadowConv (char * string);
  62.  
  63. /*╒═════════╤════════════════════════════════════════════════════════════════╕
  64.   │Function │gt_cShadow(<nTop>, <nLeft>, <nBottom>, <nRight>)                │
  65.   │Purpose  │Draw shadow (1 on bottom, 2 on right) [Uses internals]          │
  66.   │Author   │Ian Day                                                         │
  67.   │Date&Time│04-30-93 05:15pm                                                │
  68.   ╘═════════╧════════════════════════════════════════════════════════════════╛*/
  69. CLIPPER gt_cshadow()
  70. {
  71.    gt_Shadow (_parni (1), _parni (2), _parni (3), _parni (4));
  72.    _ret ();
  73. }
  74.  
  75. void gt_Shadow (int t, int l, int b, int r)
  76. {
  77.    char * string;
  78.  
  79.    string = _xgrab (320);   /* Maximum we're ever likely to need */
  80.  
  81.    _gtSave (b + 1, l + 2, b + 1, r, string);
  82.    ShadowConv (string);
  83.    _gtRest (b + 1, l + 2, b + 1, r, string);
  84.  
  85.    _gtSave (t + 1, r + 1, b + 1, r + 2, string);
  86.    ShadowConv (string);
  87.    _gtRest (t + 1, r + 1, b + 1, r + 2, string);
  88.  
  89.    _xfree (string);
  90. }
  91.  
  92. static void ShadowConv (char * string)
  93. {
  94.    register int loop;
  95.  
  96.    for (loop = 1; loop < 320; loop += 2) {
  97.       if (string[loop] < 0x80)
  98.          string[loop] &= (char)0x07;
  99.       else
  100.          string[loop] &= (char)0x77;
  101.    }
  102. }
  103.