]> git.lyx.org Git - lyx.git/blob - src/frontends/gtk/LyXGdkImage.h
Extracted from r14281
[lyx.git] / src / frontends / gtk / LyXGdkImage.h
1 // -*- C++ -*-
2 /**
3  * \file GdkImage.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 (original Qt version)
8  * \author John Levon (original Qt version)
9  * \author John Spray
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 #ifndef LYXGDKIMAGE_H
15 #define LYXGDKIMAGE_H
16
17
18 #include "graphics/GraphicsImage.h"
19
20 #include <gdkmm.h>
21
22 namespace lyx {
23 namespace graphics {
24
25 class LyXGdkImage : public Image {
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         Glib::RefPtr<Gdk::Pixbuf> const & pixbuf() const {return transformed_;}
35
36 private:
37         /// Create a copy
38         virtual Image * clone_impl() const;
39         /// Get the image width
40         virtual unsigned int getWidth_impl() const;
41         /// Get the image height
42         virtual unsigned int getHeight_impl() const;
43         // FIXME Is the image drawable ?
44         virtual bool isDrawable_impl() const { return true; }
45         /**
46          * Load the image file into memory.
47          * The process is asynchronous, so this method starts the loading.
48          * When finished, the Image::finishedLoading signal is emitted.
49          */
50         virtual void load_impl(std::string const & filename);
51         /**
52          * Finishes the process of modifying transformed_, using
53          * \c params to decide on color, grayscale etc.
54          * \returns true if successful.
55          */
56         virtual bool setPixmap_impl(Params const & params);
57         /// Clip the image using params.
58         virtual void clip_impl(Params const & params);
59         /// Rotate the image using params.
60         virtual void rotate_impl(Params const & params);
61         /// Scale the image using params.
62         virtual void scale_impl(Params const & params);
63
64         /// Access to the class is through newImage() and clone.
65         LyXGdkImage();
66         ///
67         LyXGdkImage(LyXGdkImage const &);
68
69         Glib::RefPtr<Gdk::Pixbuf> original_;
70         Glib::RefPtr<Gdk::Pixbuf> transformed_;
71 };
72
73 } // namespace graphics
74 } // namespace lyx
75
76 #endif // LYXGDKIMAGE_H