home *** CD-ROM | disk | FTP | other *** search
/ Merciful 3 / Merciful_Release_3.bin / software / d / draw_studio / drawstudiov1.0.2a.dms / drawstudiov1.0.2a.adf / DSdir1.lha / Rexx / ShadowSoft.dsrx < prev    next >
Text File  |  1996-11-03  |  4KB  |  194 lines

  1. /* Allow commands to return results */
  2.  
  3. options results
  4.  
  5. /* On error, goto ERROR:. Comment out this line if you wish to */
  6. /* perform your own error checking. */
  7.  
  8. signal on error
  9.  
  10. 'PROJECT_LOCK'
  11.  
  12. /* BEGIN PROGRAM *************************************************/
  13.  
  14. /*
  15. PROGRAM:        ShadowSoft.dsdr
  16. DESCRIPTION:    Draws a soft shadow for the selected object(s).
  17.         The shadow is offset by some amount, which may
  18.         be re-positioned later. Change the "Offset"
  19.         value below to change the default shadow offset.
  20.         Change the "Size" value to determine amount
  21.         of "blur" in the shadow.
  22. DATE:           03/11/96
  23. AUTHOR:         Andy Dean
  24. */
  25.  
  26. Offset = '0.25in'
  27. Size = 0.05
  28. Opacity = 6
  29.  
  30. /* Offset shadows */
  31.  
  32. offsetx.1 = 0.000
  33. offsety.1 = 1.000
  34. offsetx.2 = 0.707
  35. offsety.2 = 0.707
  36. offsetx.3 = 1.000
  37. offsety.3 = 0.000
  38. offsetx.4 = 0.707
  39. offsety.4 = -0.707
  40.  
  41. offsetx.5 = 0.000
  42. offsety.5 = -1.000
  43. offsetx.6 = -0.707
  44. offsety.6 = -0.707
  45. offsetx.7 = -1.000
  46. offsety.7 = -1.000
  47. offsetx.8 = -0.707
  48. offsety.8 = 0.707
  49.  
  50. REDRAW_OFF
  51.  
  52. /* Get info on the selected object(s) */
  53.  
  54. OBJECT_SPECS_GET stem 'srcobj.'
  55.  
  56. /* If there's more than 1 object, group them */
  57. /* and store their name */
  58.  
  59. if srcobj.numselected > 1 then do
  60.     OBJECT_GROUP stem 'srcgrp.'
  61.  
  62.     srcname = srcgrp.name
  63.     end
  64. else do
  65.     srcname = srcobj.name
  66.     end
  67.  
  68. /* Clone the original object 8 times, offsetting */
  69. /* Each copy in a circle to provide a blurred effect */
  70.  
  71. do l = 1 to 8 
  72.     /* How big is the blur ? */
  73.  
  74.     offx = Size * offsetx.l
  75.     offy = Size * offsety.l
  76.  
  77.     /* Clone the object, offsetting slightly */
  78.  
  79.     OBJECT_CLONE '"'offx'in"' '"'offy'in"'
  80.  
  81.     /* Get the name of the new object and store it */
  82.  
  83.     OBJECT_SPECS_GET stem 'clone.'
  84.     cloneobj.l = clone.name
  85.  
  86.     /* Fill the object to transparent black */
  87.  
  88.     ATTRS_FILLCOLOUR_SET 0 0 0 Opacity
  89.     ATTRS_PENFILL_SET None None
  90.  
  91.     /* Deselect the cloned object and select the */
  92.     /* original again */
  93.  
  94.     OBJECT_DESELECT '"'cloneobj.l'"'
  95.     OBJECT_SELECT '"'srcname'"'
  96.  
  97.     end
  98.  
  99. /* Deselect all */
  100.  
  101. OBJECT_DESELECT
  102.  
  103. /* Group all shadow objects */
  104.  
  105. do l = 1 to 8
  106.     OBJECT_SELECT '"'cloneobj.l'"'
  107.     end
  108.  
  109. OBJECT_GROUP
  110.  
  111. /* Offset shadow and deselect */
  112.  
  113. OBJECT_MOVE Offset Offset
  114.  
  115. OBJECT_DESELECT
  116.  
  117. /* Select original object and bring to front */
  118.  
  119. OBJECT_SELECT '"'srcname'"'
  120.  
  121. OBJECT_TOFRONT
  122.  
  123. /* If it was grouped, ungroup */
  124.  
  125. if srcobj.numselected > 1 then
  126.     OBJECT_UNGROUP
  127.  
  128. REDRAW_ON
  129.  
  130. /* END PROGRAM ***************************************************/
  131.  
  132. 'PROJECT_UNLOCK'
  133.  
  134. exit
  135.  
  136. /* On ERROR */
  137.  
  138. ERROR:
  139.  
  140. 'PROJECT_UNLOCK'
  141.  
  142. /* If we get here, either an error occurred with the command's */
  143. /* execution or there was an error with the command itself. */
  144. /* In the former case, rc2 contains the error message and in */
  145. /* the latter, rc2 contains an error number. SIGL contains */
  146. /* the line number of the command which caused the jump */
  147. /* to ERROR: */
  148.  
  149. if datatype(rc2,'NUMERIC') == 1 then do
  150.     /* See if we can describe the error with a string */
  151.  
  152.     select
  153.         when rc2 == 103 then
  154.             err_string = "ERROR 103, "||,
  155.                 "out of memory at line "||SIGL
  156.         when rc2 == 114 then
  157.             err_string = "ERROR 114, "||,
  158.                 "bad command template at line "||SIGL
  159.         when rc2 == 115 then
  160.             err_string = "ERROR 115, "||,
  161.                 "bad number for /N argument at line "||SIGL
  162.         when rc2 == 116 then
  163.             err_string = "ERROR 116, "||,
  164.                 "required argument missing at line "||SIGL
  165.         when rc2 == 117 then
  166.             err_string = "ERROR 117, "||,
  167.                 "value after keywork missing at line "||SIGL
  168.         when rc2 == 118 then
  169.             err_string = "ERROR 118, "||,
  170.                 "wrong number of arguments at line "||SIGL
  171.         when rc2 == 119 then
  172.             err_string = "ERROR 119, "||,
  173.                 "unmatched quotes at line "||SIGL
  174.         when rc2 == 120 then
  175.             err_string = "ERROR 120, "||,
  176.                 "line too long at line "||SIGL
  177.         when rc2 == 236 then
  178.             err_string = "ERROR 236, "||,
  179.                 "unknown command at line "||SIGL
  180.         otherwise
  181.             err_string = "ERROR "||rc2||", at line "||SIGL
  182.         end
  183.     end
  184. else if rc2 == 'RC2' then do
  185.     err_string = "ERROR in command at line "||SIGL
  186.     end
  187. else do
  188.     err_string = rc2||", line "||SIGL
  189.     end
  190.  
  191. req_message TEXT '"'err_string'"'
  192.  
  193. exit
  194.