2002-07-12 01:48:53 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
|
|
|
* \file QLImage.h
|
2002-09-24 13:57:09 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-07-12 01:48:53 +00:00
|
|
|
*
|
2002-09-24 13:57:09 +00:00
|
|
|
* \author Angus Leeming
|
|
|
|
* \author John Levon
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-07-12 01:48:53 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef QLIMAGE_H
|
|
|
|
#define QLIMAGE_H
|
|
|
|
|
|
|
|
|
|
|
|
#include "graphics/GraphicsImage.h"
|
2002-09-24 13:57:09 +00:00
|
|
|
|
2004-05-02 12:45:26 +00:00
|
|
|
#include <qimage.h>
|
2002-09-24 13:57:09 +00:00
|
|
|
|
2003-07-04 08:23:23 +00:00
|
|
|
namespace lyx {
|
|
|
|
namespace graphics {
|
2002-07-12 01:48:53 +00:00
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
class QLImage : public Image {
|
2002-07-12 01:48:53 +00:00
|
|
|
public:
|
|
|
|
/// Access to this class is through this static method.
|
|
|
|
static ImagePtr newImage();
|
|
|
|
|
|
|
|
/// Return the list of loadable formats.
|
|
|
|
static FormatList loadableFormats();
|
|
|
|
|
|
|
|
~QLImage();
|
2004-05-02 12:45:26 +00:00
|
|
|
QImage const & qimage() const { return transformed_; }
|
2002-07-12 01:48:53 +00:00
|
|
|
|
2003-09-16 15:34:39 +00:00
|
|
|
private:
|
|
|
|
/// Create a copy
|
|
|
|
virtual Image * clone_impl() const;
|
2002-07-12 01:48:53 +00:00
|
|
|
/// Get the image width
|
2003-09-16 15:34:39 +00:00
|
|
|
virtual unsigned int getWidth_impl() const;
|
2002-07-12 01:48:53 +00:00
|
|
|
/// Get the image height
|
2003-09-16 15:34:39 +00:00
|
|
|
virtual unsigned int getHeight_impl() const;
|
|
|
|
// FIXME Is the image drawable ?
|
|
|
|
virtual bool isDrawable_impl() const { return true; }
|
2002-09-24 13:57:09 +00:00
|
|
|
/**
|
2002-07-12 01:48:53 +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.
|
|
|
|
*/
|
2003-10-06 15:43:21 +00:00
|
|
|
virtual void load_impl(std::string const & filename);
|
2002-07-12 01:48:53 +00:00
|
|
|
/**
|
2004-05-02 12:45:26 +00:00
|
|
|
* Finishes the process of modifying transformed_, using
|
|
|
|
* \c params to decide on color, grayscale etc.
|
|
|
|
* \returns true if successful.
|
2002-07-12 01:48:53 +00:00
|
|
|
*/
|
2003-09-16 15:34:39 +00:00
|
|
|
virtual bool setPixmap_impl(Params const & params);
|
2002-07-12 01:48:53 +00:00
|
|
|
/// Clip the image using params.
|
2003-09-16 15:34:39 +00:00
|
|
|
virtual void clip_impl(Params const & params);
|
2002-07-12 01:48:53 +00:00
|
|
|
/// Rotate the image using params.
|
2003-09-16 15:34:39 +00:00
|
|
|
virtual void rotate_impl(Params const & params);
|
2002-07-12 01:48:53 +00:00
|
|
|
/// Scale the image using params.
|
2003-09-16 15:34:39 +00:00
|
|
|
virtual void scale_impl(Params const & params);
|
|
|
|
|
2002-07-12 01:48:53 +00:00
|
|
|
/// Access to the class is through newImage() and clone.
|
|
|
|
QLImage();
|
|
|
|
///
|
|
|
|
QLImage(QLImage const &);
|
|
|
|
|
2004-05-02 12:45:26 +00:00
|
|
|
/// The original loaded image.
|
|
|
|
QImage original_;
|
2002-07-12 01:48:53 +00:00
|
|
|
|
2004-05-02 12:45:26 +00:00
|
|
|
/// The transformed image for display.
|
|
|
|
QImage transformed_;
|
2002-07-12 01:48:53 +00:00
|
|
|
};
|
|
|
|
|
2003-07-04 08:23:23 +00:00
|
|
|
} // namespace graphics
|
|
|
|
} // namespace lyx
|
2002-07-12 01:48:53 +00:00
|
|
|
|
|
|
|
#endif // QLIMAGE_H
|