Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qcoregraphics_p.h
Go to the documentation of this file.
1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QCOREGRAPHICS_P_H
5#define QCOREGRAPHICS_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtCore/private/qcore_mac_p.h>
19
20#include <QtCore/qsize.h>
21
22#include <QtGui/private/qtguiglobal_p.h>
23#include <QtGui/qicon.h>
24#include <QtGui/qpalette.h>
25#include <QtGui/qregion.h>
26
27#include <CoreGraphics/CoreGraphics.h>
28
29#if defined(Q_OS_MACOS)
30# if defined(__OBJC__)
31# include <AppKit/NSImage.h>
32# else
33Q_FORWARD_DECLARE_OBJC_CLASS(NSImage);
34# endif
35#endif
36
39
40struct vImage_CGImageFormat;
41
43
44Q_GUI_EXPORT std::optional<vImage_CGImageFormat> qt_mac_cgImageFormatForImage(const QImage &image);
45
46#ifdef QT_PLATFORM_UIKIT
47Q_GUI_EXPORT QImage qt_mac_toQImage(const UIImage *image, QSizeF size);
48#endif
49
50#ifdef Q_OS_MACOS
51Q_GUI_EXPORT QPixmap qt_mac_toQPixmap(const NSImage *image, const QSizeF &size);
52
53#if defined(__OBJC__)
54QT_END_NAMESPACE
55
56// @compatibility_alias doesn't work with categories or their methods
57#define imageFromQImage QT_MANGLE_NAMESPACE(imageFromQImage)
58#define imageFromQIcon QT_MANGLE_NAMESPACE(imageFromQIcon)
59
60@interface NSImage (QtExtras)
61+ (instancetype)imageFromQImage:(const QT_PREPEND_NAMESPACE(QImage) &)image;
62+ (instancetype)imageFromQIcon:(const QT_PREPEND_NAMESPACE(QIcon) &)icon;
63+ (instancetype)imageFromQIcon:(const QT_PREPEND_NAMESPACE(QIcon) &)icon
64 withSize:(const QT_PREPEND_NAMESPACE(QSize) &)size;
65+ (instancetype)imageFromQIcon:(const QT_PREPEND_NAMESPACE(QIcon) &)icon
66 withSize:(const QT_PREPEND_NAMESPACE(QSize) &)size
67 withMode:(QT_PREPEND_NAMESPACE(QIcon)::Mode)mode
68 withState:(QT_PREPEND_NAMESPACE(QIcon)::State)state;
69@end
70QT_BEGIN_NAMESPACE
71#endif // __OBJC__
72
73#endif
74Q_GUI_EXPORT CGImageRef qt_mac_toCGImage(const QImage &qImage);
75Q_GUI_EXPORT QImage qt_mac_toQImage(CGImageRef image);
76
77Q_GUI_EXPORT void qt_mac_drawCGImage(CGContextRef inContext, const CGRect *inBounds, CGImageRef inImage);
78
79Q_GUI_EXPORT void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransform *orig_xform);
80
81#ifdef Q_OS_MACOS
82Q_GUI_EXPORT QColor qt_mac_toQColor(const NSColor *color);
83Q_GUI_EXPORT QBrush qt_mac_toQBrush(const NSColor *color, QPalette::ColorGroup colorGroup = QPalette::Normal);
84#endif
85Q_GUI_EXPORT QColor qt_mac_toQColor(CGColorRef color);
86Q_GUI_EXPORT QBrush qt_mac_toQBrush(CGColorRef color);
87
88class Q_GUI_EXPORT QMacCGContext
89{
90public:
91 QMacCGContext() = default;
92 QMacCGContext(QPaintDevice *pdev);
93 QMacCGContext(QPainter *p);
94
95 operator CGContextRef() { return context; }
96
97private:
98 void initialize(QPaintDevice *paintDevice);
99 void initialize(const QImage *, QPainter *painter = nullptr);
100 QCFType<CGContextRef> context;
101};
102
103QT_END_NAMESPACE
104
105#endif // QCOREGRAPHICS_P_H
\inmodule QtGui
Definition qbrush.h:29
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:30
\inmodule QtGui
Definition qimage.h:37
void qt_mac_drawCGImage(CGContextRef inContext, const CGRect *inBounds, CGImageRef inImage)
QBrush qt_mac_toQBrush(CGColorRef color)
QImage::Format qt_mac_imageFormatForCGImage(CGImageRef image)
void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransform *orig_xform)
QColor qt_mac_toQColor(CGColorRef color)
void qt_mac_scale_region(QRegion *region, qreal scaleFactor)
QImage qt_mac_toQImage(CGImageRef cgImage)
CGImageRef qt_mac_toCGImage(const QImage &inImage)
Q_FORWARD_DECLARE_OBJC_CLASS(UIImage)
Q_FORWARD_DECLARE_OBJC_CLASS(NSColor)
QDebug Q_GUI_EXPORT & operator<<(QDebug &s, const QVectorPath &path)