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/corelib/global/qglobal.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index c5d891cc28..3d8baf7188 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -538,6 +538,12 @@ Q_DECL_CONSTEXPR inline const T &qBound(const T &min, const T &val, const T &max #ifndef Q_FORWARD_DECLARE_MUTABLE_CF_TYPE # define Q_FORWARD_DECLARE_MUTABLE_CF_TYPE(type) typedef struct __ ## type * type ## Ref #endif +#ifndef Q_FORWARD_DECLARE_CG_TYPE +#define Q_FORWARD_DECLARE_CG_TYPE(type) typedef const struct type *type ## Ref; +#endif +#ifndef Q_FORWARD_DECLARE_MUTABLE_CG_TYPE +#define Q_FORWARD_DECLARE_MUTABLE_CG_TYPE(type) typedef struct type *type ## Ref; +#endif #ifdef Q_OS_DARWIN # define QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(macos, ios, tvos, watchos) \ -- cgit v1.2.3