]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiImage.h
move GuiImage::loadableFormats() to support/imagetools.{h,cpp} and simplify this...
[lyx.git] / src / frontends / qt4 / GuiImage.h
1 // -*- C++ -*-
2 /**
3  * \file GuiImage.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Angus Leeming
8  * \author John Levon
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef GUIIMAGE_H
14 #define GUIIMAGE_H
15
16 #include "graphics/GraphicsImage.h"
17
18 #include <QImage>
19 #include <QPixmap>
20
21 namespace lyx {
22 namespace graphics {
23
24 class GuiImage : public Image
25 {
26 public:
27         /// Access to this class is through this static method.
28         static Image * newImage();
29
30         /// Retrieve the buffered pixmap.
31         QPixmap const & qpixmap() const { return transformed_pixmap_; }
32
33         /// Retrieve the buffered pixmap.
34         QImage const & qimage() const { return transformed_; }
35
36 private:
37         /// Create a copy
38         virtual Image * clone() const;
39         /// Get the image width
40         virtual unsigned int width() const;
41         /// Get the image height
42         virtual unsigned int height() const;
43         // FIXME Is the image drawable ?
44         virtual bool isDrawable() const { return true; }
45         /**
46          * Load the image file into memory.
47          * The process is asynchronous, so this method starts the loading.
48          * When finished, the Image::finishedLoading signal is emitted.
49          */
50         virtual void load(support::FileName const & filename);
51         /**
52          * Finishes the process of modifying transformed_, using
53          * \c params to decide on color, grayscale etc.
54          * \returns true if successful.
55          */
56         virtual bool setPixmap(Params const & params);
57         /// Clip the image using params.
58         virtual void clip(Params const & params);
59         /// Rotate the image using params.
60         virtual void rotate(Params const & params);
61         /// Scale the image using params.
62         virtual void scale(Params const & params);
63
64         /// Access to the class is through newImage() and clone.
65         GuiImage() {}
66         ///
67         GuiImage(GuiImage const &);
68
69         /// The original loaded image.
70         QImage original_;
71
72         /// The transformed image for display.
73         QImage transformed_;
74         /// Buffer the pixmap itself
75         QPixmap transformed_pixmap_;
76 };
77
78 } // namespace graphics
79 } // namespace lyx
80
81 #endif // GUIIMAGE_H