]> git.lyx.org Git - lyx.git/blob - src/graphics/GraphicsImage.cpp
* docstream: factorize out some code and introduce odocfstream::reset()
[lyx.git] / src / graphics / GraphicsImage.cpp
1 /**
2  * \file GraphicsImage.cpp
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 "support/debug.h"
18
19
20 namespace lyx {
21 namespace graphics {
22
23 // This is to be connected to a function that will return a new
24 // instance of a viable derived class.
25 boost::function<Image *()> Image::newImage;
26
27 /// Return the list of loadable formats.
28 boost::function<Image::FormatList()> Image::loadableFormats;
29
30
31 Dimension Image::scaledDimension(Params const & params) const
32 {
33         // scale only when value > 0
34         unsigned int w = width();
35         unsigned int h = height();
36         if (params.scale) {
37                 w = (w * params.scale) / 100;
38                 h = (h * params.scale) / 100;
39         }
40
41         LYXERR(Debug::GRAPHICS, "graphics::Image::getScaledDimensions()"
42                 << "\n\tparams.scale       : " << params.scale
43                 << "\n\twidth              : " << w
44                 << "\n\theight             : " << h);
45
46         return Dimension(w, h, 0);
47 }
48
49 } // namespace graphics
50 } // namespace lyx