aboutsummaryrefslogtreecommitdiff
path: root/POLYH.C
blob: 9aacf125226ca43a9e34c4f8c89ae91a22ac5eb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*----------------------------------------------------------------------*/
/*  									*/
/*        polyh.c -- Hollow Polygon 					*/
/*  									*/
/*----------------------------------------------------------------------*/

#include <system.h>
#include <prism.h>
#include <pnts.h>

#define local static

extern BOOL  goToPerm;
extern void (*doit)(), (*xorit)(), (*nop)();
extern void FlipIt(), PaintSym(), obmv(), obclr(), vec(), EraseTempChg();
extern PointRec pnts;
extern SHORT usePen, didType;

#define eraseFB EraseTempChg

/* Hollow Polygon ================================================================*/
local Point bp, prevp;

UndoHPoly() {   pex = prevp.x; pey = prevp.y;   }
    
local void chvec() {   mLine(pex,pey,mx,my); }
local void thinChVec() {
    SHORT svusePen = usePen; usePen = 0; chvec();
    usePen =svusePen; 
    }

local void polyBup() {  
    if (Distance(mx-bp.x,my-bp.y) < 3) {
	goToPerm = YES;
	mx = bp.x; my = bp.y;
	}
    didType = DIDHPoly;
    PaintSym();
    prevp.x = pex;
    prevp.y = pey;
    } 

void IMPoly2() {
    xorit = thinChVec;
    doit = chvec;
    UpdtOFF();
    IModeProcs(FlipIt,nop,FlipIt,nop,chvec,nop,eraseFB, polyBup);
    }
    
local void markStart() {bp.x = mx; bp.y = my; }

void IMPoly() {
    doit = &vec;
    IModeProcs(obmv,obmv,obclr,markStart,vec,nop,eraseFB,PaintSym);
    }