Qt 6.x
The Qt SDK
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 <QtGui/private/qtguiglobal_p.h>
21#include <QtGui/qregion.h>
22#include <QtGui/qpalette.h>
23
24#include <CoreGraphics/CoreGraphics.h>
25
26#if defined(__OBJC__) && defined(Q_OS_MACOS)
27#include <AppKit/AppKit.h>
28#define HAVE_APPKIT
29#endif
30
32
33Q_GUI_EXPORT CGBitmapInfo qt_mac_bitmapInfoForImage(const QImage &image);
34
35#ifdef HAVE_APPKIT
36Q_GUI_EXPORT QPixmap qt_mac_toQPixmap(const NSImage *image, const QSizeF &size);
37
39
40// @compatibility_alias doesn't work with categories or their methods
41#define imageFromQImage QT_MANGLE_NAMESPACE(imageFromQImage)
42#define imageFromQIcon QT_MANGLE_NAMESPACE(imageFromQIcon)
43
44@interface NSImage (QtExtras)
45+ (instancetype)imageFromQImage:(const QT_PREPEND_NAMESPACE(QImage) &)image;
46+ (instancetype)imageFromQIcon:(const QT_PREPEND_NAMESPACE(QIcon) &)icon;
47+ (instancetype)imageFromQIcon:(const QT_PREPEND_NAMESPACE(QIcon) &)icon withSize:(int)size;
48@end
50
51#endif
52Q_GUI_EXPORT CGImageRef qt_mac_toCGImage(const QImage &qImage);
53Q_GUI_EXPORT CGImageRef qt_mac_toCGImageMask(const QImage &qImage);
54Q_GUI_EXPORT QImage qt_mac_toQImage(CGImageRef image);
55
56Q_GUI_EXPORT void qt_mac_drawCGImage(CGContextRef inContext, const CGRect *inBounds, CGImageRef inImage);
57
58Q_GUI_EXPORT void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransform *orig_xform);
59
60#ifdef HAVE_APPKIT
61Q_GUI_EXPORT QColor qt_mac_toQColor(const NSColor *color);
62Q_GUI_EXPORT QBrush qt_mac_toQBrush(const NSColor *color, QPalette::ColorGroup colorGroup = QPalette::Normal);
63#endif
64Q_GUI_EXPORT QColor qt_mac_toQColor(CGColorRef color);
65Q_GUI_EXPORT QBrush qt_mac_toQBrush(CGColorRef color);
66
67class Q_GUI_EXPORT QMacCGContext
68{
69public:
70 QMacCGContext() = default;
73
74 operator CGContextRef() { return context; }
75
76private:
77 void initialize(QPaintDevice *paintDevice);
78 void initialize(const QImage *, QPainter *painter = nullptr);
80};
81
83
84#undef HAVE_APPKIT
85
86#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
The QIcon class provides scalable icons in different modes and states.
Definition qicon.h:20
\inmodule QtGui
Definition qimage.h:37
QMacCGContext()=default
The QPainter class performs low-level painting on widgets and other paint devices.
Definition qpainter.h:46
ColorGroup
\value Disabled \value Active \value Inactive \value Normal synonym for Active
Definition qpalette.h:48
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
Definition qpixmap.h:27
The QRegion class specifies a clip region for a painter.
Definition qregion.h:27
\inmodule QtCore
Definition qsize.h:207
Combined button and popup list for selecting options.
Definition image.cpp:4
static void * context
void qt_mac_drawCGImage(CGContextRef inContext, const CGRect *inBounds, CGImageRef inImage)
QBrush qt_mac_toQBrush(CGColorRef color)
void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransform *orig_xform)
QColor qt_mac_toQColor(CGColorRef color)
QImage qt_mac_toQImage(CGImageRef image)
CGImageRef qt_mac_toCGImage(const QImage &inImage)
CGImageRef qt_mac_toCGImageMask(const QImage &image)
QT_BEGIN_NAMESPACE Q_GUI_EXPORT CGBitmapInfo qt_mac_bitmapInfoForImage(const QImage &image)
static bool initialize()
Definition qctf.cpp:67
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLfloat GLfloat p
[1]
struct CGContext * CGContextRef
QT_END_NAMESPACE typedef QT_PREPEND_NAMESPACE(quintptr) WId
QPainter painter(this)
[7]