]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiImage.h
* GuiImage:
[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 <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 rendered image.
31         QImage const & image() const;
32
33 private:
34         /// Create a copy
35         Image * clone() const;
36         /// Get the image width
37         unsigned int width() const;
38         /// Get the image height
39         unsigned int height() const;
40         // FIXME Is the image drawable ?
41         bool isDrawable() const { return true; }
42         /**
43          * Load the image file into memory.
44          */
45         bool load(support::FileName const & filename);
46         bool load();
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         QImage original_;
68
69         /// The transformed image for display.
70         QImage transformed_;
71
72         ///
73         bool is_transformed_;
74         ///
75         QString fname_;
76 };
77
78 } // namespace graphics
79 } // namespace lyx
80
81 #endif // GUIIMAGE_H