1*16552Sslatteng /* @(#)display.c 1.3 05/29/84
211949Sslatteng *
311949Sslatteng * Copyright -C- 1982 Barry S. Roitblat
411949Sslatteng *
511949Sslatteng * This file contains routines to implement the higher level display
611949Sslatteng * driver routines
711949Sslatteng */
811949Sslatteng
911949Sslatteng #include "gremlin.h"
1011949Sslatteng #include "grem2.h"
1111949Sslatteng
1211949Sslatteng /* imports from graphics1.c */
1311949Sslatteng
1411949Sslatteng extern GRsetwmask();
1511949Sslatteng
1611949Sslatteng /* imports from graphics3.c */
1711949Sslatteng
1811949Sslatteng extern GRVector(), GRPutText();
1911949Sslatteng extern int GRArc();
2011949Sslatteng extern GRClear();
2111949Sslatteng
2211949Sslatteng
DISScreenAdd(element,layer)2311949Sslatteng DISScreenAdd(element,layer)
2411949Sslatteng ELT *element;
2511949Sslatteng int layer;
2611949Sslatteng /*
2711949Sslatteng * This routine displays an arbitrary element type on the specified
2811949Sslatteng * memory plane using the parameters stored with the element
2911949Sslatteng */
3011949Sslatteng
3111949Sslatteng {
3211949Sslatteng POINT *p1, *p2, pos;
3311949Sslatteng
3411949Sslatteng if ( !DBNullelt(element) )
3511949Sslatteng {
3611949Sslatteng GRsetwmask(layer);
3711949Sslatteng if (TEXT(element->type))
3811949Sslatteng {
3911949Sslatteng p1 = element->ptlist;
4011949Sslatteng (void) GRPutText(element->type, p1, element->brushf,
4111949Sslatteng element->size, element->textpt, &pos);
4211949Sslatteng }
4311949Sslatteng else
4411949Sslatteng {
4511949Sslatteng switch (element->type)
4611949Sslatteng {
4711949Sslatteng case ARC: p1 = element->ptlist;
4811949Sslatteng p2 = PTNextPoint(p1);
4911949Sslatteng /* angle is stored in size */
5011949Sslatteng (void) GRArc(p1, p2, (float) element->size,
5111949Sslatteng element->brushf);
5211949Sslatteng break;
5311949Sslatteng
5411949Sslatteng case CURVE: (void) GRCurve(element->ptlist, element->brushf);
5511949Sslatteng break;
5611949Sslatteng
57*16552Sslatteng case POLYGON:
5811949Sslatteng case VECTOR: p1 = element->ptlist;
5911949Sslatteng p2 = PTNextPoint(p1);
6011949Sslatteng while ( !Nullpoint(p2) )
6111949Sslatteng {
6211949Sslatteng GRVector(p1, p2, element->brushf);
6311949Sslatteng p1 = p2;
6411949Sslatteng p2 = PTNextPoint(p2);
6511949Sslatteng } /* end while */;
6611949Sslatteng break;
6711949Sslatteng } /* end switch */;
6811949Sslatteng } /* end else TEXT */
6911949Sslatteng } /* end if */
7011949Sslatteng } /* end ScreenAdd */
7111949Sslatteng
7211949Sslatteng
7311972Sslatteng
DISScreenErase(element,layer)7411949Sslatteng DISScreenErase(element,layer)
7511949Sslatteng ELT *element;
7611949Sslatteng int layer;
7711949Sslatteng /*
7811949Sslatteng * This routine erases an arbitrary element type from the specified
7911949Sslatteng * memory plane by redrawing the element in the background color. It
8011949Sslatteng * uses the parameters stored with the element.
8111949Sslatteng */
8211949Sslatteng
8311949Sslatteng {
8411949Sslatteng POINT *p1, *p2, pos;
8511949Sslatteng
8611949Sslatteng if ( !DBNullelt(element) )
8711949Sslatteng {
8811949Sslatteng GRsetwmask(layer);
8911949Sslatteng if (TEXT(element->type))
9011949Sslatteng {
9111949Sslatteng p1 = element->ptlist;
9211949Sslatteng (void) GRPutText(element->type, p1, eraseany,
9311949Sslatteng element->size, element->textpt, &pos);
9411949Sslatteng }
9511949Sslatteng else
9611949Sslatteng {
9711949Sslatteng switch (element->type)
9811949Sslatteng {
9911949Sslatteng case ARC: p1 = element->ptlist;
10011949Sslatteng p2 = PTNextPoint(p1);
10111949Sslatteng /* angle is stored in size */
10211949Sslatteng (void) GRArc(p1, p2, (float) element->size,
10311949Sslatteng eraseany);
10411949Sslatteng break;
10511949Sslatteng
10611949Sslatteng case CURVE: (void) GRCurve(element->ptlist, eraseany);
10711949Sslatteng break;
10811949Sslatteng
109*16552Sslatteng case POLYGON:
11011949Sslatteng case VECTOR: p1 = element->ptlist;
11111949Sslatteng p2 = PTNextPoint(p1);
11211949Sslatteng while ( !Nullpoint(p2) )
11311949Sslatteng {
11411949Sslatteng GRVector(p1, p2, eraseany);
11511949Sslatteng p1 = p2;
11611949Sslatteng p2 = PTNextPoint(p2);
11711949Sslatteng } /* end while */;
11811949Sslatteng break;
11911949Sslatteng } /* end switch */;
12011949Sslatteng } /* end else TEXT */
12111949Sslatteng } /* end if */
12211949Sslatteng } /* end ScreenErase */
12311949Sslatteng
12411972Sslatteng
DISDisplaySet(element)12511949Sslatteng DISDisplaySet(element)
12611949Sslatteng ELT *element;
12711949Sslatteng /*
12811949Sslatteng * This routine displays the specified element as the part of
12911949Sslatteng * the current set by calling screenadd with the current set layers
13011949Sslatteng * specified
13111949Sslatteng */
13211949Sslatteng
13311949Sslatteng {
13411949Sslatteng DISScreenAdd(element, setmask);
13511949Sslatteng } /* end DisplaySet */
13611949Sslatteng
DISEraseSet(element)13711949Sslatteng DISEraseSet(element)
13811949Sslatteng ELT *element;
13911949Sslatteng /*
14011949Sslatteng * This routine erases the set attribute of the specifed element by
14111949Sslatteng * calling Screen Erase with the layer mask set for the current set layer(s)
14211949Sslatteng */
14311949Sslatteng
14411949Sslatteng {
14511949Sslatteng DISScreenErase(element, setmask);
14611949Sslatteng } /* end EraseSet */
14711949Sslatteng
DISClearSetDisplay()14811949Sslatteng DISClearSetDisplay()
14911949Sslatteng /*
15011949Sslatteng * This routine clears the set attribute from all elements by erasing
15111949Sslatteng * the the entire set display layer.
15211949Sslatteng */
15311949Sslatteng
15411949Sslatteng {
15511949Sslatteng GRClear(setmask);
15611949Sslatteng }
157