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+ (instancetype)internalImageFromQIcon:(const QT_PREPEND_NAMESPACE(QIcon) &)icon;
70@end
71QT_BEGIN_NAMESPACE
72#endif // __OBJC__
73
74#endif
75Q_GUI_EXPORT CGImageRef qt_mac_toCGImage(const QImage &qImage);
76Q_GUI_EXPORT QImage qt_mac_toQImage(CGImageRef image);
77
78Q_GUI_EXPORT QImage qt_mac_padToSquareImage(const QImage &image);
79
80Q_GUI_EXPORT void qt_mac_drawCGImage(CGContextRef inContext, const CGRect *inBounds, CGImageRef inImage);
81
82Q_GUI_EXPORT void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransform *orig_xform);
83
84#ifdef Q_OS_MACOS
85Q_GUI_EXPORT QColor qt_mac_toQColor(const NSColor *color);
86Q_GUI_EXPORT QBrush qt_mac_toQBrush(const NSColor *color, QPalette::ColorGroup colorGroup = QPalette::Normal);
87#endif
88Q_GUI_EXPORT QColor qt_mac_toQColor(CGColorRef color);
89Q_GUI_EXPORT QBrush qt_mac_toQBrush(CGColorRef color);
90
91class Q_GUI_EXPORT QMacCGContext
92{
93public:
94 QMacCGContext() = default;
95 QMacCGContext(QPaintDevice *pdev);
96 QMacCGContext(QPainter *p);
97
98 operator CGContextRef() { return context; }
99
100private:
101 void initialize(QPaintDevice *paintDevice);
102 void initialize(const QImage *, QPainter *painter = nullptr);
103 QCFType<CGContextRef> context;
104};
105
106QT_END_NAMESPACE
107
108#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)
QImage qt_mac_padToSquareImage(const QImage &image)
Q_FORWARD_DECLARE_OBJC_CLASS(UIImage)
Q_FORWARD_DECLARE_OBJC_CLASS(NSColor)
QDebug Q_GUI_EXPORT & operator<<(QDebug &s, const QVectorPath &path)