PSPAINT (SURFACE Graphics)

dftone, dfrgbt, dfcols, dfc40s | dframe, dframo, paintm, paintw, dresol
| dfpcol, paintc, paintr, paintp | (Example)

DFTONE, DFRGBT, DFCOLS, DFC40S
NAME
    dftone - Define and assign monochromatic gray-scale grading
              for 2D surface representation 'paintm'
    dfrgbt - Define and assign color grading
              for 2D surface representation 'paintm'
    dfcols - Auto-generate and assign color grading
              for 2D surface representation 'paintm',
             and also auto-generate shaded color grading
              for dual 2D surfaces representation 'paintw'
    dfc40s - Assign to use standard 40 color grading

SYNOPSIS

      call dftone(nlevel, mtone, ktnlo, ktnhi, ktnvd)
  nlevel  [int]   Number of gray-scale grading levels (no more than 50)
  mtone   [int]   Array defining gray-scales of grading
  ktnlo   [int]   Gray-scale to be assigned to values less than lower bound
  ktnhi   [int]   Gray-scale to be assigned to values more than upper bound
  ktnvd   [int]   Gray-scale to be assigned to no-data area
                  If ktnvd>255 or 0>ktnvd, white (ktnvd=255) is assumed.
        Gray-scale should be 0 - 255, indicating the brightness.
         [ 0: black; 255: white ]
        If nlevel=0, other arguments (mtone,ktnlo,ktnhi,ktnvd) are not
         effective, and a default setting with 20 levels (plus 2 levels for
         out of bounds) grading is adopted.

      call dfrgbt(nclev, mrgb, kclo, kchi, kcnv)
      call dfcols(nclev, hue, dark, kcnv)
      call dfc40s()
  nclev   [int]   Number of color grading levels (no more than 50)
  mrgb    [int]   Array defining color codes of grading
  kclo    [int]   Color code to be assigned to values less than lower bound
  kchi    [int]   Color code to be assigned to values more than upper bound
  kcnv    [int]   Color code to be assigned to no-data area
                  If ktnvd>16777215 or 0>ktnvd, white is assumed.
  hue     [float] Factor (0.2 - 1.2) of how wide range of hue to use,
                   in auto-generating color grading tables.
  dark    [float] Factor (0. - 1.6) of how wide range of brightness to use,
                   in auto-generating color grading tables,
                   which controls the darkness of colors to be assigned to
                   values near both end bounds in 2D surface representation
                   'paintm', and the range of brightness contrast in dual 2D
                   surfaces representation 'paintw'.
        Color code should be 0 - 16777215, 24 bit non-negative integer, each
         8 bit of which is attributed to Red/Green/Blue light intensity.
          [ 0: black; (255*256+255)*256+255=16777215: white ]
        If nclev=0, other arguments (mrgb,kclo,kchi,kcnv or hue,dark,kcnv) are
         not effective, and a default setting with 20 levels (plus 2 levels
         for out of bounds) color grading is adopted, which is equivalent to
         `call dfcols(20, 1., 1., -1)`.

DFRAME, DFRAMO, PAINTM, PAINTW, DRESOL
NAME
    dframe - Define rectangle frame for 2D surface representation
              by 'paintm' / 'paintw'
    dframo - Define slant frame for 2D surface representation
              by 'paintm' / 'paintw'
    paintm - Represent 2D surface with gray-scale or color grading
              of rasterized data
    paintw - Represent dual 2D surfaces with shaded color grading
              of rasterized data
    dresol - Change the resolution of 'paintm' / 'paintw' representation

SYNOPSIS

      call dframe(xo, yo, wd, hi, imax, jmax)
  xo, yo   [float] Coordinates (in cm) of base (usually bottom left) corner of
                    the rectangular frame to paint by 'paintm' or 'paintw'.
  wd       [float] Width (in cm) of the frame
  hi       [float] Height (in cm) of the frame
  imax, jmax [int] Number of grids to right and to top, counting both ends,
                    which also specify the dimensions of adjustable array.
        In usual case, imax>0 and jmax>0, the array declaration is like
         `dimension v(imax,jmax)`, where array elements are ordered toward
         right first and then to top.   If array elements are ordered to
         top and then toward right, both imax and jmax shall be given as
         negative values, where the array declaration is supposed to be like
         `dimension v(-jmax,-imax)`.

      call dframo(x0, y0, x1, y1, x2, y2, imax, jmax)
  x0, y0   [float] Coordinates (in cm) of base corner of the frame to paint.
  x1, y1   [float] Coordinates (in cm) of 2nd corner
                    corresponding to the array element (imax,1).
  x2, y2   [float] Coordinates (in cm) of 3rd corner
                    corresponding to the array element (1,jmax).
  imax, jmax [int] Number of grids (must be imax>1, jmax>1) counting both
                    ends, which also specify dimensions of adjustable array.
        Three corners above, along with the 4th corner (x1+x2-x0, y1+y2-y0),
         define the slant grid frame of painting.

      call paintm(v, vlo, vhi, vnvd)
      call paintw(v, vlo, vhi, vnvd, u)
  v       [float] 2D array defining grid data (imax*jmax elements in total)
  vlo     [float] Lower bound for grid data to represent with color grading
  vhi     [float] Upper bound for grid data to represent with color grading
  vnvd    [float] Special value of grid data indicating no-data area
  u       [float] 2D array defining supplemental grid data (imax*jmax elements
                   in total) for shading.
                  The values in this array must be noramlized to the range of
                   0.-1. in advance.   The number of full grading levels in
                   shading is fixed to 20.

      call dresol(nras)
  nras    [int]   The resolution shall be changed to ((nras) / 8) times of
                  pre-defined value.
         This is effective to the later 'dframe' definition.

DFPCOL, PAINTC, PAINTR, PAINTP
NAME
    dfpcol - Assign a color to paint an object
    paintc / paintr / paintp - Paint a circle / rectangle / polygon

SYNOPSIS

      call dfpcol(key, mcol)
  key     [int]   Select  gray-scale (0), color code (1), or grading level (2)
  mcol    [int]   If key=0, specify gray-scale (0-255).
                  If key=1, specify color code (0-16777215),
                   though the selection of -1 thru -255 for mcol is acceptable,
                   which is equivalent to positive value gray-scale.
                  If key=2, specify color by grading level number in currently
                   effective gray-scale or color grading.

      call paintc(xc, yc, radius)
  xc, yc  [float] Coordinates (in cm) of center of the circle to be painted
  radius  [float] Radius (in cm)

      call paintr(xorg, yorg, wide, high)
  xorg, yorg [float] Coordinates (in cm) of base point (usually bottom left
                     corner) of the rectangle to be painted.
  wide    [float] Width (in cm)
                  If minus, painted on the left side of base point.
  high    [float] Height (in cm)
                  If minus, painted on the bottom side of base point.

      call paintp(xa, ya, npt, inc)
  xa, ya  [float] Arrays containing coordinates of corners of the polygon
                   to be painted
  npt     [int]   Number of corners (must be 3 or higher)
  inc     [int]   Increment to retrieve coordinates data (must be positive)
        The dicision of painting in complicated cases is base on the "non-zero
         winding number rule", i.e., under the condition that the number of
         times wound counterclockwise subtracted by the number wound clockwise
         is not zero.

Example for PSPAINT
!----------
  real :: v(151,101)
  real :: g(2,2)   = reshape((/ -110., -110., +110., +110./), (/2,2/))
  real :: h(2,2)   = reshape((/ 0., 1., 0., 1./), (/2,2/))
  real :: xm(9)    = (/ 0.0, 0.0, 2.5, 0.5, 1.5, 2.5, 0.5, 3.0, 3.0 /)
  real :: ym(9)    = (/ 0.0, 3.0, 2.0, 1.0, 0.5, 1.0, 2.0, 3.0, 0.0 /)
  real :: pos(2,4) = reshape((/ 5., 0., 5., 2., 8., 0., 8., 2. /), (/2,4/))
  real :: q(3,2)   = reshape((/ 0., 1., 2., 1., 2., 0. /), (/3,2/))
  do i=1,151
    x = float(i-76);  a = float(i-86)
    do j=1,101
      y = float(j-51);  b = float(j-31)
      r = sqrt(x*x + y*y);  s = sqrt(a*a + b*b)
      v(i,j) = r*3. - s*2. + 17.;  if(r > 50.) v(i,j) = 999.
    enddo
  enddo
  call psopn('pspaint.ps', 'a4p')
  call plots(2., 2.)
  call dfcols(0)
  call dframe(0., 12., 15., 10., 151, 101)
  call paintm(v, -80., 120., 999.)
  call newpen(3)
  call wrect(0., 12., 15., 10.)
  call dfpcol(1, 255*256*256)
  call paintr(2., 19., 3., 3.)
  call dframe(10., 0., 5., 10., 2, 2)
  call paintw(g, -100., 100., 999., h)
  call dfpcol(0, 200)
  call paintp(xm, ym, 9, 1)
  call newpen(2)
  call plot(xm(9), ym(9), 3)
  do i=1,9;  call plot(xm(i), ym(i), 2);  enddo
  call paintp(pos(1,1), pos(2,1), 4, 2)
  call dftone(0)
  call dframe(0., 5., 8., 4., 3, 2)
  call paintm(q, 0., 2., 99.)
  call dfpcol(1, 255*256+255)
  call paintc(2., 7., 0.7)
  call plote
  call pscls
  stop
  end