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// Qt-Security score:significant reason:default
4
5#ifndef QCOREGRAPHICS_P_H
6#define QCOREGRAPHICS_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtCore/private/qcore_mac_p.h>
20
21#include <QtCore/qsize.h>
22
23#include <QtGui/private/qtguiglobal_p.h>
24#include <QtGui/qicon.h>
25#include <QtGui/qpalette.h>
26#include <QtGui/qregion.h>
27
28#include <CoreGraphics/CoreGraphics.h>
29
30#if defined(Q_OS_MACOS)
31# if defined(__OBJC__)
32# include <AppKit/NSImage.h>
33# else
34Q_FORWARD_DECLARE_OBJC_CLASS(NSImage);
35# endif
36#endif
37
40
41struct vImage_CGImageFormat;
42
44
45Q_GUI_EXPORT std::optional<vImage_CGImageFormat> qt_mac_cgImageFormatForImage(const QImage &image);
46
47#ifdef QT_PLATFORM_UIKIT
48Q_GUI_EXPORT QImage qt_mac_toQImage(const UIImage *image, QSizeF size);
49#endif
50
51#ifdef Q_OS_MACOS
52Q_GUI_EXPORT QPixmap qt_mac_toQPixmap(const NSImage *image, const QSizeF &size);
53
54#if defined(__OBJC__)
55QT_END_NAMESPACE
56
57// @compatibility_alias doesn't work with categories or their methods
58#define imageFromQImage QT_MANGLE_NAMESPACE(imageFromQImage)
59#define imageFromQIcon QT_MANGLE_NAMESPACE(imageFromQIcon)
60
61@interface NSImage (QtExtras)
62+ (instancetype)imageFromQImage:(const QT_PREPEND_NAMESPACE(QImage) &)image;
63+ (instancetype)imageFromQIcon:(const QT_PREPEND_NAMESPACE(QIcon) &)icon;
64+ (instancetype)imageFromQIcon:(const QT_PREPEND_NAMESPACE(QIcon) &)icon
65 withSize:(const QT_PREPEND_NAMESPACE(QSize) &)size;
66+ (instancetype)imageFromQIcon:(const QT_PREPEND_NAMESPACE(QIcon) &)icon
67 withSize:(const QT_PREPEND_NAMESPACE(QSize) &)size
68 withMode:(QT_PREPEND_NAMESPACE(QIcon)::Mode)mode
69 withState:(QT_PREPEND_NAMESPACE(QIcon)::State)state;
70+ (instancetype)internalImageFromQIcon:(const QT_PREPEND_NAMESPACE(QIcon) &)icon;
71@end
72QT_BEGIN_NAMESPACE
73#endif // __OBJC__
74
75#endif
76Q_GUI_EXPORT CGImageRef qt_mac_toCGImage(const QImage &qImage);
77Q_GUI_EXPORT QImage qt_mac_toQImage(CGImageRef image);
78
79Q_GUI_EXPORT QImage qt_mac_padToSquareImage(const QImage &image);
80
81Q_GUI_EXPORT void qt_mac_drawCGImage(CGContextRef inContext, const CGRect *inBounds, CGImageRef inImage);
82
83Q_GUI_EXPORT void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransform *orig_xform);
84
85#ifdef Q_OS_MACOS
86Q_GUI_EXPORT QColor qt_mac_toQColor(const NSColor *color);
87Q_GUI_EXPORT QBrush qt_mac_toQBrush(const NSColor *color, QPalette::ColorGroup colorGroup = QPalette::Normal);
88#endif
89Q_GUI_EXPORT QColor qt_mac_toQColor(CGColorRef color);
90Q_GUI_EXPORT QBrush qt_mac_toQBrush(CGColorRef color);
91
92class Q_GUI_EXPORT QMacCGContext
93{
94public:
95 QMacCGContext() = default;
96 QMacCGContext(QPaintDevice *pdev);
97 QMacCGContext(QPainter *p);
98
99 operator CGContextRef() { return context; }
100
101private:
102 void initialize(QPaintDevice *paintDevice);
103 void initialize(const QImage *, QPainter *painter = nullptr);
104 QCFType<CGContextRef> context;
105};
106
107QT_END_NAMESPACE
108
109#endif // QCOREGRAPHICS_P_H
\inmodule QtGui
Definition qbrush.h:30
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
\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)