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