home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / grafik / vifs / wdescr.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-08-13  |  1.4 KB  |  60 lines

  1. /*
  2.  *    wdescr.c  --  write an if description to file.
  3.  *
  4.  *    8 july 1989  Olle Olsson.
  5.  */
  6.  
  7. #include "ifs.h"
  8.  
  9.  
  10. void wdescr( of, dp, com, show )
  11. FILE *of;            /* input file */
  12. ifsdes *dp;            /* descriptor to be filled */
  13. char *com;            /* comment to write */
  14. int show;            /* trace flag */
  15. {
  16. transform *tp;
  17. int i;
  18.  
  19. /* write the comment */
  20. fprintf( of, "%c %s\n\n", COMMENTCH, com );
  21.  
  22. /* 1st line: write size, density and im mode */
  23. fprintf( of, "%c transformation count; density; inv.meas.mode\n", COMMENTCH );
  24. fprintf( of, "%15d %15f %15d\n\n", dp -> size, dp -> density, dp -> im );
  25.  
  26. /* 2nd line: the plot area */
  27. fprintf( of, "%c x0  xlen  y0  ylen\n", COMMENTCH );
  28. fprintf( of, "  %g %g %g %g\n\n",
  29.     dp -> area.xlow, dp -> area.xlen,
  30.     dp -> area.ylow, dp -> area.ylen );
  31.  
  32. /* 3rd..3+size lines: the transformations */
  33. fprintf( of, "%c a11  a12   a21   a22   b1    b2    pr   color group\n",
  34.                              COMMENTCH );
  35. for (tp = dp -> tp, i = 0; i < dp -> size; ++tp, ++i)
  36.     {
  37.     fprintf( of, "%g %g %g %g %g %g %g %d %d\n",
  38.         tp -> a11, tp -> a12, tp -> a21, tp -> a22,
  39.         tp -> b1, tp -> b2, tp -> prob,
  40.         tp -> color, tp -> group );
  41.     }
  42.  
  43. fprintf( of, "\n" );
  44.  
  45. /* the palette */
  46. fprintf( of, "%c colors (r,g,b)   (the first is the background)\n",
  47.                                  COMMENTCH );
  48. for (i = 0; i < dp -> clrsize; ++i)
  49.     {
  50.     fprintf( of, "%d %d %d\n",
  51.         dp -> colors[i].r, dp -> colors[i].g, dp -> colors[i].b );
  52.     }
  53.  
  54. if (show)
  55.     printf( "wdescr ok\n" );
  56.  
  57. }
  58.  
  59.  
  60.