]> git.lyx.org Git - lyx.git/blob - src/graphics/GraphicsParams.h
678566e2bdc387bd679746df286ed992cf7c7bc3
[lyx.git] / src / graphics / GraphicsParams.h
1 // -*- C++ -*-
2 /**
3  * \file GraphicsParams.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Angus Leeming
8  *
9  * Full author contact details are available in file CREDITS.
10  *
11  * Used internally by the lyx::graphics::Image.
12  */
13
14 #ifndef GRAPHICSPARAMS_H
15 #define GRAPHICSPARAMS_H
16
17 #include "GraphicsTypes.h"
18
19 #include <string>
20 #include <iosfwd>
21
22
23 namespace lyx {
24 namespace graphics {
25
26 /** Parse a string of the form "200pt 500pt 300mm 5in" into a
27  *  usable bounding box.
28  */
29 struct BoundingBox {
30         ///
31         BoundingBox();
32         ///
33         BoundingBox(std::string const &);
34
35         /// 0 0 0 0 is empty!
36         bool empty() const;
37
38         unsigned int xl;
39         unsigned int yb;
40         unsigned int xr;
41         unsigned int yt;
42 };
43
44 bool operator==(BoundingBox const &, BoundingBox const &);
45 bool operator!=(BoundingBox const &, BoundingBox const &);
46
47 std::ostream & operator<<(std::ostream &, BoundingBox const &);
48
49
50 struct Params
51 {
52         Params();
53
54         DisplayType display;
55         unsigned int scale;
56
57         /// The image filename.
58         std::string filename;
59
60         /** Note that the BoundingBox is always relative to the BoundingBox
61          *  as stored in the EPS file.
62          *  Ie, bb.xl and bb.yb == 0 if that corner is not moved.
63          */
64         BoundingBox bb;
65
66         /** The size of the view inside lyx in pixels or the scaling of the
67          *  image.
68          */
69         /// Rotation angle.
70         float angle;
71 };
72
73 bool operator==(Params const &, Params const &);
74 bool operator!=(Params const &, Params const &);
75
76 } // namespace graphics
77 } // namespace lyx
78
79 #endif // GRAPHICSPARAMS_H