]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiImage.h
fix http://bugzilla.lyx.org/show_bug.cgi?id=5002
[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 <QPixmap>
19 #include <QString>
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 & pixmap() const
32         { return is_transformed_? transformed_ : original_; }
33
34 private:
35         /// Create a copy
36         Image * clone() const;
37         /// Get the image width
38         unsigned int width() const;
39         /// Get the image height
40         unsigned int height() const;
41         // FIXME Is the image drawable ?
42         bool isDrawable() const { return true; }
43         /**
44          * Load the image file into memory.
45          */
46         bool load(support::FileName const & filename);
47         /**
48          * Finishes the process of modifying transformed_, using
49          * \c params to decide on color, grayscale etc.
50          * \returns true if successful.
51          */
52         bool setPixmap(Params const & params);
53
54         /// Clip the image using params.
55         bool clip(Params const & params);
56         /// Rotate the image using params.
57         bool rotate(Params const & params);
58         /// Scale the image using params.
59         bool scale(Params const & params);
60
61         /// Access to the class is through newImage() and clone.
62         GuiImage() {}
63         ///
64         GuiImage(GuiImage const &);
65
66         /// The original loaded image.
67         QPixmap original_;
68
69         /// The transformed image for display.
70         QPixmap transformed_;
71         /// Buffer the pixmap itself
72         bool is_transformed_;
73         ///
74         QString fname_;
75 };
76
77 } // namespace graphics
78 } // namespace lyx
79
80 #endif // GUIIMAGE_H