]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QLImage.h
Martin's changes to the Note inset.
[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
17 #include "graphics/GraphicsImage.h"
18
19 #include <qpixmap.h>
20
21 namespace lyx {
22 namespace graphics {
23
24 class QLImage : public Image {
25 public:
26         /// Access to this class is through this static method.
27         static ImagePtr newImage();
28
29         /// Return the list of loadable formats.
30         static FormatList loadableFormats();
31
32         ~QLImage();
33
34         /// Create a copy
35         virtual Image * clone() const;
36
37         QPixmap const & qpixmap() const { return xformed_pixmap_; }
38
39         /// Get the image width
40         virtual unsigned int getWidth() const;
41
42         /// Get the image height
43         virtual unsigned int getHeight() const;
44
45         // FIXME
46         virtual bool isDrawable() const { return true; }
47
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(string const & filename);
54
55         /**
56          * Generate the pixmap, based on the current state of
57          * image_ (clipped, rotated, scaled etc).
58          * Uses the params to decide on color, grayscale etc.
59          * Returns true if the pixmap is created.
60          */
61         virtual bool setPixmap(Params const & params);
62
63         /// Clip the image using params.
64         virtual void clip(Params const & params);
65
66         /// Rotate the image using params.
67         virtual void rotate(Params const & params);
68
69         /// Scale the image using params.
70         virtual void scale(Params const & params);
71 private:
72         /// Access to the class is through newImage() and clone.
73         QLImage();
74         ///
75         QLImage(QLImage const &);
76
77         /// the original loaded image
78         QPixmap pixmap_;
79
80         /// the transformed pixmap for display
81         QPixmap xformed_pixmap_;
82 };
83
84 } // namespace graphics
85 } // namespace lyx
86
87 #endif // QLIMAGE_H