2 * \file GraphicsParams.C
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Angus Leeming
8 * Full author contact details are available in file CREDITS.
13 #include "GraphicsParams.h"
15 #include "lyxlength.h"
17 #include "support/std_sstream.h"
20 using std::istringstream;
27 : display(ColorDisplay),
33 bool operator==(Params const & a, Params const & b)
35 return (a.filename == b.filename &&
36 a.display == b.display &&
43 bool operator!=(Params const & a, Params const & b)
49 BoundingBox::BoundingBox()
50 : xl(0), yb(0), xr(0), yt(0)
54 BoundingBox::BoundingBox(string const & bb)
55 : xl(0), yb(0), xr(0), yt(0)
60 std::istringstream is(bb.c_str());
62 is >> a >> b >> c >> d;
64 // inBP returns the length in Postscript points.
65 // Note further that there are 72 Postscript pixels per inch.
66 unsigned int const xl_tmp = abs(LyXLength(a).inBP());
67 unsigned int const yb_tmp = abs(LyXLength(b).inBP());
68 unsigned int const xr_tmp = abs(LyXLength(c).inBP());
69 unsigned int const yt_tmp = abs(LyXLength(d).inBP());
71 if (xr_tmp <= xl_tmp || yt_tmp <= yb_tmp)
81 bool BoundingBox::empty() const
83 return (!xl && !yb && !xr && !yt);
87 bool operator==(BoundingBox const & a, BoundingBox const & b)
89 return (a.xl == b.xl &&
96 bool operator!=(BoundingBox const & a, BoundingBox const & b)
101 } // namespace graphics