2 * \file GraphicsImage.C
3 * Copyright 2002 the LyX Team
4 * Read the file COPYING
6 * \author Baruch Even <baruch.even@writeme.com>
7 * \author Angus Leeming <leeming@lyx.org>
8 * \author Herbert Voss <voss@lyx.org>
14 #pragma implementation
17 #include "GraphicsImage.h"
18 #include "GraphicsParams.h"
26 // This is to be connected to a function that will return a new
27 // instance of a viable derived class.
28 boost::function0<Image::ImagePtr> Image::newImage;
30 /// Return the list of loadable formats.
31 boost::function0<Image::FormatList> Image::loadableFormats;
34 std::pair<unsigned int, unsigned int>
35 Image::getScaledDimensions(Params const & params) const
37 unsigned int width = getWidth();
38 unsigned int height = getHeight();
40 // scale only when value makes sense, i.e. not zero
42 width = (width * params.scale) / 100;
43 height = (height * params.scale) / 100;
46 lyxerr[Debug::GRAPHICS]
47 << "GraphicsImage::getScaledDImensions()"
48 << "\n\tparams.scale : " << params.scale
49 << "\n\twidth : " << width
50 << "\n\theight : " << height
53 return std::make_pair(width, height);