Back to index

plt-scheme  4.2.1
Classes | Defines | Functions
plstrm.h File Reference
#include "pdf.h"
#include "disptab.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  PLDev
struct  PLStream

Defines

#define PL_MAX_CMAP1CP   256

Functions

void plgpls (PLStream **p_pls)
void plcol_interp (PLStream *pls, PLColor *newcolor, int i, int ncol)
void plOpenFile (PLStream *pls)
void plP_getmember (PLStream *pls)
void plP_sfnam (PLStream *pls, const char *fnam)
void plFamInit (PLStream *pls)
void plGetFam (PLStream *pls)
void plRotPhy (PLINT orient, PLINT xmin, PLINT ymin, PLINT xmax, PLINT ymax, int *px, int *py)
PLDevplAllocDev (PLStream *pls)
void plGinInit (PLGraphicsIn *gin)

Class Documentation

struct PLDev

Definition at line 21 of file plstrm.h.

Class Members
PLFLT pxlx
PLFLT pxly
PLINT xlen
PLINT xlen_dev
PLINT xmax
PLINT xmax_dev
PLINT xmin
PLINT xmin_dev
PLINT xold
PLFLT xscale_dev
PLINT ylen
PLINT ylen_dev
PLINT ymax
PLINT ymax_dev
PLINT ymin
PLINT ymin_dev
PLINT yold
PLFLT yscale_dev

Define Documentation

#define PL_MAX_CMAP1CP   256

Definition at line 420 of file plstrm.h.


Function Documentation

PLDev* plAllocDev ( PLStream pls)

Definition at line 1629 of file plctrl.c.

{
    if (pls->dev != NULL)
       free((void *) pls->dev);

    pls->dev = calloc(1, (size_t) sizeof(PLDev));
    if (pls->dev == NULL)
       plexit("plAllocDev: cannot allocate memory\n");

    return (PLDev *) pls->dev;
}

Here is the call graph for this function:

void plcol_interp ( PLStream pls,
PLColor newcolor,
int  i,
int  ncol 
)

Definition at line 1394 of file plctrl.c.

{
    PLFLT x, delta;
    int il, ir;

    x = (double) (i * (pls->ncol1-1)) / (double) (ncol-1);
    il = x;
    ir = il + 1;
    delta = x - il;

    if (ir > pls->ncol1 || il < 0)
       fprintf(stderr, "Invalid color\n");

    else if (ir == pls->ncol1 || (delta == 0.)) {
       newcolor->r = pls->cmap1[il].r;
       newcolor->g = pls->cmap1[il].g;
       newcolor->b = pls->cmap1[il].b;
    }
    else {
       newcolor->r = (1.-delta) * pls->cmap1[il].r + delta * pls->cmap1[ir].r;
       newcolor->g = (1.-delta) * pls->cmap1[il].g + delta * pls->cmap1[ir].g;
       newcolor->b = (1.-delta) * pls->cmap1[il].b + delta * pls->cmap1[ir].b;
    }
}
void plFamInit ( PLStream pls)

Definition at line 1536 of file plctrl.c.

{
    if (pls->family) {
       pls->bytecnt = 0;
       if ( ! pls->member)
           pls->member = 1;
       if ( ! pls->finc)
           pls->finc = 1;
       if ( ! pls->fflen)
           pls->fflen = 1;
       if ( ! pls->bytemax)
           pls->bytemax = PL_FILESIZE_KB * 1000;
    }
}
void plGetFam ( PLStream pls)

Definition at line 1562 of file plctrl.c.

{
    PLFLT xpmm_loc, ypmm_loc;
    if (pls->family) {
       if (pls->bytecnt > pls->bytemax || pls->famadv) {
           plP_tidy();
           pls->member += pls->finc;
           pls->famadv = 0;
           plP_init();
          /* Apply compensating factor to original xpmm and ypmm so that 
           * character aspect ratio is preserved when overall aspect ratio
           * is changed. */
           plP_gpixmm(&xpmm_loc, &ypmm_loc);
           plP_setpxl(xpmm_loc*plsc->caspfactor, ypmm_loc/plsc->caspfactor); 
           return;
       }
    }
}

Here is the call graph for this function:

Definition at line 1648 of file plctrl.c.

{
    gin->type = 0;
    gin->state = 0;
    gin->keysym = 0;
    gin->button = 0;
    gin->string[0] = '\0';
    gin->pX = gin->pY = -1;
    gin->dX = gin->dY = 0.;
    gin->wX = gin->wY = 0.;
}
void plgpls ( PLStream **  p_pls)

Definition at line 2173 of file plcore.c.

{
    *p_pls = plsc;
}
void plOpenFile ( PLStream pls)

Definition at line 1429 of file plctrl.c.

{
    int i = 0, count = 0;
    size_t len;
    char line[256];

    while (pls->OutFile == NULL) {

/* Setting pls->FileName = NULL forces creation of a new family member */
/* You should also free the memory associated with it if you do this */

       if (pls->family && pls->BaseName != NULL)
           plP_getmember(pls);

/* Prompt if filename still not known */

       if (pls->FileName == NULL) {
           do {
              fprintf(stdout, "Enter graphics output file name: ");
              fgets(line, sizeof(line), stdin);
              len = strlen(line);
              if (len)
                  len--;
              line[len] = '\0';    /* strip new-line */
              count++;             /* count zero entries */
           } while (!len && count < MAX_NUM_TRIES);
           plP_sfnam(pls, line);
       }

/* If name is "-", send to stdout */

       if ( ! strcmp(pls->FileName, "-")) {
           pls->OutFile = stdout;
           pls->output_type = 1;
           break;
       }

/* Need this here again, for prompted family initialization */

       if (pls->family && pls->BaseName != NULL) 
           plP_getmember(pls);

       if (i++ > 10)
           plexit("Too many tries.");

       if ((pls->OutFile = fopen(pls->FileName, "wb+")) == NULL) 
           fprintf(stdout, "Can't open %s.\n", pls->FileName);
       else
         {
//         fprintf(stderr, "Opened %s\n", pls->FileName);
//         this is not needed
         }
    }
}

Here is the call graph for this function:

Definition at line 1491 of file plctrl.c.

{
    char tmp[256];

    if (pls->FileName == NULL)
       pls->FileName = (char *) malloc(10 + strlen(pls->BaseName));

    sprintf(tmp, "%s.%%0%1ii", pls->BaseName, (int) pls->fflen);
    sprintf(pls->FileName, tmp, pls->member);
}

Here is the caller graph for this function:

void plP_sfnam ( PLStream pls,
const char *  fnam 
)

Definition at line 1510 of file plctrl.c.

{
    pls->OutFile = NULL;

    if (pls->FileName != NULL)
       free((void *) pls->FileName);

    pls->FileName = (char *) malloc(10 + strlen(fnam));

    strcpy(pls->FileName, fnam);

    if (pls->BaseName != NULL)
       free((void *) pls->BaseName);

    pls->BaseName = (char *) malloc(10 + strlen(fnam));

    strcpy(pls->BaseName, fnam);
}

Here is the caller graph for this function:

void plRotPhy ( PLINT  orient,
PLINT  xmin,
PLINT  ymin,
PLINT  xmax,
PLINT  ymax,
int px,
int py 
)

Definition at line 1591 of file plctrl.c.

{
    int x, y;

    x = *px;
    y = *py;

    switch (orient%4) {

    case 1:
       *px = xmin + (y - ymin);
       *py = ymin + (xmax - x);
       break;

    case 2:
       *px = xmin + (xmax - x);
       *py = ymin + (ymax - y);
       break;

    case 3:
       *px = xmin + (ymax - y);
       *py = ymin + (x - xmin);
       break;

    default:
       break;               /* do nothing */
    }
}