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