• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef PPTYPES_H_
2 #define PPTYPES_H_
3 
4 #include <cmath> // NAN
5 
6 // namespace PPTypes {}   TODO?
7 
8 enum Axis { X, Y };
9 enum Position { CENTER=0, LEFT=-1, RIGHT=1, TOP=1, BOTTOM=-1 }; // PS order
10 void Position_dump(Position pos);
11 void Position_dump(Position pos,Axis axis);
12 
13 enum Rotation { ROT_0, ROT_90, ROT_180, ROT_270 };  // CCW
14 void Rotation_dump(Rotation rot);
15 Rotation operator+(Rotation lhs,Rotation rhs);
16 Rotation operator-(Rotation lhs,Rotation rhs);
17 Rotation operator-(Rotation rhs);
18 //Rotation operator+=(Rotation &lhs,Rotation rhs);
19 
20 enum BorderType { NONE=0, ONE_THIN=2, ONE_THICK=3, TWO_THIN=4, TWO_THICK=5,
21                   ONE=0x02, TWO=0x04, THICK=0x01};
22 void BorderType_dump(BorderType border);
23 
24 struct PageRect {
PageRectPageRect25 PageRect() : top(NAN),left(NAN),right(NAN),bottom(NAN),width(NAN),height(NAN) {}
26   float top,left,right,bottom; // i.e. margins
27   float width,height;
28 
29   void rotate_move(Rotation r,float pwidth,float pheight); // pwidth original "page size" (i.e. before rotation)
30   void scale(float mult);
31   void translate(float tx,float ty);
32 
33   void set(const PageRect &rhs); // only for rhs.* != NAN
34   void dump() const;
35 };
36 
37 //  bool parseBorder(const char *val,BorderType &ret); // none,single,...,double-thick
38 
39 #endif
40