5#ifndef QPAINTENGINE_MAC_P_H
6#define QPAINTENGINE_MAC_P_H
19#include <QtPrintSupport/qtprintsupportglobal.h>
21#include <QtGui/qpaintengine.h>
22#include <QtGui/private/qpaintengine_p.h>
23#include <QtGui/private/qfont_p.h>
24#include <QtCore/qhash.h>
26typedef struct CGColorSpace *CGColorSpaceRef;
31class QCoreGraphicsPaintEnginePrivate;
40 bool begin(QPaintDevice *pdev);
46 void updateBrush(
const QBrush &brush,
const QPointF &pt);
52 void updateClipPath(
const QPainterPath &path, Qt::ClipOperation op);
56 void drawLines(
const QLineF *lines,
int lineCount);
57 void drawRects(
const QRectF *rects,
int rectCount);
58 void drawPoints(
const QPointF *p,
int pointCount);
60 void drawPath(
const QPainterPath &path);
62 void drawPolygon(
const QPointF *points,
int pointCount, PolygonDrawMode mode);
63 void drawPixmap(
const QRectF &r,
const QPixmap &pm,
const QRectF &sr);
64 void drawTiledPixmap(
const QRectF &r,
const QPixmap &pixmap,
const QPointF &s);
66 void drawTextItem(
const QPointF &pos,
const QTextItem &item);
67 void drawImage(
const QRectF &r,
const QImage &pm,
const QRectF &sr,
70 Type type()
const {
return QPaintEngine::CoreGraphics; }
80 void drawLines(
const QLine *lines,
int lineCount) { QPaintEngine::drawLines(lines, lineCount); }
81 void drawRects(
const QRect *rects,
int rectCount) { QPaintEngine::drawRects(rects, rectCount); }
82 void drawPoints(
const QPoint *p,
int pointCount) { QPaintEngine::drawPoints(p, pointCount); }
83 void drawEllipse(
const QRect &r) { QPaintEngine::drawEllipse(r); }
84 void drawPolygon(
const QPoint *points,
int pointCount, PolygonDrawMode mode)
85 { QPaintEngine::drawPolygon(points, pointCount, mode); }
97
98
101 Q_DECLARE_PUBLIC(QCoreGraphicsPaintEngine)
133 void drawPath(uchar ops, CGMutablePathRef path =
nullptr);
134 void setClip(
const QRegion *rgn =
nullptr);
145 CGContextConcatCTM(
hd, CGAffineTransformInvert(CGContextGetCTM(
hd)));
146 CGAffineTransform xform = orig_xform;
148 extern CGAffineTransform qt_mac_convert_transform_to_cg(
const QTransform &);
149 xform = CGAffineTransformConcat(qt_mac_convert_transform_to_cg(*matrix), xform);
151 CGContextConcatCTM(
hd, xform);
152 CGContextSetTextMatrix(
hd, xform);
159 CGContextSaveGState(
hd);
166 CGContextRestoreGState(
hd);
void setTransform(const QTransform *matrix=nullptr)
void setFillBrush(const QPointF &origin=QPoint())
void setStrokePen(const QPen &pen)
QPointF devicePixelSize(CGContextRef context)
float adjustPenWidth(float penWidth)
CGAffineTransform orig_xform
void restoreGraphicsState()
void drawPath(uchar ops, CGMutablePathRef path=nullptr)
void setClip(const QRegion *rgn=nullptr)
void updateState(const QPaintEngineState &state)
Reimplement this function to update the state of a paint engine.
void updateRenderHints(QPainter::RenderHints hints)
void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags=Qt::AutoColor)
Reimplement this function to draw the part of the image specified by the sr rectangle in the given re...
Type type() const
Reimplement this function to return the paint engine \l{Type}.
void drawPoints(const QPointF *p, int pointCount)
Draws the first pointCount points in the buffer points.
void drawRects(const QRectF *rects, int rectCount)
Draws the first rectCount rectangles in the buffer rects.
void drawTextItem(const QPointF &pos, const QTextItem &item)
This function draws the text item textItem at position p.
void updateMatrix(const QTransform &matrix)
void updateBrush(const QBrush &brush, const QPointF &pt)
QPainter::RenderHints supportedRenderHints() const
void updateClipPath(const QPainterPath &path, Qt::ClipOperation op)
bool end()
Reimplement this function to finish painting on the current paint device.
bool begin(QPaintDevice *pdev)
Reimplement this function to initialise your paint engine when painting is to start on the paint devi...
void updateCompositionMode(QPainter::CompositionMode mode)
CGContextRef handle() const
QCoreGraphicsPaintEngine(QPaintEnginePrivate &dptr)
void updateFont(const QFont &font)
void drawLines(const QLineF *lines, int lineCount)
The default implementation splits the list of lines in lines into lineCount separate calls to drawPat...
void updateClipRegion(const QRegion ®ion, Qt::ClipOperation op)
void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s)
Reimplement this function to draw the pixmap in the given rect, starting at the given p.
void drawEllipse(const QRectF &r)
Reimplement this function to draw the largest ellipse that can be contained within rectangle rect.
~QCoreGraphicsPaintEngine()
void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
Reimplement this virtual function to draw the polygon defined by the pointCount first points in point...
void updatePen(const QPen &pen)
void updateOpacity(qreal opacity)
void drawPath(const QPainterPath &path)
The default implementation ignores the path and does nothing.
void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
Reimplement this function to draw the part of the pm specified by the sr rectangle in the given r.
void updateTransform(const QTransform &matrix)
~QMacPrintEnginePrivate()
PMPrintSession session() const
QPrinter::PrinterState state
QSharedPointer< QCocoaPrintDevice > m_printDevice
QPaintEngine * paintEngine
Qt::HANDLE nativeHandle() override
QPaintEngine * aggregateEngine() override
PMPrintSettings settings() const
PMPageFormat format() const
void setPageSize(const QPageSize &pageSize)
QHash< QMacPrintEngine::PrintEnginePropertyKey, QVariant > valueCache
bool isPrintSessionInitialized() const
virtual void drawPoints(const QPointF *p, int pointCount)
Draws the first pointCount points in the buffer points.
void updateState(const QPaintEngineState &state)
Reimplement this function to update the state of a paint engine.
QPaintEngine * paintEngine() const
virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags)
Reimplement this function to draw the part of the image specified by the sr rectangle in the given re...
virtual void drawTextItem(const QPointF &p, const QTextItem &ti)
This function draws the text item textItem at position p.
QVariant property(PrintEnginePropertyKey key) const
Returns the print engine's property specified by key.
virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s)
Reimplement this function to draw the pixmap in the given rect, starting at the given p.
virtual void drawPath(const QPainterPath &)
The default implementation ignores the path and does nothing.
bool newPage()
Instructs the print engine to start a new page.
Qt::HANDLE handle() const
virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
Reimplement this virtual function to draw the polygon defined by the pointCount first points in point...
QPrinter::PrinterState printerState() const
Returns the current state of the printer being used by the print engine.
virtual void drawRects(const QRectF *r, int num)
Draws the first rectCount rectangles in the buffer rects.
NSPrintInfo * printInfo()
bool end()
Reimplement this function to finish painting on the current paint device.
bool begin(QPaintDevice *dev)
Reimplement this function to initialise your paint engine when painting is to start on the paint devi...
virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
Reimplement this function to draw the part of the pm specified by the sr rectangle in the given r.
bool abort()
Instructs the print engine to abort the printing process.
int metric(QPaintDevice::PaintDeviceMetric) const
Returns the metric for the given id.
virtual void drawEllipse(const QRectF &r)
Reimplement this function to draw the largest ellipse that can be contained within rectangle rect.
void setProperty(PrintEnginePropertyKey key, const QVariant &value)
Sets the print engine's property specified by key to the given value.
virtual void drawLines(const QLineF *lines, int lineCount)
The default implementation splits the list of lines in lines into lineCount separate calls to drawPat...
virtual QPaintEngine::Type type() const
Reimplement this function to return the paint engine \l{Type}.
Q_FORWARD_DECLARE_OBJC_CLASS(NSObject)
struct CGContext * CGContextRef