1 /* @(#)display.c 1.3 05/29/84 2 * 3 * Copyright -C- 1982 Barry S. Roitblat 4 * 5 * This file contains routines to implement the higher level display 6 * driver routines 7 */ 8 9 #include "gremlin.h" 10 #include "grem2.h" 11 12 /* imports from graphics1.c */ 13 14 extern GRsetwmask(); 15 16 /* imports from graphics3.c */ 17 18 extern GRVector(), GRPutText(); 19 extern int GRArc(); 20 extern GRClear(); 21 22 23 DISScreenAdd(element,layer) 24 ELT *element; 25 int layer; 26 /* 27 * This routine displays an arbitrary element type on the specified 28 * memory plane using the parameters stored with the element 29 */ 30 31 { 32 POINT *p1, *p2, pos; 33 34 if ( !DBNullelt(element) ) 35 { 36 GRsetwmask(layer); 37 if (TEXT(element->type)) 38 { 39 p1 = element->ptlist; 40 (void) GRPutText(element->type, p1, element->brushf, 41 element->size, element->textpt, &pos); 42 } 43 else 44 { 45 switch (element->type) 46 { 47 case ARC: p1 = element->ptlist; 48 p2 = PTNextPoint(p1); 49 /* angle is stored in size */ 50 (void) GRArc(p1, p2, (float) element->size, 51 element->brushf); 52 break; 53 54 case CURVE: (void) GRCurve(element->ptlist, element->brushf); 55 break; 56 57 case POLYGON: 58 case VECTOR: p1 = element->ptlist; 59 p2 = PTNextPoint(p1); 60 while ( !Nullpoint(p2) ) 61 { 62 GRVector(p1, p2, element->brushf); 63 p1 = p2; 64 p2 = PTNextPoint(p2); 65 } /* end while */; 66 break; 67 } /* end switch */; 68 } /* end else TEXT */ 69 } /* end if */ 70 } /* end ScreenAdd */ 71 72 73 74 DISScreenErase(element,layer) 75 ELT *element; 76 int layer; 77 /* 78 * This routine erases an arbitrary element type from the specified 79 * memory plane by redrawing the element in the background color. It 80 * uses the parameters stored with the element. 81 */ 82 83 { 84 POINT *p1, *p2, pos; 85 86 if ( !DBNullelt(element) ) 87 { 88 GRsetwmask(layer); 89 if (TEXT(element->type)) 90 { 91 p1 = element->ptlist; 92 (void) GRPutText(element->type, p1, eraseany, 93 element->size, element->textpt, &pos); 94 } 95 else 96 { 97 switch (element->type) 98 { 99 case ARC: p1 = element->ptlist; 100 p2 = PTNextPoint(p1); 101 /* angle is stored in size */ 102 (void) GRArc(p1, p2, (float) element->size, 103 eraseany); 104 break; 105 106 case CURVE: (void) GRCurve(element->ptlist, eraseany); 107 break; 108 109 case POLYGON: 110 case VECTOR: p1 = element->ptlist; 111 p2 = PTNextPoint(p1); 112 while ( !Nullpoint(p2) ) 113 { 114 GRVector(p1, p2, eraseany); 115 p1 = p2; 116 p2 = PTNextPoint(p2); 117 } /* end while */; 118 break; 119 } /* end switch */; 120 } /* end else TEXT */ 121 } /* end if */ 122 } /* end ScreenErase */ 123 124 125 DISDisplaySet(element) 126 ELT *element; 127 /* 128 * This routine displays the specified element as the part of 129 * the current set by calling screenadd with the current set layers 130 * specified 131 */ 132 133 { 134 DISScreenAdd(element, setmask); 135 } /* end DisplaySet */ 136 137 DISEraseSet(element) 138 ELT *element; 139 /* 140 * This routine erases the set attribute of the specifed element by 141 * calling Screen Erase with the layer mask set for the current set layer(s) 142 */ 143 144 { 145 DISScreenErase(element, setmask); 146 } /* end EraseSet */ 147 148 DISClearSetDisplay() 149 /* 150 * This routine clears the set attribute from all elements by erasing 151 * the the entire set display layer. 152 */ 153 154 { 155 GRClear(setmask); 156 } 157