Back to index

radiance  4R0+20100331
Defines | Functions | Variables
plot.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define NPATS   9 /* number of fill patterns */
#define PATSIZE   16 /* pattern size (square) */

Functions

void set (int attrib, char *value)
void reset (int attrib)
void unset (int attrib)
void plot (FILE *fp)
void fillpoly (PRIMITIVE *p)
void filltri (PRIMITIVE *p)
void printstr (PRIMITIVE *p)
void fillrect (PRIMITIVE *p)
void plotlseg (PRIMITIVE *p)
void nextblock (void)
void outputblock (void)
void printblock (void)
void pglob (int co, int a0, char *s)
void pprim (int co, int a0, int xmin, int ymin, int xmax, int ymax, char *s)
void plseg (int a0, int xstart, int ystart, int xend, int yend)
void thispage (void)
void nextpage (void)
void contpage (void)
void printspan (void)
void endpage (void)

Variables

int dxsize
int dysize
int pati []
unsigned char pattern [][PATSIZE/8][PATSIZE]

Define Documentation

#define NPATS   9 /* number of fill patterns */

Definition at line 12 of file plot.h.

#define PATSIZE   16 /* pattern size (square) */

Definition at line 14 of file plot.h.


Function Documentation

void contpage ( void  )

Here is the caller graph for this function:

void endpage ( void  )

Definition at line 237 of file psplot.c.

{
       checkline();

       printf("showpage\nmapping setmatrix\n");
}

Here is the call graph for this function:

Here is the caller graph for this function:

void fillpoly ( PRIMITIVE *  p)

Definition at line 427 of file psplot.c.

{
       register char *s;
       int    curx, cury;

       checkline();

       printf("%s %d %d mark\n", p->arg0 & 0100 ? "false" : "true",
                     p->arg0>>2 & 03, p->arg0 & 03);
       s = p->args;
       while ((s = nextscan(nextscan(s, "%d", (char*)&curx), "%d", (char*)&cury)) != NULL) {
              xform(&curx, &cury, p);
              printf("%d %d ", curx, cury);
       }
       printf("fillpoly\n");
}

Here is the call graph for this function:

Here is the caller graph for this function:

void fillrect ( PRIMITIVE *  p)

Definition at line 485 of file x11plot.c.

{}

Here is the caller graph for this function:

void filltri ( PRIMITIVE *  p)

Definition at line 483 of file x11plot.c.

{}

Here is the caller graph for this function:

void nextblock ( void  )

Definition at line 142 of file rplot.c.

{
    register int  i, n;
    register unsigned char  *colp;
                                          /* clear block */
    for (i = 0; i < NUMSCANS; i++) {
       colp = outblock.cols[i];
       n = dxsize;
       while (n--)
           *colp++ = IWHT<<3 | IWHT;
    }
                                          /* advance */
    if (ydown) {
       outblock.ytop -= NUMSCANS;
       outblock.ybot -= NUMSCANS;
    } else {
       outblock.ytop += NUMSCANS;
       outblock.ybot += NUMSCANS;
    }
    return;
}

Here is the caller graph for this function:

void nextpage ( void  )

Definition at line 188 of file meta2bmp.c.

{

    if (lineno == 0)
       return;
    if (bmpw != NULL) {
       while (lineno < dysize) {
           nextblock();
           outputblock();
       }
       BMPcloseOutput(bmpw);
       bmpw = NULL;
    }
    lineno = 0;

}

Here is the call graph for this function:

Here is the caller graph for this function:

void outputblock ( void  )

Definition at line 166 of file rplot.c.

{
    register int  i, n;
    register unsigned char  *colp;

    for (i = 0; i < NUMSCANS; i++) {             /* overlay blocks */

       n = outblock.xright - outblock.xleft + 1;
       colp = outblock.cols[i] + outblock.xleft;
       while (n--) {
           *colp = *colp>>3 & *colp;
           colp++;
       }
    }
    printblock();                  /* print block */
}

Here is the call graph for this function:

Here is the caller graph for this function:

void pglob ( int  co,
int  a0,
char *  s 
)

Definition at line 86 of file primout.c.

{
    PRIMITIVE  p;
    
    p.com = co;
    p.arg0 = a0;
    p.xy[XMN] = p.xy[YMN] = p.xy[XMX] = p.xy[YMX] = -1;
    p.args = s;

    writep(&p, pout);

}

Here is the caller graph for this function:

void plot ( FILE *  fp)

Definition at line 39 of file mplot.c.

{

    do {
       readp(&nextp, infp);
       initplot();
       while (inqueue.ptop != NULL || isprim(nextp.com))
           plotspan(infp);
       doglobal(&nextp);
       fargs(&nextp);
    } while (nextp.com != PEOF);

}

Here is the call graph for this function:

Here is the caller graph for this function:

void plotlseg ( PRIMITIVE *  p)

Definition at line 252 of file x11plot.c.

{
    int  x1, y1, x2, y2;
    int  linetype, ps, pw;
    int col;

    linetype = (p->arg0 >> 4) & 03;       /* line style (solid, dashed, etc) */

    col = p->arg0 & 03;                   /* color */

    ps = WIDTH((p->arg0 >> 2) & 03);
    pw = CONV((ps)/2, dxsize);

    x1 = mapx(p->xy[XMN]);
    x2 = mapx(p->xy[XMX]);
    if (p->arg0 & 0100) {          /* reverse slope */
       y1 = mapy(p->xy[YMX]);
       y2 = mapy(p->xy[YMN]);
    } else {
       y1 = mapy(p->xy[YMN]);
       y2 = mapy(p->xy[YMX]);
    }

    if (curcol != col || curwidth != pw)
       {
       curcol = col;
       gcval.foreground = pixel[col];
       curwidth = pw;
       gcval.line_width = pw*2+1;  /* convert to thickness in pixels */
       gcval.join_style = JoinRound;
       XChangeGC(dpy, gc, GCJoinStyle|GCLineWidth|GCForeground, &gcval);
       }
    if (curlinetype != linetype)
       {
       curlinetype = linetype;
       if (linetype==0)
              gcval.line_style = LineSolid;
       else
              {
              gcval.line_style = LineOnOffDash;
              XSetDashes(dpy, gc, 0, Linetypes[linetype], dash_list_length[linetype]);
              }
       XChangeGC(dpy, gc, GCLineStyle, &gcval);
       }
    XDrawLine(dpy,wind,gc,x1,y1,x2,y2);
}
void plseg ( int  a0,
int  xstart,
int  ystart,
int  xend,
int  yend 
)

Definition at line 18 of file primout.c.

{
    PRIMITIVE p;
    int              reverse;

    if (xstart < xend) {
       p.xy[XMN] = xstart;
       p.xy[XMX] = xend;
       reverse = FALSE;
    } else {
       p.xy[XMN] = xend;
       p.xy[XMX] = xstart;
       reverse = TRUE;
    }

    if (ystart < yend) {
       p.xy[YMN] = ystart;
        p.xy[YMX] = yend;
    } else {
       p.xy[YMN] = yend;
       p.xy[YMX] = ystart;
       reverse = ystart > yend && !reverse;
    }

    p.com = PLSEG;
    p.arg0 = (reverse << 6) | a0;
    p.args = NULL;

    writep(&p, pout);
}

Here is the caller graph for this function:

void pprim ( int  co,
int  a0,
int  xmin,
int  ymin,
int  xmax,
int  ymax,
char *  s 
)

Definition at line 58 of file primout.c.

{
    PRIMITIVE p;

    p.com = co;
    p.arg0 = a0;
    p.xy[XMN] = xmin;
    p.xy[YMN] = ymin;
    p.xy[XMX] = xmax;
    p.xy[YMX] = ymax;
    p.args = s;

    writep(&p, pout);

}

Here is the caller graph for this function:

void printblock ( void  )

Definition at line 211 of file meta2bmp.c.

{
    int  i;
    register unsigned char  *scanline;

    if (lineno == 0)
       initfile();
    for (i = outblock.ybot; i <= outblock.ytop && i < dysize; i++) {
       scanline = outblock.cols[i-outblock.ybot] + outblock.xleft;
       memcpy((void *)bmpw->scanline, (void *)scanline,
                     sizeof(uint8)*(outblock.xright-outblock.xleft+1));
       if (BMPwriteScanline(bmpw) != BIR_OK)
              error(SYSTEM, "Error writing BMP file");
       lineno++;
    }
    
}

Here is the call graph for this function:

Here is the caller graph for this function:

void printspan ( void  )

Here is the caller graph for this function:

void printstr ( PRIMITIVE *  p)

Definition at line 212 of file x11plot.c.

{
    int  fn;
    int  col;

    fn = fontmap[(p->arg0 >> 2) & 017];          /* get font number */
                                          /* set font */
    if (font[fn].id == 0) 
       {
       font[fn].id = XLoadFont(dpy, font[fn].name);
       if (font[fn].id == 0) 
           {
           sprintf(errmsg, "can't open font \"%s\"", font[fn].name);
           error(SYSTEM, errmsg);
           }
       }
    col = p->arg0 & 03;
    if (curcol != col)
       {
       curcol = col;
       XSetForeground(dpy, gc, pixel[col]);
       }
    if (curfont != font[fn].id) 
       {
       curfont = font[fn].id;
       XSetFont(dpy, gc, curfont);
       }

    XDrawImageString(dpy, wind, gc, mapx(p->xy[XMN]), mapy(p->xy[YMN]),
              p->args, strlen(p->args));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void reset ( int  attrib)

Definition at line 185 of file plot.c.

{
    switch (attrib) {
       case SALL:
           reset(SPAT0);
           reset(SPAT1);
           reset(SPAT2);
           reset(SPAT3);
           context = 0;
           return;
       case SPAT0:
           spat(SPAT0, "P0");
           break;
       case SPAT1:
           spat(SPAT1, "P1");
           break;
       case SPAT2:
           spat(SPAT2, "P2");
           break;
       case SPAT3:
           spat(SPAT3, "P3");
           break;
       default:
           sprintf(errmsg, "Can't reset attribute: %o", attrib);
           error(WARNING, errmsg);
           return;
    }
    while (sets[attrib] != NULL)
       spop(attrib);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void set ( int  attrib,
char *  value 
)

Definition at line 111 of file plot.c.

{
    struct setting  *newset;

    switch (attrib) {
       case SALL:
           context++;
           return;
       case SPAT0:
       case SPAT1:
       case SPAT2:
       case SPAT3:
           if (!spat(attrib, value)) {
              sprintf(errmsg, "Bad pattern set value: %s", value);
              error(WARNING, errmsg);
              return;
           }
           break;
       default:
           sprintf(errmsg, "Can't set attribute: %o", attrib);
           error(WARNING, errmsg);
           return;
    }
    newset = (struct setting *)malloc(sizeof(struct setting));
    newset->cnx = context;
    newset->val = savestr(value);
    newset->snext = sets[attrib];
    sets[attrib] = newset;
}

Here is the call graph for this function:

void thispage ( void  )

Definition at line 145 of file meta2bmp.c.

{
    if (lineno)
       error(USER, "cannot restart page in thispage");
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unset ( int  attrib)

Definition at line 147 of file plot.c.

{
    register int  i;

    if (attrib == SALL) {
       if (context == 0)
           reset(SALL);
       else {
           context--;
           for (i = 0; i < 0200; i++)
              while (sets[i] != NULL && sets[i]->cnx > context)
                  spop(i);
       }
       return;
    }
    spop(attrib);
    if (sets[attrib] == NULL)
       reset(attrib);

    switch (attrib) {
       case SPAT0:
       case SPAT1:
       case SPAT2:
       case SPAT3:
           spat(attrib, sets[attrib]->val);
           break;
       default:
           sprintf(errmsg, "Can't unset attribute: %o", attrib);
           error(WARNING, errmsg);
           return;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

int dxsize

Definition at line 27 of file meta2bmp.c.

int dysize

Definition at line 27 of file meta2bmp.c.

int pati[]

Definition at line 14 of file plot.c.

unsigned char pattern[][PATSIZE/8][PATSIZE]

Definition at line 21 of file plot.c.