2006-03-05 17:24:44 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
2007-08-31 05:53:55 +00:00
|
|
|
* \file GuiImage.h
|
2006-03-05 17:24:44 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Angus Leeming
|
|
|
|
* \author John Levon
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
#ifndef GUIIMAGE_H
|
|
|
|
#define GUIIMAGE_H
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
#include "graphics/GraphicsImage.h"
|
|
|
|
|
2008-09-19 11:27:24 +00:00
|
|
|
#include <QImage>
|
2008-07-16 09:43:46 +00:00
|
|
|
#include <QString>
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
namespace graphics {
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
class GuiImage : public Image
|
|
|
|
{
|
2006-03-05 17:24:44 +00:00
|
|
|
public:
|
2008-09-19 12:01:01 +00:00
|
|
|
/// Access to the class is through newImage() and clone.
|
|
|
|
GuiImage();
|
|
|
|
///
|
|
|
|
GuiImage(GuiImage const &);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2008-09-19 11:27:24 +00:00
|
|
|
/// Retrieve the rendered image.
|
|
|
|
QImage const & image() const;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
/// Create a copy
|
2008-06-06 22:51:11 +00:00
|
|
|
Image * clone() const;
|
2006-03-05 17:24:44 +00:00
|
|
|
/// Get the image width
|
2008-06-06 22:51:11 +00:00
|
|
|
unsigned int width() const;
|
2006-03-05 17:24:44 +00:00
|
|
|
/// Get the image height
|
2008-06-06 22:51:11 +00:00
|
|
|
unsigned int height() const;
|
2006-03-05 17:24:44 +00:00
|
|
|
// FIXME Is the image drawable ?
|
2008-06-06 22:51:11 +00:00
|
|
|
bool isDrawable() const { return true; }
|
2006-03-05 17:24:44 +00:00
|
|
|
/**
|
|
|
|
* Load the image file into memory.
|
|
|
|
*/
|
2008-06-06 11:52:02 +00:00
|
|
|
bool load(support::FileName const & filename);
|
2008-09-19 11:27:24 +00:00
|
|
|
bool load();
|
2006-03-05 17:24:44 +00:00
|
|
|
/**
|
|
|
|
* Finishes the process of modifying transformed_, using
|
|
|
|
* \c params to decide on color, grayscale etc.
|
|
|
|
* \returns true if successful.
|
|
|
|
*/
|
2008-06-06 22:51:11 +00:00
|
|
|
bool setPixmap(Params const & params);
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
/// Clip the image using params.
|
2008-06-06 22:51:11 +00:00
|
|
|
bool clip(Params const & params);
|
2006-03-05 17:24:44 +00:00
|
|
|
/// Rotate the image using params.
|
2008-06-06 22:51:11 +00:00
|
|
|
bool rotate(Params const & params);
|
2006-03-05 17:24:44 +00:00
|
|
|
/// Scale the image using params.
|
2008-06-06 22:51:11 +00:00
|
|
|
bool scale(Params const & params);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
/// The original loaded image.
|
2008-09-19 11:27:24 +00:00
|
|
|
QImage original_;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
/// The transformed image for display.
|
2008-09-19 11:27:24 +00:00
|
|
|
QImage transformed_;
|
|
|
|
|
|
|
|
///
|
2008-06-06 22:51:11 +00:00
|
|
|
bool is_transformed_;
|
2008-07-16 09:43:46 +00:00
|
|
|
///
|
|
|
|
QString fname_;
|
2006-03-05 17:24:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace graphics
|
|
|
|
} // namespace lyx
|
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
#endif // GUIIMAGE_H
|