|
|
1.1 root 1: /*
2: %Z% %M% version %I% %Q%of %H% %T%
3: Last Delta: %G% %U% to %P%
4: */
5:
6: #include "cip.h"
7:
8: struct thing *
9: reflect(master,p)
10: register struct thing *master;
11: Point p;
12: {
13: register struct thing *t;
14: register Point *plist;
15: register int i;
16: Point temp;
17:
18: if ((t = (struct thing *) getSpace(sizeof(struct thing))) != TNULL) {
19: *t = *master;
20: if (p.y!=0) { /* x-axis - change y coordinate */
21: t->origin.y = p.y - t->origin.y;
22: }
23: else { /* y-axis - change x coordinate */
24: t->origin.x = p.x - t->origin.x;
25: }
26: switch(t->type) {
27: case CIRCLE:
28: case ELLIPSE:
29: case TEXT: {
30: break;
31: }
32: case BOX: {
33: if (p.y!=0) {
34: t->otherValues.corner.y = p.y - t->otherValues.corner.y;
35: }
36: else {
37: t->otherValues.corner.x = p.x - t->otherValues.corner.x;
38: }
39: break;
40: }
41: case LINE: {
42: if (p.y!=0) {
43: t->otherValues.end.y = p.y - t->otherValues.end.y;
44: }
45: else {
46: t->otherValues.end.x = p.x - t->otherValues.end.x;
47: }
48: break;
49: }
50: case ARC: {
51: if (p.y!=0) {
52: t->otherValues.arc.start.y = p.y - t->otherValues.arc.start.y;
53: t->otherValues.arc.end.y = p.y - t->otherValues.arc.end.y;
54: }
55: else {
56: t->otherValues.arc.start.x = p.x - t->otherValues.arc.start.x;
57: t->otherValues.arc.end.x = p.x - t->otherValues.arc.end.x;
58: }
59: temp = t->otherValues.arc.start;
60: t->otherValues.arc.start = t->otherValues.arc.end;
61: t->otherValues.arc.end = temp;
62: break;
63: }
64: case SPLINE: {
65: if ((plist = (Point *) getSpace((t->otherValues.spline.used+3)
66: *sizeof(Point))) != (Point *) NULL) {
67: for (i=0; i<t->otherValues.spline.used+3; i++) {
68: plist[i] = t->otherValues.spline.plist[i];
69: if (p.y==0) {
70: plist[i].x = p.x - plist[i].x;
71: }
72: else {
73: plist[i].y = p.y - plist[i].y;
74: }
75: }
76: t->otherValues.spline.plist = plist;
77: }
78: break;
79: }
80: case MACRO: {
81: break;
82: }
83: }
84: BoundingBox(t);
85: return(t);
86: }
87: return (master);
88: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.