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"
|
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
#include <QImage>
|
2006-03-05 17:24:44 +00:00
|
|
|
#include <QPixmap>
|
|
|
|
|
|
|
|
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:
|
|
|
|
/// Access to this class is through this static method.
|
2007-11-22 00:04:19 +00:00
|
|
|
static Image * newImage();
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
/// Return the list of loadable formats.
|
|
|
|
static FormatList loadableFormats();
|
|
|
|
|
|
|
|
/// Retrieve the buffered pixmap.
|
|
|
|
QPixmap const & qpixmap() const { return transformed_pixmap_; }
|
|
|
|
|
|
|
|
/// Retrieve the buffered pixmap.
|
|
|
|
QImage const & qimage() const { return transformed_; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
/// Create a copy
|
2007-11-21 22:54:10 +00:00
|
|
|
virtual Image * clone() const;
|
2006-03-05 17:24:44 +00:00
|
|
|
/// Get the image width
|
2007-11-23 22:15:17 +00:00
|
|
|
virtual unsigned int width() const;
|
2006-03-05 17:24:44 +00:00
|
|
|
/// Get the image height
|
2007-11-23 22:15:17 +00:00
|
|
|
virtual unsigned int height() const;
|
2006-03-05 17:24:44 +00:00
|
|
|
// FIXME Is the image drawable ?
|
2007-11-21 22:54:10 +00:00
|
|
|
virtual bool isDrawable() const { return true; }
|
2006-03-05 17:24:44 +00:00
|
|
|
/**
|
|
|
|
* Load the image file into memory.
|
|
|
|
* The process is asynchronous, so this method starts the loading.
|
|
|
|
* When finished, the Image::finishedLoading signal is emitted.
|
|
|
|
*/
|
2007-11-21 22:54:10 +00:00
|
|
|
virtual void load(support::FileName const & filename);
|
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.
|
|
|
|
*/
|
2007-11-21 22:54:10 +00:00
|
|
|
virtual bool setPixmap(Params const & params);
|
2006-03-05 17:24:44 +00:00
|
|
|
/// Clip the image using params.
|
2007-11-21 22:54:10 +00:00
|
|
|
virtual void clip(Params const & params);
|
2006-03-05 17:24:44 +00:00
|
|
|
/// Rotate the image using params.
|
2007-11-21 22:54:10 +00:00
|
|
|
virtual void rotate(Params const & params);
|
2006-03-05 17:24:44 +00:00
|
|
|
/// Scale the image using params.
|
2007-11-21 22:54:10 +00:00
|
|
|
virtual void scale(Params const & params);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
/// Access to the class is through newImage() and clone.
|
2007-08-31 22:16:11 +00:00
|
|
|
GuiImage() {}
|
2006-03-05 17:24:44 +00:00
|
|
|
///
|
2007-08-31 22:16:11 +00:00
|
|
|
GuiImage(GuiImage const &);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
/// The original loaded image.
|
|
|
|
QImage original_;
|
|
|
|
|
|
|
|
/// The transformed image for display.
|
|
|
|
QImage transformed_;
|
|
|
|
/// Buffer the pixmap itself
|
|
|
|
QPixmap transformed_pixmap_;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace graphics
|
|
|
|
} // namespace lyx
|
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
#endif // GUIIMAGE_H
|