]> git.lyx.org Git - lyx.git/blob - src/graphics/GraphicsImage.h
* sk.po
[lyx.git] / src / graphics / GraphicsImage.h
1 // -*- C++ -*-
2 /**
3  * \file GraphicsImage.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Baruch Even
8  * \author Angus Leeming
9  *
10  * Full author contact details are available in file CREDITS.
11  *
12  * An abstract base class for the images themselves.
13  * Allows the user to retrieve the pixmap, once loaded and to issue commands
14  * to modify it.
15  *
16  * The boost::functions newImage and loadableFormats are connected to the
17  * appropriate derived classes elsewhere, allowing the graphics cache to
18  * access them without knowing anything about their instantiation.
19  *
20  * The loading process can be asynchronous, but cropping, rotating and
21  * scaling block execution.
22  */
23
24 #ifndef GRAPHICSIMAGE_H
25 #define GRAPHICSIMAGE_H
26
27 #include "Dimension.h"
28
29 namespace lyx {
30
31 namespace support { class FileName; }
32
33 namespace graphics {
34
35 class Params;
36
37 class Image {
38 public:
39         ///
40         virtual ~Image() {}
41
42         /// Create a copy
43         virtual Image * clone() const = 0;
44
45         /// Get the image width
46         virtual unsigned int width() const = 0;
47
48         /// Get the image height
49         virtual unsigned int height() const = 0;
50
51         /// Is the image drawable ?
52         virtual bool isDrawable() const = 0;
53
54         /** Start loading the image file.
55          *  The caller should expect this process to be asynchronous and
56          *  so should connect to the "finished" signal above.
57          */
58         virtual bool load(support::FileName const & filename) = 0;
59
60         /** Generate the pixmap.
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) = 0;
65 };
66
67 /// Only way to create a new Image.
68 /// Implemented in the frontend.
69 Image * newImage();
70
71 } // namespace graphics
72 } // namespace lyx
73
74 #endif // GRAPHICSIMAGE_H