2 * \file GraphicsParams.cpp
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"
31 bool operator==(Params const & a, Params const & b)
33 return (a.filename == b.filename &&
34 a.display == b.display &&
37 a.pixel_ratio == b.pixel_ratio &&
42 bool operator!=(Params const & a, Params const & b)
48 ostream & operator<<(ostream & os, BoundingBox const & bb)
50 os << bb.xl.asString() << ' ' << bb.yb.asString() << ' '
51 << bb.xr.asString() << ' ' << bb.yt.asString();
56 BoundingBox::BoundingBox()
60 BoundingBox::BoundingBox(string const & bb)
65 istringstream is(bb.c_str());
67 is >> a >> b >> c >> d;
69 Length xl_tmp = Length(a);
70 if (xl_tmp.value() < 0)
71 xl_tmp = Length(-xl_tmp.value(), xl_tmp.unit());
72 Length yb_tmp = Length(b);
73 if (yb_tmp.value() < 0)
74 yb_tmp = Length(-yb_tmp.value(), yb_tmp.unit());
75 Length xr_tmp = Length(c);
76 if (xr_tmp.value() < 0)
77 xr_tmp = Length(-xr_tmp.value(), xr_tmp.unit());
78 Length yt_tmp = Length(d);
79 if (yt_tmp.value() < 0)
80 yt_tmp = Length(-yt_tmp.value(), yt_tmp.unit());
82 // inBP returns the length in Postscript points.
83 // Note further that there are 72 Postscript pixels per inch.
84 if (xr_tmp.inBP() <= xl_tmp.inBP() || yt_tmp.inBP() <= yb_tmp.inBP())
94 bool BoundingBox::empty() const
96 return xl.zero() && yb.zero() && xr.zero() && yt.zero();
100 bool operator==(BoundingBox const & a, BoundingBox const & b)
102 return (a.xl == b.xl &&
109 bool operator!=(BoundingBox const & a, BoundingBox const & b)
114 } // namespace graphics