]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiImage.h
Merge QController into individual dialogs. Also various cleanup
[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 public:
26         /// Access to this class is through this static method.
27         static ImagePtr newImage();
28
29         /// Return the list of loadable formats.
30         static FormatList loadableFormats();
31
32         /// Retrieve the buffered pixmap.
33         QPixmap const & qpixmap() const { return transformed_pixmap_; }
34
35         /// Retrieve the buffered pixmap.
36         QImage const & qimage() const { return transformed_; }
37
38 private:
39         /// Create a copy
40         virtual Image * clone_impl() const;
41         /// Get the image width
42         virtual unsigned int getWidth_impl() const;
43         /// Get the image height
44         virtual unsigned int getHeight_impl() const;
45         // FIXME Is the image drawable ?
46         virtual bool isDrawable_impl() const { return true; }
47         /**
48          * Load the image file into memory.
49          * The process is asynchronous, so this method starts the loading.
50          * When finished, the Image::finishedLoading signal is emitted.
51          */
52         virtual void load_impl(support::FileName const & filename);
53         /**
54          * Finishes the process of modifying transformed_, using
55          * \c params to decide on color, grayscale etc.
56          * \returns true if successful.
57          */
58         virtual bool setPixmap_impl(Params const & params);
59         /// Clip the image using params.
60         virtual void clip_impl(Params const & params);
61         /// Rotate the image using params.
62         virtual void rotate_impl(Params const & params);
63         /// Scale the image using params.
64         virtual void scale_impl(Params const & params);
65
66         /// Access to the class is through newImage() and clone.
67         GuiImage() {}
68         ///
69         GuiImage(GuiImage const &);
70
71         /// The original loaded image.
72         QImage original_;
73
74         /// The transformed image for display.
75         QImage transformed_;
76         /// Buffer the pixmap itself
77         QPixmap transformed_pixmap_;
78 };
79
80 } // namespace graphics
81 } // namespace lyx
82
83 #endif // GUIIMAGE_H