/* test_post.c   generate intensity test pattern */

#include <stdio.h>
#include "draw_post.h"

int main()
{
  int i, j;
  float intensity; /* from 0.01 to 1.0 */
  int nx = 10; /* number of X steps */
  int ny = 10; /* number of Y steps */
  int xf = 100; /* x offset */
  int yf = 150; /* y offset */
  int xs = 40; /* s step size */
  int ys = 40; /* y step size */
  float denom = 100.0; /* nx * ny */
  char text[3];

  /* for 16x16 array of patches */
  nx = 16;
  ny = 16;
  denom = (float)(nx*ny);
  xs = 30;
  ys = 30;
  xf = 75;

  draw_post1("test_post.ps");
  draw_post2(xf-10, ny*ys+yf, xf, ny*ys+yf, 1.0);
  draw_post2(nx*xs+xf, ny*ys+yf, nx*xs+xf+10, ny*ys+yf, 1.0);
  for (i=0; i<ny; i++)
  {
    sprintf(text, "%d", i);
    draw_post2(xf-12, i*ys+yf, xf, i*ys+yf, 0.5);
    draw_post5(xf-12, i*ys+yf+ys/2-6, text, 12);
    draw_post2(nx*xs+xf, i*ys+yf, nx*xs+xf+8, i*ys+yf, 0.5);
    draw_post2(i*xs+xf, yf-12, i*xs+xf, yf, 0.5);
    draw_post5(i*xs+xf+xs/2-12, yf-12, text, 12);
    draw_post2(i*xs+xf, ny*ys+yf+ys, i*xs+xf, ny*ys+yf+ys+8, 0.5);
    for (j=0; j<nx; j++) 
    {
      intensity = (float)(ny*i+j+1)/denom;
      draw_post6(i*xs+xf, j*ys+yf, i*xs+xf+xs, j*ys+yf+ys, intensity);
    }
    intensity = (float)(ny*(i+1)+1)/denom;
    draw_post6(i*xs+xf, ny*ys+yf, i*xs+xf+xs, ny*ys+yf+ys, intensity);

  }
  draw_post99();
  printf("now print  test_post.ps \n");
  return 0;
} /* end main  test_post.c */



