]> git.lyx.org Git - lyx.git/blob - src/graphics/GraphicsImage.C
Remove all unnecessary #includes from header files.
[lyx.git] / src / graphics / GraphicsImage.C
1 /**
2  * \file GraphicsImage.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Baruch Even
7  * \author Angus Leeming
8  * \author Herbert Voß
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #include <config.h>
14
15 #include "GraphicsImage.h"
16 #include "GraphicsParams.h"
17 #include "debug.h"
18
19 using std::endl;
20 using std::abs;
21
22 namespace lyx {
23 namespace graphics {
24
25 // This is to be connected to a function that will return a new
26 // instance of a viable derived class.
27 boost::function0<Image::ImagePtr> Image::newImage;
28
29 /// Return the list of loadable formats.
30 boost::function0<Image::FormatList> Image::loadableFormats;
31
32
33 std::pair<unsigned int, unsigned int>
34 Image::getScaledDimensions(Params const & params) const
35 {
36         // scale only when value > 0
37         unsigned int width;
38         unsigned int height;
39         if (params.scale) {
40                 width  = (getWidth() * params.scale) / 100;
41                 height = (getHeight() * params.scale) / 100;
42         } else {
43                 width = getWidth();
44                 height = getHeight();
45         }
46
47         lyxerr[Debug::GRAPHICS]
48                 << "GraphicsImage::getScaledDImensions()"
49                 << "\n\tparams.scale       : " << params.scale
50                 << "\n\twidth              : " << width
51                 << "\n\theight             : " << height
52                 << std::endl;
53
54         return std::make_pair(width, height);
55 }
56
57 } // namespace graphics
58 } // namespace lyx