9b4c04ab12a6b47a77e0914003a202eb1bb0bdea
[ipdf/code.git] / src / ipdf.h
1 #ifndef _IPDF_H
2 #define _IPDF_H
3
4 #include "common.h"
5 #include "real.h"
6 #include "bezier.h"
7 #include "rect.h"
8
9 #include "path.h"
10
11 namespace IPDF
12 {
13
14         inline Real Random(Real max=1, Real min=0)
15         {
16                 return min + (max-min) * (Real(rand() % (int)100) / Real(100));
17         }
18
19         typedef unsigned ObjectID;
20         /** Type of object
21      * NOTE: Extra entry in the enum so we can use this as an array index
22          */
23         typedef enum 
24         {
25                 CIRCLE_FILLED = 0, 
26                 RECT_FILLED,
27                 RECT_OUTLINE,
28                 BEZIER,
29                 PATH,
30                 NUMBER_OF_OBJECT_TYPES
31         } ObjectType;
32
33         enum DocChunkTypes
34         {
35                 CT_NUMOBJS,
36                 CT_OBJTYPES,
37                 CT_OBJBOUNDS,
38                 CT_OBJINDICES,
39                 CT_OBJBEZIERS,
40                 CT_OBJPATHS
41         };
42
43         struct Objects
44         {
45                 /** Used by all objects **/
46                 std::vector<ObjectType> types; // types of objects
47                 std::vector<Rect> bounds; // rectangle bounds of objects
48                 /** Used by BEZIER and GROUP to identify data position in relevant vector **/
49                 std::vector<unsigned> data_indices;
50                 /** Used by BEZIER only **/
51                 std::vector<Bezier> beziers; // bezier curves - look up by data_indices
52                 /** Used by PATH only **/
53                 std::vector<Path> paths;
54         };
55
56         class View;
57 }
58
59
60 #endif //_IPDF_H

UCC git Repository :: git.ucc.asn.au