home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 3 / PDCD_3.iso / utilities / utilsm / mkdrawf / Examples / src / Shading < prev    next >
Encoding:
Text File  |  1995-04-25  |  1.5 KB  |  73 lines

  1. # Shading, using the 3-integer representation of colours.
  2. # The drawfile this produces looks pretty wretched in modes with
  3. # 256 or fewer colours. It looks *really* wretched in 16-colour
  4. # modes. Sorry.
  5. # Incidentally, running this through mkdrawf takes just under 10s
  6. # on my machine.
  7.  
  8. # A rectangle shading from blue to red.
  9.  
  10. Group {
  11.   For $x 0 256 {
  12.     Path {
  13.       OutlineColour None
  14.       FillColour $x 0 Minus 255 $x
  15.       Move Plus $x 100 100
  16.       RLine 1 0
  17.       RLine 0 100
  18.       RLine -1 0
  19.       Close
  20.     }
  21.   }
  22. }
  23.  
  24. # A circular thingy. Very pretty.
  25.  
  26. Set $2Pi 6.28318530717959
  27. Set $Factor Over $2Pi 768
  28. Set $r0 100
  29. Set $r1 200
  30. Set $x0 300
  31. Set $y0 300
  32.  
  33. Define Ppp {
  34.   Path {
  35.     OutlineColour None
  36.     IfLess $x 256
  37.       FillColour $x Minus 255 $x 0
  38.     Else IfLess $x 512
  39.       FillColour Minus 511 $x 0 Minus $x 256
  40.     Else
  41.       FillColour 0 Minus $x 512 Minus 767 $x
  42.     EndIf EndIf
  43.     Set %c Cos Times $x $Factor
  44.     Set %s Sin Times $x $Factor
  45.     Set %cc Cos Times Plus $x 1 $Factor
  46.     Set %ss Sin Times Plus $x 1 $Factor
  47.     Move Plus $x0 Times %c $r0 Plus $y0 Times %s $r0
  48.     Line Plus $x0 Times %cc $r0 Plus $y0 Times %ss $r0
  49.     Line Plus $x0 Times %cc $r1 Plus $y0 Times %ss $r1
  50.     Line Plus $x0 Times %c $r1 Plus $y0 Times %s $r1
  51.     Close
  52.   }
  53. }
  54.  
  55. Group {
  56.   For $x 0 768 { Ppp { } }
  57. }
  58.  
  59. # Some daft text.
  60.  
  61. Group {
  62.   For $x 0 16 {
  63.     Set $u Minus 255 Times $x 17
  64.     Text {
  65.       Style Font "Trinity.Bold"
  66.       Size 80 100
  67.       Colour $u $u $u
  68.       StartAt Minus 300 $x Plus 150 $x
  69.       Text "This is silly."
  70.     }
  71.   }
  72. }
  73.