pcb 4.1.1
An interactive printed circuit board layout editor.

rotate.h

Go to the documentation of this file.
00001 
00035 #ifndef PCB_ROTATE_H
00036 #define PCB_ROTATE_H
00037 
00038 #include "global.h"
00039 
00040 /* ---------------------------------------------------------------------------
00041  * some useful transformation macros and constants
00042  */
00043 #define ROTATE(x,y,x0,y0,n)                                                     \
00044         {                                                                                               \
00045                 Coord   dx = (x)-(x0),                                  \
00046                                         dy = (y)-(y0);                                  \
00047                                                                                                         \
00048                 switch(n & 0x03)                                                                        \
00049                 {                                                                                       \
00050                         case 1:         (x)=(x0)+dy; (y)=(y0)-dx;       \
00051                                                 break;                                          \
00052                         case 2:         (x)=(x0)-dx; (y)=(y0)-dy;       \
00053                                                 break;                                          \
00054                         case 3:         (x)=(x0)-dy; (y)=(y0)+dx;       \
00055                                                 break;                                          \
00056                         default:        break;                                          \
00057                 }                                                                                       \
00058         }
00059 #define ROTATE_VIA_LOWLEVEL(v,x0,y0,n)  ROTATE((v)->X,(v)->Y,(x0),(y0),(n))
00060 #define ROTATE_PIN_LOWLEVEL(p,x0,y0,n)  ROTATE((p)->X,(p)->Y,(x0),(y0),(n))
00061 #define ROTATE_PAD_LOWLEVEL(p,x0,y0,n)  \
00062         RotateLineLowLevel(((LineType *) (p)),(x0),(y0),(n))
00063 
00064 #define ROTATE_TYPES    (ELEMENT_TYPE | TEXT_TYPE | ELEMENTNAME_TYPE | ARC_TYPE)
00065 
00066 
00067 void RotateLineLowLevel (LineType *, Coord, Coord, unsigned);
00068 void RotateArcLowLevel (ArcType *, Coord, Coord, unsigned);
00069 void RotateBoxLowLevel (BoxType *, Coord, Coord, unsigned);
00070 void RotateTextLowLevel (TextType *, Coord, Coord, unsigned);
00071 void RotatePolygonLowLevel (PolygonType *, Coord, Coord, unsigned);
00072 void RotateElementLowLevel (DataType *, ElementType *, Coord, Coord, unsigned);
00073 void *RotateObject (int, void *, void *, void *, Coord, Coord,
00074                     unsigned);
00075 void RotateScreenObject (Coord, Coord, unsigned);
00076 
00077 #endif