summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qimage.h
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-01-31 13:32:22 +0100
committerQt by Nokia <qt-info@nokia.com>2012-01-31 16:21:17 +0100
commit298330bd436ca9437aa8023363f916b12811c7bf (patch)
treebbcfc14412984c75a183eca9ddc4244bbcc55edb /src/gui/image/qimage.h
parent2bf186a2e598a4bccdc4979085e8e4d963a3819d (diff)
Add support for cleanup functions for data-constructed QImages
A QImage can be constructed with a provided buffer, that has to be kept alive for the live-time of the QImage and all its copies. Frameworks like CoreGraphics or Cairo offer a similar method of creating image objects and also offer the ability to provide a callback function that is called when the image is destroyed. This patch adds this functionality to QImage by extending the QImage constructors that take a raw image buffer pointer. Change-Id: Ia6342408c560ef49b498c9e4664b4602febb0fcd Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com> Reviewed-by: Michalina Ziemba <michalina.ziemba@nokia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
Diffstat (limited to 'src/gui/image/qimage.h')
-rw-r--r--src/gui/image/qimage.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h
index b805a3297f..5a3ae8f886 100644
--- a/src/gui/image/qimage.h
+++ b/src/gui/image/qimage.h
@@ -88,6 +88,7 @@ public:
#endif
#endif //QT_NO_IMAGE_TEXT
+typedef void (*QImageCleanupFunction)(void*);
class Q_GUI_EXPORT QImage : public QPaintDevice
{
@@ -128,10 +129,10 @@ public:
QImage();
QImage(const QSize &size, Format format);
QImage(int width, int height, Format format);
- QImage(uchar *data, int width, int height, Format format);
- QImage(const uchar *data, int width, int height, Format format);
- QImage(uchar *data, int width, int height, int bytesPerLine, Format format);
- QImage(const uchar *data, int width, int height, int bytesPerLine, Format format);
+ QImage(uchar *data, int width, int height, Format format, QImageCleanupFunction cleanupFunction = 0, void *cleanupInfo = 0);
+ QImage(const uchar *data, int width, int height, Format format, QImageCleanupFunction cleanupFunction = 0, void *cleanupInfo = 0);
+ QImage(uchar *data, int width, int height, int bytesPerLine, Format format, QImageCleanupFunction cleanupFunction = 0, void *cleanupInfo = 0);
+ QImage(const uchar *data, int width, int height, int bytesPerLine, Format format, QImageCleanupFunction cleanupFunction = 0, void *cleanupInfo = 0);
#ifndef QT_NO_IMAGEFORMAT_XPM
explicit QImage(const char * const xpm[]);