(no commit message)
[geda-pcb/pcjc2.git] / src / rotate.h
blob85a9361430cb7f613f0b129184fc078d86ef8868
1 /*
2 * COPYRIGHT
4 * PCB, interactive printed circuit board design
5 * Copyright (C) 1994,1995,1996 Thomas Nau
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 * Contact addresses for paper mail and Email:
22 * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany
23 * Thomas.Nau@rz.uni-ulm.de
27 /* prototypes for transform routines
30 #ifndef PCB_ROTATE_H
31 #define PCB_ROTATE_H
33 #include "global.h"
35 /* ---------------------------------------------------------------------------
36 * some useful transformation macros and constants
38 #define ROTATE(x,y,x0,y0,n) \
39 { \
40 Coord dx = (x)-(x0), \
41 dy = (y)-(y0); \
43 switch(n & 0x03) \
44 { \
45 case 1: (x)=(x0)+dy; (y)=(y0)-dx; \
46 break; \
47 case 2: (x)=(x0)-dx; (y)=(y0)-dy; \
48 break; \
49 case 3: (x)=(x0)-dy; (y)=(y0)+dx; \
50 break; \
51 default: break; \
52 } \
54 #define ROTATE_VIA_LOWLEVEL(v,x0,y0,n) ROTATE((v)->X,(v)->Y,(x0),(y0),(n))
55 #define ROTATE_PIN_LOWLEVEL(p,x0,y0,n) ROTATE((p)->X,(p)->Y,(x0),(y0),(n))
56 #define ROTATE_PAD_LOWLEVEL(p,x0,y0,n) \
57 RotateLineLowLevel(((LineType *) (p)),(x0),(y0),(n))
59 #define ROTATE_TYPES (ELEMENT_TYPE | TEXT_TYPE | ELEMENTNAME_TYPE | ARC_TYPE)
62 void RotateLineLowLevel (LineType *, Coord, Coord, unsigned);
63 void RotateArcLowLevel (ArcType *, Coord, Coord, unsigned);
64 void RotateBoxLowLevel (BoxType *, Coord, Coord, unsigned);
65 void RotateTextLowLevel (TextType *, Coord, Coord, unsigned);
66 void RotatePolygonLowLevel (PolygonType *, Coord, Coord, unsigned);
67 void RotateElementLowLevel (DataType *, ElementType *, Coord, Coord, unsigned);
68 void *RotateObject (int, void *, void *, void *, Coord, Coord,
69 unsigned);
70 void RotateScreenObject (Coord, Coord, unsigned);
72 #endif