import std.stdio;
import std.math;
import Dislin;

void main (string[] args)
{ int nl, nx, nx0 = 335, ny0 = 350, ny, i, j, ii, k, iclr;
  int [4]  ixp, iyp;
  int [4] ix = [0, 300, 300, 0];
  int [4] iy = [0, 0, 400, 400];
  char *ctit = "Shading Patterns (AREAF)";
  char [3] cstr;
    
  metafl ("xwin");
  disini ();
  setvlt("small");
  hwfont ();
  pagera ();

  height (50);
  nl = nlmess (ctit);
  nx = (2970 - nl) / 2;
  messag (ctit, nx, 200);

  iclr = 0;
  for (i = 0; i < 3; i++)
  { ny = ny0 + i * 600;
    for (j = 0; j < 6; j++)
    { nx = nx0 + j * 400;
      ii = i * 6 + j;
      shdpat(ii);
      nl = intcha (ii, cast (char *) cstr);

      iclr = iclr % 8;
      iclr++;
      setclr (iclr);

      for (k = 0; k < 4; k++)
      { ixp[k] = ix[k] + nx;
        iyp[k] = iy[k] + ny;
      }
      areaf(cast (int *) ixp, cast (int *) iyp,4);

      nl  = nlmess (cast (char *) cstr);
      nx += (300 - nl) / 2;
      messag (cast (char *) cstr, nx, ny + 460);
    }
  }

  disfin ();
}
