5#ifndef QCOREGRAPHICS_P_H
6#define QCOREGRAPHICS_P_H
19#include <QtCore/private/qcore_mac_p.h>
21#include <QtCore/qsize.h>
23#include <QtGui/private/qtguiglobal_p.h>
24#include <QtGui/qicon.h>
25#include <QtGui/qpalette.h>
26#include <QtGui/qregion.h>
28#include <CoreGraphics/CoreGraphics.h>
30#if defined(Q_OS_MACOS)
32# include <AppKit/NSImage.h>
34Q_FORWARD_DECLARE_OBJC_CLASS(NSImage);
45 uint32_t bitsPerComponent = 0;
46 uint32_t bitsPerPixel = 0;
47 QCFType<CGColorSpaceRef> colorSpace;
48 CGBitmapInfo bitmapInfo = 0;
51Q_GUI_EXPORT std::optional<QCGImageFormat> qt_mac_cgImageFormatForImage(
const QImage &image);
53#ifdef QT_PLATFORM_UIKIT
54Q_GUI_EXPORT QImage qt_mac_toQImage(
const UIImage *image, QSizeF size);
58Q_GUI_EXPORT QPixmap qt_mac_toQPixmap(
const NSImage *image,
const QSizeF &size);
64#define imageFromQImage QT_MANGLE_NAMESPACE(imageFromQImage)
65#define imageFromQIcon QT_MANGLE_NAMESPACE(imageFromQIcon)
67@interface NSImage (QtExtras)
68+ (instancetype)imageFromQImage:(
const QT_PREPEND_NAMESPACE(QImage) &)image;
69+ (instancetype)imageFromQIcon:(
const QT_PREPEND_NAMESPACE(QIcon) &)icon;
70+ (instancetype)imageFromQIcon:(
const QT_PREPEND_NAMESPACE(QIcon) &)icon
71 withSize:(
const QT_PREPEND_NAMESPACE(QSize) &)size;
72+ (instancetype)imageFromQIcon:(
const QT_PREPEND_NAMESPACE(QIcon) &)icon
73 withSize:(
const QT_PREPEND_NAMESPACE(QSize) &)size
74 withMode:(QT_PREPEND_NAMESPACE(QIcon)::Mode)mode
75 withState:(QT_PREPEND_NAMESPACE(QIcon)::State)state;
76+ (instancetype)internalImageFromQIcon:(
const QT_PREPEND_NAMESPACE(QIcon) &)icon;
82Q_GUI_EXPORT CGImageRef qt_mac_toCGImage(
const QImage &qImage);
83Q_GUI_EXPORT
QImage qt_mac_toQImage(CGImageRef image);
85Q_GUI_EXPORT
QImage qt_mac_padToSquareImage(
const QImage &image);
87Q_GUI_EXPORT
void qt_mac_drawCGImage(CGContextRef inContext,
const CGRect *inBounds, CGImageRef inImage);
89Q_GUI_EXPORT
void qt_mac_clip_cg(CGContextRef hd,
const QRegion &rgn, CGAffineTransform *orig_xform);
92Q_GUI_EXPORT QColor qt_mac_toQColor(
const NSColor *color);
93Q_GUI_EXPORT QBrush qt_mac_toQBrush(
const NSColor *color, QPalette::ColorGroup colorGroup = QPalette::Normal);
95Q_GUI_EXPORT
QColor qt_mac_toQColor(CGColorRef color);
96Q_GUI_EXPORT
QBrush qt_mac_toQBrush(CGColorRef color);
101 QMacCGContext() =
default;
102 QMacCGContext(QPaintDevice *pdev);
103 QMacCGContext(QPainter *p);
105 operator CGContextRef() {
return context; }
108 void initialize(QPaintDevice *paintDevice);
109 void initialize(
const QImage *, QPainter *painter =
nullptr);
110 QCFType<CGContextRef> context;
The QColor class provides colors based on RGB, HSV or CMYK values.
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)