]> git.lyx.org Git - lyx.git/blob - src/graphics/GraphicsImage.C
Store an InsetBase & in MailInset.
[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 Voss
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 grfx {
23
24 // This is to be connected to a function that will return a new
25 // instance of a viable derived class.
26 boost::function0<Image::ImagePtr> Image::newImage;
27
28 /// Return the list of loadable formats.
29 boost::function0<Image::FormatList> Image::loadableFormats;
30
31
32 std::pair<unsigned int, unsigned int>
33 Image::getScaledDimensions(Params const & params) const
34 {
35         // scale only when value > 0
36         unsigned int width;
37         unsigned int height;
38         if (params.scale) {
39                 width  = (getWidth() * params.scale) / 100;
40                 height = (getHeight() * params.scale) / 100;
41         } else {
42                 width = getWidth();
43                 height = getHeight();
44         }
45
46         lyxerr[Debug::GRAPHICS]
47                 << "GraphicsImage::getScaledDImensions()"
48                 << "\n\tparams.scale       : " << params.scale
49                 << "\n\twidth              : " << width
50                 << "\n\theight             : " << height
51                 << std::endl;
52
53         return std::make_pair(width, height);
54 }
55
56 } // namespace grfx