home *** CD-ROM | disk | FTP | other *** search
/ gondwana.ecr.mu.oz.au/pub/ / Graphics.tar / Graphics / VOGLE.ZIP / EXAMPLES / FJTEXT.FOR < prev    next >
Text File  |  2000-02-11  |  5KB  |  242 lines

  1. c
  2. c* demonstrate still more features of text
  3. c
  4.     program fjtext
  5.     integer BLACK, RED, GREEN, BLUE, YELLOW, MAGENTA, WHITE
  6.     integer CYAN
  7.     parameter(BLACK = 0)
  8.     parameter(RED = 1)
  9.     parameter(GREEN = 2)
  10.     parameter(YELLOW = 3)
  11.     parameter(BLUE = 4)
  12.     parameter(MAGENTA = 5)
  13.     parameter(CYAN = 6)
  14.     parameter(WHITE = 7)
  15.  
  16.     character *20 dev
  17.  
  18.     write(*,*)'Enter device: '
  19.     read(*, '(a)') dev
  20.     call vinit(dev)
  21.  
  22.     call textsize(0.03, 0.04)
  23.  
  24.     call ortho2(0.0, 1.0, 0.0, 1.0)
  25.  
  26.     call color(RED)
  27.     call clear
  28.  
  29.     call drawstuff
  30.  
  31. c
  32. c    Now do it all with the text rotated .... 
  33. c
  34.     call textang(45.0)
  35.     call drawstuff
  36.  
  37.     call textang(160.0)
  38.     call drawstuff
  39.  
  40.     call textang(270.0)
  41.     call drawstuff
  42.  
  43. c
  44. c    Now with a single character 
  45. c
  46.  
  47.     call textjustify(0)
  48.  
  49.     call drawstuff2(0.0)
  50.  
  51.     call drawstuff2(90.0)
  52.  
  53.     call drawstuff2(160.0)
  54.  
  55.     call drawstuff2(270.0)
  56.  
  57.     call vexit
  58.     end
  59.  
  60.     subroutine drawstuff
  61.     integer BLACK, RED, GREEN, BLUE, YELLOW, MAGENTA, WHITE
  62.     parameter(BLACK = 0)
  63.     parameter(RED = 1)
  64.     parameter(GREEN = 2)
  65.     parameter(YELLOW = 3)
  66.     parameter(BLUE = 4)
  67.     parameter(MAGENTA = 5)
  68.     parameter(WHITE = 7)
  69.  
  70.     call color(BLACK)
  71.     call polyfill(1)
  72. c        So rect clears a bit for us
  73.  
  74.     call rect(0.1, 0.1, 0.9, 0.9)
  75.     call color(WHITE)
  76.     call move2(0.1, 0.5)
  77.     call draw2(0.9, 0.5)
  78.     call move2(0.5, 0.1)
  79.     call draw2(0.5, 0.9)
  80.  
  81.     call color(GREEN)
  82.     call move2(0.5, 0.5)
  83.     call leftjustify
  84.     call drawstr('This is Left Justified text')
  85.  
  86.     call getkey
  87.  
  88.     call color(BLACK)
  89.     call rect(0.1, 0.1, 0.9, 0.9)
  90.     call color(WHITE)
  91.     call move2(0.1, 0.5)
  92.     call draw2(0.9, 0.5)
  93.     call move2(0.5, 0.1)
  94.     call draw2(0.5, 0.9)
  95.  
  96.     call color(YELLOW)
  97.     call move2(0.5, 0.5)
  98.     call centertext(1)
  99.     call drawstr('This is Centered text')
  100.     call centertext(0)
  101.  
  102.     call getkey
  103.  
  104.     call color(BLACK)
  105.     call rect(0.1, 0.1, 0.9, 0.9)
  106.     call color(WHITE)
  107.     call move2(0.1, 0.5)
  108.     call draw2(0.9, 0.5)
  109.     call move2(0.5, 0.1)
  110.     call draw2(0.5, 0.9)
  111.  
  112.     call color(MAGENTA)
  113.     call move2(0.5, 0.5)
  114.     call rightjustify
  115.     call drawstr('This is Right Justified text')
  116.     call textjustify(0)
  117.  
  118.     call getkey
  119.     end
  120.  
  121.     subroutine drawstuff2(ang)
  122.     integer BLACK, RED, GREEN, BLUE, YELLOW, MAGENTA, WHITE
  123.     parameter(BLACK = 0)
  124.     parameter(RED = 1)
  125.     parameter(GREEN = 2)
  126.     parameter(YELLOW = 3)
  127.     parameter(BLUE = 4)
  128.     parameter(MAGENTA = 5)
  129.     parameter(WHITE = 7)
  130.  
  131.     call color(BLACK)
  132.     call rect(0.1, 0.1, 0.9, 0.9)
  133.     call color(WHITE)
  134.     call move2(0.1, 0.5)
  135.     call draw2(0.9, 0.5)
  136.     call move2(0.5, 0.1)
  137.     call draw2(0.5, 0.9)
  138.  
  139.  
  140.     call textang(ang)
  141.     call color(GREEN)
  142.     call move2(0.5, 0.5)
  143.     call leftjustify
  144.     call drawchar('B')
  145.  
  146.     call textang(0.0)
  147.     call textjustify(0)
  148.     call boxtext(0.1, 0.1, 0.4, 0.02, 
  149.      +   'The ''B'' should be leftjustified')
  150.     call pushattributes
  151.     call getkey
  152.  
  153.     call color(BLACK)
  154.     call rect(0.1, 0.1, 0.9, 0.9)
  155.     call color(WHITE)
  156.     call move2(0.1, 0.5)
  157.     call draw2(0.9, 0.5)
  158.     call move2(0.5, 0.1)
  159.     call draw2(0.5, 0.9)
  160.  
  161.     call textang(ang)
  162.     call color(YELLOW)
  163.     call move2(0.5, 0.5)
  164.     call centertext(1)
  165.     call drawchar('B')
  166.     call centertext(0)
  167.     call textang(0.0)
  168.     call textjustify(0)
  169.     call boxtext(0.1, 0.1, 0.4, 0.02, 
  170.      +   'The ''B'' should be centered')
  171.     call pushattributes
  172.  
  173.     call getkey
  174.  
  175.     call color(BLACK)
  176.     call rect(0.1, 0.1, 0.9, 0.9)
  177.     call color(WHITE)
  178.     call move2(0.1, 0.5)
  179.     call draw2(0.9, 0.5)
  180.     call move2(0.5, 0.1)
  181.     call draw2(0.5, 0.9)
  182.  
  183.     call textang(ang)
  184.     call color(MAGENTA)
  185.     call move2(0.5, 0.5)
  186.     call rightjustify
  187.     call drawchar('B')
  188.     call textang(0.0)
  189.     call textjustify(0)
  190.     call boxtext(0.1, 0.1, 0.4, 0.02, 
  191.      +   'The ''B'' should be rightjustified')
  192.     call pushattributes
  193.  
  194.     call getkey
  195.  
  196.     call color(BLACK)
  197.     call rect(0.1, 0.1, 0.9, 0.9)
  198.     call color(WHITE)
  199.     call move2(0.1, 0.5)
  200.     call draw2(0.9, 0.5)
  201.     call move2(0.5, 0.1)
  202.     call draw2(0.5, 0.9)
  203.  
  204.     call textang(ang)
  205.     call color(MAGENTA)
  206.     call move2(0.5, 0.5)
  207.     call topjustify
  208.     call drawchar('B')
  209.     call textang(0.0)
  210.     call textjustify(0)
  211.     call boxtext(0.1, 0.1, 0.4, 0.02, 
  212.      +   'The ''B'' should be topjustified')
  213.     call pushattributes
  214.  
  215.     call getkey
  216.  
  217.     call color(BLACK)
  218.     call rect(0.1, 0.1, 0.9, 0.9)
  219.     call color(WHITE)
  220.     call move2(0.1, 0.5)
  221.     call draw2(0.9, 0.5)
  222.     call move2(0.5, 0.1)
  223.     call draw2(0.5, 0.9)
  224.  
  225.     call textang(ang)
  226.     call color(MAGENTA)
  227.     call move2(0.5, 0.5)
  228.     call topjustify
  229.     call rightjustify
  230.     call drawchar('B')
  231.     call textang(0.0)
  232.     call textjustify(0)
  233.     call boxtext(0.1, 0.1, 0.4, 0.02, 
  234.      +   'The ''B'' should be right/topjustified')
  235.  
  236. c
  237.     call textjustify(0)
  238.  
  239.     call getkey
  240.  
  241.     end
  242.