home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / code / oslib / Examples / p3-549 < prev    next >
Encoding:
Text File  |  1994-03-24  |  1.7 KB  |  64 lines

  1. #include "draw.h"
  2.  
  3. #define PATH_LEN 256
  4.  
  5. static int Path [PATH_LEN/sizeof (int)], Path_Ptr = 0;
  6. static os_error Too_Small = {0, "Insufficient path buffer"};
  7.  
  8. void add (int value)
  9.  
  10. {  if (Path_Ptr + 1 > COUNT (Path))
  11.       os_generate_error (&Too_Small);
  12.  
  13.    Path [Path_Ptr++] = value;
  14. }
  15.  
  16. int main (void)
  17.  
  18. {  int xsize, ysize, xscale, yscale;
  19.    os_trfm trfm;
  20.    draw_path *path = (draw_path *) Path;
  21.    draw_line_style line_style;
  22.  
  23.    xsize = 210000, ysize = 160000;
  24.  
  25.    xscale = 1280*256/xsize << 16;
  26.    yscale = 1024*256/ysize << 16;
  27.  
  28.    trfm.entries [0] [0] = xscale;
  29.    trfm.entries [0] [1] = 0;
  30.    trfm.entries [1] [0] = 0;
  31.    trfm.entries [1] [1] = yscale;
  32.    trfm.entries [2] [0] = 0;
  33.    trfm.entries [2] [1] = 0;
  34.  
  35.    line_style.join_style = draw_JOIN_BEVELLED;
  36.    line_style.end_cap_style = draw_CAP_ROUND;
  37.    line_style.start_cap_style = draw_CAP_ROUND;
  38.    line_style.reserved = 0;
  39.    line_style.mitre_limit = 0;
  40.    line_style.start_cap_width = 0;
  41.    line_style.start_cap_length = 0;
  42.    line_style.end_cap_width = 0;
  43.    line_style.end_cap_length = 0;
  44.  
  45.    add (draw_MOVE_TO), add (80000), add (80000);
  46.    add (draw_LINE_TO), add (80000), add (120000);
  47.    add (draw_LINE_TO), add (170000), add (120000);
  48.    add (draw_LINE_TO), add (170000), add (80000);
  49.    add (draw_MOVE_TO), add (50000), add (50000);
  50.    add (draw_BEZIER_TO), add (80000), add (80000),
  51.          add (85000), add (30000), add (50000), add (60000);
  52.    add (draw_CLOSE_GAP);
  53.    add (draw_END_PATH), add (PATH_LEN - (Path_Ptr + 1)*sizeof (int));
  54.    
  55.    os_writen ("\x1D\0\0\0\0", 5);
  56.    draw_stroke (path, NONE, &trfm, xsize/640, 5000, &line_style, NULL);
  57.  
  58.    trfm.entries [2] [0] = 60 << 8;
  59.    trfm.entries [2] [1] = -100 << 8;
  60.    draw_stroke (path, NONE, &trfm, xsize/640, 2500, &line_style, NULL);
  61.  
  62.    return 0;
  63. }
  64.