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"
25 string const BoundingBox::asString() const
27 std::ostringstream os;
28 os << xl << ' ' << yb << ' ' << xr << ' ' << yt;
34 : display(ColorDisplay),
40 bool operator==(Params const & a, Params const & b)
42 return (a.filename == b.filename &&
43 a.display == b.display &&
50 bool operator!=(Params const & a, Params const & b)
56 BoundingBox::BoundingBox()
57 : xl(0), yb(0), xr(0), yt(0)
61 BoundingBox::BoundingBox(string const & bb)
62 : xl(0), yb(0), xr(0), yt(0)
67 std::istringstream is(bb.c_str());
69 is >> a >> b >> c >> d;
71 // inBP returns the length in Postscript points.
72 // Note further that there are 72 Postscript pixels per inch.
73 unsigned int const xl_tmp = abs(LyXLength(a).inBP());
74 unsigned int const yb_tmp = abs(LyXLength(b).inBP());
75 unsigned int const xr_tmp = abs(LyXLength(c).inBP());
76 unsigned int const yt_tmp = abs(LyXLength(d).inBP());
78 if (xr_tmp <= xl_tmp || yt_tmp <= yb_tmp)
88 bool BoundingBox::empty() const
90 return (!xl && !yb && !xr && !yt);
94 bool operator==(BoundingBox const & a, BoundingBox const & b)
96 return (a.xl == b.xl &&
103 bool operator!=(BoundingBox const & a, BoundingBox const & b)
108 } // namespace graphics