]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QLImage.h
Lots and lots of little trivial bits.
[lyx.git] / src / frontends / qt2 / QLImage.h
1 // -*- C++ -*-
2 /**
3  * \file QLImage.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 QLIMAGE_H
14 #define QLIMAGE_H
15
16 #ifdef __GNUG__
17 #pragma interface
18 #endif
19
20 #include "graphics/GraphicsImage.h"
21
22 #include <qpixmap.h>
23
24 namespace grfx {
25
26 class QLImage : public Image
27 {
28 public:
29         /// Access to this class is through this static method.
30         static ImagePtr newImage();
31
32         /// Return the list of loadable formats.
33         static FormatList loadableFormats();
34
35         ~QLImage();
36
37         /// Create a copy
38         virtual Image * clone() const;
39
40         QPixmap const & qpixmap() const { return xformed_pixmap_; }
41
42         /// Get the image width
43         virtual unsigned int getWidth() const;
44
45         /// Get the image height
46         virtual unsigned int getHeight() const;
47
48         // FIXME
49         virtual bool isDrawable() const { return true; }
50
51         /**
52          * Load the image file into memory.
53          * The process is asynchronous, so this method starts the loading.
54          * When finished, the Image::finishedLoading signal is emitted.
55          */
56         virtual void load(string const & filename);
57
58         /**
59          * Generate the pixmap, based on the current state of
60          * image_ (clipped, rotated, scaled etc).
61          * Uses the params to decide on color, grayscale etc.
62          * Returns true if the pixmap is created.
63          */
64         virtual bool setPixmap(Params const & params);
65
66         /// Clip the image using params.
67         virtual void clip(Params const & params);
68
69         /// Rotate the image using params.
70         virtual void rotate(Params const & params);
71
72         /// Scale the image using params.
73         virtual void scale(Params const & params);
74
75 private:
76         /// Access to the class is through newImage() and clone.
77         QLImage();
78         ///
79         QLImage(QLImage const &);
80
81         /// the original loaded image
82         QPixmap pixmap_;
83
84         /// the transformed pixmap for display
85         QPixmap xformed_pixmap_;
86 };
87
88 } // namespace grfx
89
90 #endif // QLIMAGE_H