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