]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiImage.h
Simplify and optimize image on screen visualization. Fix one bug or two along the...
[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
20 namespace lyx {
21 namespace graphics {
22
23 class GuiImage : public Image
24 {
25 public:
26         /// Access to this class is through this static method.
27         static Image * newImage();
28
29         /// Retrieve the buffered pixmap.
30         QPixmap const & pixmap() const
31         { return is_transformed_? transformed_ : original_; }
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         /**
47          * Finishes the process of modifying transformed_, using
48          * \c params to decide on color, grayscale etc.
49          * \returns true if successful.
50          */
51         bool setPixmap(Params const & params);
52
53         /// Clip the image using params.
54         bool clip(Params const & params);
55         /// Rotate the image using params.
56         bool rotate(Params const & params);
57         /// Scale the image using params.
58         bool scale(Params const & params);
59
60         /// Access to the class is through newImage() and clone.
61         GuiImage() {}
62         ///
63         GuiImage(GuiImage const &);
64
65         /// The original loaded image.
66         QPixmap original_;
67
68         /// The transformed image for display.
69         QPixmap transformed_;
70         /// Buffer the pixmap itself
71         bool is_transformed_;
72 };
73
74 } // namespace graphics
75 } // namespace lyx
76
77 #endif // GUIIMAGE_H