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