home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1998 November / PCO_1198.ISO / filesbbs / os2 / tspg202s.arj / TSPG202S.ZIP / Scripts / REGSHAD.CWX < prev    next >
Encoding:
Text File  |  1997-05-04  |  2.5 KB  |  93 lines

  1. /*
  2.  
  3.   regshad.cwx
  4.  
  5.   Creates a typical drop-shadow for text.   Objects may need to be rearranged afterward.
  6.   Object with text region must be selected.
  7.  
  8.  Copyright 1997 by TrueSpectra Inc.                                  
  9.                                                                      
  10.  This code is provided purely for demonstration purposes and is not  
  11.  supported or under warranty.  Feel free to modify and examine this  
  12.  example script for your own purposes.                               
  13.  
  14. */
  15.  
  16.  
  17.  
  18.  
  19. handle = CwGetSelectedObject()
  20.  
  21. /* no object selected */
  22. if \CwIsHandleValid(handle) then do
  23.     say "No object selected."
  24.     exit
  25.     end
  26.  
  27. /* object must be block text or headline text */
  28. temp = CwGetProperty(handle, "Region type")
  29. if temp \= "Headline Text" & temp \= "Block Text" then do
  30.     say "Selected object must be text, not" temp
  31.     exit
  32.     end
  33.  
  34. duphandle = CwDuplicateObject(handle)
  35.  
  36. Ycenter = CwGetProperty(duphandle, "Position:Y Center")
  37. Xcenter = CwGetProperty(duphandle, "Position:X Center")
  38.  
  39. Height  = CwGetProperty(duphandle, "Position:Height")
  40. Width   = CwGetProperty(duphandle, "Position:Width")
  41.  
  42. /* move the line of text down one tenth of the object size */
  43. Ycenter = Ycenter - Height / 25
  44. Xcenter = Xcenter + Height / 25
  45.  
  46. call CwSetProperty duphandle, "Position:Y Center", Ycenter
  47. call CwSetProperty duphandle, "Position:X Center", Xcenter
  48.  
  49. /* make object black */
  50. call CwSetRegion duphandle, "Custom Region"
  51. call CwSetTool duphandle, "Solid Color"
  52. handle2 =  CwGetTool(duphandle)
  53.  
  54. red = CwGetProperty(handle2, "Color:Red")
  55. green = CwGetProperty(handle2, "Color:Green")
  56. blue = CwGetProperty(handle2, "Color:Blue")
  57.  
  58. red = 0
  59. green = 0
  60. blue = 0
  61.  
  62. call CwSetProperty handle2, "Color:Red", red
  63. call CwSetProperty handle2, "Color:Green", green
  64. call CwSetProperty handle2, "Color:Blue", blue
  65.  
  66. regview = CwGetRegion(duphandle)
  67. view2 = CwGetView(regview)
  68.  
  69. call CwCopy handle
  70. call CwSelectView view2
  71. call CwPaste
  72.  
  73. iv1 = CwFindFirstObject(CwGetCurrentView())
  74. iv2 = CwDuplicateObject(iv1)
  75.  
  76. call CwSetPosition iv1, Xcenter, Ycenter, Width, Height, 0, 0
  77. call CwSetTool iv1, "Solid Color"
  78.  
  79. call CwSetPosition iv2, Xcenter, Ycenter, Width, Height, 0, 0
  80. call CwSetRegion iv2, "Rectangle"
  81. call CwSetTool iv2, "Blur"
  82.  
  83. red = 128
  84. green = 128
  85. blue = 128
  86.  
  87. iv3 = CwGetTool(iv1)
  88. call CwSetProperty iv3, "Color:Red", red
  89. call CwSetProperty iv3, "Color:Green", green
  90. call CwSetProperty iv3, "Color:Blue", blue
  91.  
  92.  
  93. call CwMoveObjectBehindObject duphandle , handle