|
|
1.1 ! root 1: /******************************************************************* ! 2: * * ! 3: * File: CIFPLOT/draw.c * ! 4: * Written by Dan Fitzpatrick * ! 5: * copyright 1980 -- Regents of the University of California * ! 6: * * ! 7: ********************************************************************/ ! 8: ! 9: #include <stdio.h> ! 10: #include "defs.h" ! 11: #include "globals.h" ! 12: #include "parser_defs.h" ! 13: #include "structs.h" ! 14: #include "out_structs.h" ! 15: ! 16: IMPORT nedge *AllocHolder(); ! 17: IMPORT PutQueue(); ! 18: IMPORT GetQueue(); ! 19: IMPORT AddLine(); ! 20: IMPORT Fill(); ! 21: ! 22: SendDisplay(a,da,b,db,l) ! 23: register int l; ! 24: real a,b,da,db; ! 25: /* SendDisplay sends the y positions a & b to be displayed on plot ! 26: * Each raster line the value of a & b change by da & db */ ! 27: { ! 28: if(a > b) Error("Edge is backwards in SendEdge",INTERNAL); ! 29: if(a < 0) Error("bad value in SendEdge",INTERNAL); ! 30: if(a == b && da == db && l != 0) return; /* Ignore 0 width lines */ ! 31: if(EdgeHolder[l] != NIL) ! 32: if(a<EdgeHolder[l]->end || (a==EdgeHolder[l]->end && da <= EdgeHolder[l]->dend)) { ! 33: /* If this run overlaps the last run combine them ! 34: * and return ! 35: * if not send out last run and create new run ! 36: * if equal do not combine since dy may diverge */ ! 37: EdgeHolder[l]->end = b; ! 38: EdgeHolder[l]->dend = db; ! 39: return; ! 40: } ! 41: else ! 42: PutQueue(EdgeHolder[l],&(NEdgeQueue[l])); ! 43: EdgeHolder[l] = AllocHolder(); ! 44: EdgeHolder[l]->start = a; ! 45: EdgeHolder[l]->end = b; ! 46: EdgeHolder[l]->dstart = da; ! 47: EdgeHolder[l]->dend = db; ! 48: } ! 49: ! 50: FinnishLine(l,xcurrent) ! 51: int l; ! 52: /* Causes last holder to be put on queue, calls AddLine */ ! 53: { ! 54: if(EdgeHolder[l] != NIL) ! 55: PutQueue(EdgeHolder[l],&(NEdgeQueue[l])); ! 56: EdgeHolder[l] = NIL; ! 57: AddLine(l,xcurrent); ! 58: } ! 59: ! 60: /* ! 61: Draw(i,xcurrent) ! 62: register int i,xcurrent; ! 63: { ! 64: register nedge *e; ! 65: ! 66: return; ! 67: /* Fill between edges; compute outlines if outline is true ! 68: * and the pattern is not black. (If the pattern is black ! 69: * outlines do not appear anyway.) */ ! 70: /* ! 71: if(outline && Pats[i][ModCount] != 0xFFFFFFFF) ! 72: for(e=(nedge *) NecEdgeQueue[i].QStart; e!=NIL; e=e->Link) { ! 73: if(e->dstart > 0.0) ! 74: Fill(xcurrent,(int) e->start,(int) (e->start + e->dstart),0xFFFFFFFF); ! 75: else ! 76: Fill(xcurrent,(int) (e->start + e->dstart),(int) e->start,0xFFFFFFFF); ! 77: if(e->dend > 0.0) ! 78: Fill(xcurrent,(int) e->end+1,(int) (e->end + e->dend)+1,0xFFFFFFFF); ! 79: else ! 80: Fill(xcurrent,(int) (e->end + e->dend)+1,(int) e->end+1,0xFFFFFFFF); ! 81: e->start += e->dstart; e->end += e->dend; ! 82: Fill(xcurrent,(int) e->start, (int) e->end,Pats[i][ModCount]); ! 83: } ! 84: else ! 85: for(e=(nedge *) NecEdgeQueue[i].QStart; e!=NIL; e=e->Link) ! 86: Fill(xcurrent,(int) (e->start+= e->dstart), (int) (e->end+= e->dend)+1,Pats[i][ModCount]); ! 87: } ! 88: */ ! 89: ! 90: ! 91: OutputTrap(layer,xcurrent) ! 92: int layer,xcurrent; ! 93: { ! 94: register nedge *e; ! 95: register real diff; ! 96: if(extractor) { ! 97: ExtractorOutput(xcurrent); ! 98: return; ! 99: } ! 100: diff = xcurrent - xprev[layer] - 1; ! 101: for(e=(nedge *) NecEdgeQueue[layer].QStart; e!=NIL; e=e->Link) { ! 102: FillTrap(e->start,e->end,e->dstart,e->dend,xprev[layer],xcurrent,layer); ! 103: e->start += e->dstart * diff; e->end += e->dend * diff; ! 104: } ! 105: xprev[layer] = xcurrent; ! 106: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.