From b0abe20d4b05e9e1e0800b8be64df15fa1660367 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Mon, 2 Nov 2015 10:49:17 +0100 Subject: Darwin: Add QImage::toCGImage() conversion function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (Move QT_FORWARD_DECLARE_CG to qglobal.h) This function converts to CGImage for supported formats. This is done by creating a CGImageRef that reuses the QImage data. The CGImage and QImage ref counting systems are bridged, implemented by using CGDataProvider that holds a copy of the QImage. Unlike the previous internal implementation this public version does not implicitly convert unsupported formats to ARGB32_Premultiplied. See included documentation for the complete description. Change-Id: Ie3984a7a8331e02a6f1c42943caaf76854e93538 Reviewed-by: Morten Johan Sørvig Reviewed-by: Gabriel de Dietrich --- src/gui/image/qimage.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/gui/image/qimage.h') diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h index a99134d3bb..91aaf673d0 100644 --- a/src/gui/image/qimage.h +++ b/src/gui/image/qimage.h @@ -54,6 +54,10 @@ #include #endif +#if defined(Q_OS_DARWIN) || defined(Q_QDOC) +Q_FORWARD_DECLARE_MUTABLE_CG_TYPE(CGImage); +#endif + QT_BEGIN_NAMESPACE @@ -321,6 +325,11 @@ public: static QPixelFormat toPixelFormat(QImage::Format format) Q_DECL_NOTHROW; static QImage::Format toImageFormat(QPixelFormat format) Q_DECL_NOTHROW; + // Platform spesific conversion functions +#if defined(Q_OS_DARWIN) || defined(Q_QDOC) + CGImageRef toCGImage() const Q_DECL_CF_RETURNS_RETAINED; +#endif + #if QT_DEPRECATED_SINCE(5, 0) QT_DEPRECATED inline QString text(const char *key, const char *lang = Q_NULLPTR) const; QT_DEPRECATED inline QList textList() const; -- cgit v1.2.3