2002-09-05 11:31:30 +00:00
|
|
|
|
/**
|
2007-04-25 03:01:35 +00:00
|
|
|
|
* \file GraphicsImage.cpp
|
2002-09-05 15:14:23 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-02-27 09:59:52 +00:00
|
|
|
|
*
|
2002-12-01 22:59:25 +00:00
|
|
|
|
* \author Baruch Even
|
|
|
|
|
* \author Angus Leeming
|
2003-09-07 01:45:40 +00:00
|
|
|
|
* \author Herbert Vo<EFBFBD>
|
2002-09-05 11:31:30 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-02-27 09:59:52 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
|
|
#include "GraphicsImage.h"
|
|
|
|
|
#include "GraphicsParams.h"
|
2007-11-29 07:04:28 +00:00
|
|
|
|
#include "support/debug.h"
|
2002-07-21 15:51:07 +00:00
|
|
|
|
|
2002-05-29 12:23:43 +00:00
|
|
|
|
|
2003-07-04 08:23:23 +00:00
|
|
|
|
namespace lyx {
|
|
|
|
|
namespace graphics {
|
2002-02-27 09:59:52 +00:00
|
|
|
|
|
2002-06-28 11:22:56 +00:00
|
|
|
|
// This is to be connected to a function that will return a new
|
|
|
|
|
// instance of a viable derived class.
|
2007-11-22 00:03:18 +00:00
|
|
|
|
boost::function<Image *()> Image::newImage;
|
2002-02-27 09:59:52 +00:00
|
|
|
|
|
|
|
|
|
/// Return the list of loadable formats.
|
2004-09-26 13:34:57 +00:00
|
|
|
|
boost::function<Image::FormatList()> Image::loadableFormats;
|
2002-07-04 17:45:35 +00:00
|
|
|
|
|
2002-02-27 09:59:52 +00:00
|
|
|
|
|
2007-11-23 22:15:17 +00:00
|
|
|
|
Dimension Image::scaledDimension(Params const & params) const
|
2002-02-27 09:59:52 +00:00
|
|
|
|
{
|
2002-08-27 20:30:20 +00:00
|
|
|
|
// scale only when value > 0
|
2007-11-23 22:15:17 +00:00
|
|
|
|
unsigned int w = width();
|
|
|
|
|
unsigned int h = height();
|
2002-08-24 22:02:30 +00:00
|
|
|
|
if (params.scale) {
|
2007-11-23 22:15:17 +00:00
|
|
|
|
w = (w * params.scale) / 100;
|
|
|
|
|
h = (h * params.scale) / 100;
|
2002-08-24 22:02:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-11-15 20:04:51 +00:00
|
|
|
|
LYXERR(Debug::GRAPHICS, "graphics::Image::getScaledDimensions()"
|
2002-07-21 15:51:07 +00:00
|
|
|
|
<< "\n\tparams.scale : " << params.scale
|
2007-11-23 22:15:17 +00:00
|
|
|
|
<< "\n\twidth : " << w
|
|
|
|
|
<< "\n\theight : " << h);
|
2002-02-27 09:59:52 +00:00
|
|
|
|
|
2007-11-23 22:15:17 +00:00
|
|
|
|
return Dimension(w, h, 0);
|
2002-02-27 09:59:52 +00:00
|
|
|
|
}
|
2002-05-29 12:23:43 +00:00
|
|
|
|
|
2003-07-04 08:23:23 +00:00
|
|
|
|
} // namespace graphics
|
|
|
|
|
} // namespace lyx
|