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