Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QMacPrintEngine Class Reference

#include <qprintengine_mac_p.h>

+ Inheritance diagram for QMacPrintEngine:
+ Collaboration diagram for QMacPrintEngine:

Public Member Functions

 QMacPrintEngine (QPrinter::PrinterMode mode, const QString &deviceId)
 
Qt::HANDLE handle () const
 
bool begin (QPaintDevice *dev)
 Reimplement this function to initialise your paint engine when painting is to start on the paint device pdev.
 
bool end ()
 Reimplement this function to finish painting on the current paint device.
 
virtual QPaintEngine::Type type () const
 Reimplement this function to return the paint engine \l{Type}.
 
QPaintEnginepaintEngine () const
 
void setProperty (PrintEnginePropertyKey key, const QVariant &value)
 Sets the print engine's property specified by key to the given value.
 
QVariant property (PrintEnginePropertyKey key) const
 Returns the print engine's property specified by key.
 
QPrinter::PrinterState printerState () const
 Returns the current state of the printer being used by the print engine.
 
bool newPage ()
 Instructs the print engine to start a new page.
 
bool abort ()
 Instructs the print engine to abort the printing process.
 
int metric (QPaintDevice::PaintDeviceMetric) const
 Returns the metric for the given id.
 
NSPrintInfo * printInfo ()
 
void updateState (const QPaintEngineState &state)
 Reimplement this function to update the state of a paint engine.
 
virtual void drawLines (const QLineF *lines, int lineCount)
 The default implementation splits the list of lines in lines into lineCount separate calls to drawPath() or drawPolygon() depending on the feature set of the paint engine.
 
virtual void drawRects (const QRectF *r, int num)
 Draws the first rectCount rectangles in the buffer rects.
 
virtual void drawPoints (const QPointF *p, int pointCount)
 Draws the first pointCount points in the buffer points.
 
virtual void drawEllipse (const QRectF &r)
 Reimplement this function to draw the largest ellipse that can be contained within rectangle rect.
 
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 points, using mode mode.
 
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.
 
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 rectangle using the given conversion flags flags, to convert it to a pixmap.
 
virtual void drawTextItem (const QPointF &p, const QTextItem &ti)
 This function draws the text item textItem at position p.
 
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.
 
- Public Member Functions inherited from QPaintEngine
 QPaintEngine (PaintEngineFeatures features=PaintEngineFeatures())
 Creates a paint engine with the featureset specified by caps.
 
virtual ~QPaintEngine ()
 Destroys the paint engine.
 
bool isActive () const
 Returns true if the paint engine is actively drawing; otherwise returns false.
 
void setActive (bool newState)
 Sets the active state of the paint engine to state.
 
virtual void drawRects (const QRect *rects, int rectCount)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.The default implementation converts the first rectCount rectangles in the buffer rects to a QRectF and calls the floating point version of this function.
 
virtual void drawLines (const QLine *lines, int lineCount)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.The default implementation converts the first lineCount lines in lines to a QLineF and calls the floating point version of this function.
 
virtual void drawEllipse (const QRect &r)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.The default implementation of this function calls the floating point version of this function.
 
virtual void drawPoints (const QPoint *points, int pointCount)
 Draws the first pointCount points in the buffer points.
 
virtual void drawPolygon (const QPoint *points, int pointCount, PolygonDrawMode mode)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Reimplement this virtual function to draw the polygon defined by the pointCount first points in points, using mode mode.
 
void setPaintDevice (QPaintDevice *device)
 
QPaintDevicepaintDevice () const
 Returns the device that this engine is painting on, if painting is active; otherwise returns \nullptr.
 
void setSystemClip (const QRegion &baseClip)
 
QRegion systemClip () const
 
void setSystemRect (const QRect &rect)
 
QRect systemRect () const
 
virtual QPoint coordinateOffset () const
 
void fix_neg_rect (int *x, int *y, int *w, int *h)
 
bool testDirty (DirtyFlags df)
 
void setDirty (DirtyFlags df)
 
void clearDirty (DirtyFlags df)
 
bool hasFeature (PaintEngineFeatures feature) const
 Returns true if the paint engine supports the specified feature; otherwise returns false.
 
QPainterpainter () const
 Returns the paint engine's painter.
 
void syncState ()
 
bool isExtended () const
 
virtual QPixmap createPixmap (QSize size)
 
virtual QPixmap createPixmapFromImage (QImage image, Qt::ImageConversionFlags flags=Qt::AutoColor)
 
- Public Member Functions inherited from QPrintEngine
virtual ~QPrintEngine ()
 Destroys the print engine.
 

Friends

class QCocoaNativeInterface
 

Additional Inherited Members

- Public Types inherited from QPaintEngine
enum  PaintEngineFeature {
  PrimitiveTransform = 0x00000001 , PatternTransform = 0x00000002 , PixmapTransform = 0x00000004 , PatternBrush = 0x00000008 ,
  LinearGradientFill = 0x00000010 , RadialGradientFill = 0x00000020 , ConicalGradientFill = 0x00000040 , AlphaBlend = 0x00000080 ,
  PorterDuff = 0x00000100 , PainterPaths = 0x00000200 , Antialiasing = 0x00000400 , BrushStroke = 0x00000800 ,
  ConstantOpacity = 0x00001000 , MaskedBrush = 0x00002000 , PerspectiveTransform = 0x00004000 , BlendModes = 0x00008000 ,
  ObjectBoundingModeGradients = 0x00010000 , RasterOpModes = 0x00020000 , PaintOutsidePaintEvent = 0x20000000 , AllFeatures = 0xffffffff
}
 This enum is used to describe the features or capabilities that the paint engine has. More...
 
enum  DirtyFlag {
  DirtyPen = 0x0001 , DirtyBrush = 0x0002 , DirtyBrushOrigin = 0x0004 , DirtyFont = 0x0008 ,
  DirtyBackground = 0x0010 , DirtyBackgroundMode = 0x0020 , DirtyTransform = 0x0040 , DirtyClipRegion = 0x0080 ,
  DirtyClipPath = 0x0100 , DirtyHints = 0x0200 , DirtyCompositionMode = 0x0400 , DirtyClipEnabled = 0x0800 ,
  DirtyOpacity = 0x1000 , AllDirty = 0xffff
}
 \value DirtyPen The pen is dirty and needs to be updated. More...
 
enum  PolygonDrawMode { OddEvenMode , WindingMode , ConvexMode , PolylineMode }
 \value OddEvenMode The polygon should be drawn using OddEven fill rule. More...
 
enum  Type {
  X11 , Windows , QuickDraw , CoreGraphics ,
  MacPrinter , QWindowSystem , OpenGL , Picture ,
  SVG , Raster , Direct3D , Pdf ,
  OpenVG , OpenGL2 , PaintBuffer , Blitter ,
  Direct2D , User = 50 , MaxUser = 100
}
 \value X11 \value Windows \value MacPrinter \value CoreGraphics \macos's Quartz2D (CoreGraphics) \value QuickDraw \macos's QuickDraw \value QWindowSystem Qt for Embedded Linux \value OpenGL \value Picture QPicture format \value SVG Scalable Vector Graphics XML format \value Raster \value Direct3D Windows only, Direct3D based engine \value Pdf Portable Document Format \value OpenVG \value User First user type ID \value MaxUser Last user type ID \value OpenGL2 \value PaintBuffer \value Blitter \value Direct2D Windows only, Direct2D based engine More...
 
- Public Types inherited from QPrintEngine
enum  PrintEnginePropertyKey {
  PPK_CollateCopies , PPK_ColorMode , PPK_Creator , PPK_DocumentName ,
  PPK_FullPage , PPK_NumberOfCopies , PPK_Orientation , PPK_OutputFileName ,
  PPK_PageOrder , PPK_PageRect , PPK_PageSize , PPK_PaperRect ,
  PPK_PaperSource , PPK_PrinterName , PPK_PrinterProgram , PPK_Resolution ,
  PPK_SelectionOption , PPK_SupportedResolutions , PPK_WindowsPageSize , PPK_FontEmbedding ,
  PPK_Duplex , PPK_PaperSources , PPK_CustomPaperSize , PPK_PageMargins ,
  PPK_CopyCount , PPK_SupportsMultipleCopies , PPK_PaperName , PPK_QPageSize ,
  PPK_QPageMargins , PPK_QPageLayout , PPK_PaperSize = PPK_PageSize , PPK_CustomBase = 0xff00
}
 This enum is used to communicate properties between the print engine and QPrinter. More...
 
- Protected Member Functions inherited from QPaintEngine
 QPaintEngine (QPaintEnginePrivate &data, PaintEngineFeatures devcaps=PaintEngineFeatures())
 
- Protected Attributes inherited from QPaintEngine
QPaintEngineStatestate
 
PaintEngineFeatures gccaps
 
uint active: 1
 
uint selfDestruct: 1
 
uint extended: 1
 
QScopedPointer< QPaintEnginePrivated_ptr
 

Detailed Description

Definition at line 37 of file qprintengine_mac_p.h.

Constructor & Destructor Documentation

◆ QMacPrintEngine()

QMacPrintEngine::QMacPrintEngine ( QPrinter::PrinterMode mode,
const QString & deviceId )

Definition at line 22 of file qprintengine_mac.mm.

References d, QCocoaPrinterSupport::defaultPrintDeviceId(), QPrintEngine::PPK_PrinterName, and setProperty.

+ Here is the call graph for this function:

Member Function Documentation

◆ abort()

bool QMacPrintEngine::abort ( )
virtual

Instructs the print engine to abort the printing process.

Returns true if successful; otherwise returns false.

Implements QPrintEngine.

Definition at line 141 of file qprintengine_mac.mm.

References QPrinter::Aborted, QPrinter::Active, d, end(), and ret.

Referenced by newPage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ begin()

bool QMacPrintEngine::begin ( QPaintDevice * pdev)
virtual

Reimplement this function to initialise your paint engine when painting is to start on the paint device pdev.

Return true if the initialization was successful; otherwise return false.

See also
end(), isActive()

Implements QPaintEngine.

Definition at line 37 of file qprintengine_mac.mm.

References QPrinter::Active, d, QPaintDevice::devType(), QPrinter::Error, QPrinter::Idle, QInternal::Printer, Q_ASSERT, Q_ASSERT_X, qWarning, QPaintEngine::setActive(), and QPaintEngine::state.

+ Here is the call graph for this function:

◆ drawEllipse()

void QMacPrintEngine::drawEllipse ( const QRectF & rect)
virtual

Reimplement this function to draw the largest ellipse that can be contained within rectangle rect.

The default implementation calls drawPolygon().

Reimplemented from QPaintEngine.

Definition at line 350 of file qprintengine_mac.mm.

References QPrinter::Active, d, and Q_ASSERT.

◆ drawImage()

void QMacPrintEngine::drawImage ( const QRectF & r,
const QImage & pm,
const QRectF & sr,
Qt::ImageConversionFlags flags )
virtual

Reimplement this function to draw the part of the image specified by the sr rectangle in the given rectangle using the given conversion flags flags, to convert it to a pixmap.

Reimplemented from QPaintEngine.

Definition at line 378 of file qprintengine_mac.mm.

References QPrinter::Active, d, and Q_ASSERT.

◆ drawLines()

void QMacPrintEngine::drawLines ( const QLineF * lines,
int lineCount )
virtual

The default implementation splits the list of lines in lines into lineCount separate calls to drawPath() or drawPolygon() depending on the feature set of the paint engine.

Reimplemented from QPaintEngine.

Definition at line 357 of file qprintengine_mac.mm.

References QPrinter::Active, d, and Q_ASSERT.

◆ drawPath()

void QMacPrintEngine::drawPath ( const QPainterPath & path)
virtual

The default implementation ignores the path and does nothing.

Reimplemented from QPaintEngine.

Definition at line 402 of file qprintengine_mac.mm.

References QPrinter::Active, d, and Q_ASSERT.

◆ drawPixmap()

void QMacPrintEngine::drawPixmap ( const QRectF & r,
const QPixmap & pm,
const QRectF & sr )
virtual

Reimplement this function to draw the part of the pm specified by the sr rectangle in the given r.

Implements QPaintEngine.

Definition at line 371 of file qprintengine_mac.mm.

References QPrinter::Active, d, and Q_ASSERT.

◆ drawPoints()

void QMacPrintEngine::drawPoints ( const QPointF * points,
int pointCount )
virtual

Draws the first pointCount points in the buffer points.

Reimplemented from QPaintEngine.

Definition at line 343 of file qprintengine_mac.mm.

References QPrinter::Active, d, and Q_ASSERT.

◆ drawPolygon()

void QMacPrintEngine::drawPolygon ( const QPointF * points,
int pointCount,
PolygonDrawMode mode )
virtual

Reimplement this virtual function to draw the polygon defined by the pointCount first points in points, using mode mode.

Note
At least one of the drawPolygon() functions must be reimplemented.

Reimplemented from QPaintEngine.

Definition at line 364 of file qprintengine_mac.mm.

References QPrinter::Active, d, and Q_ASSERT.

◆ drawRects()

void QMacPrintEngine::drawRects ( const QRectF * rects,
int rectCount )
virtual

Draws the first rectCount rectangles in the buffer rects.

The default implementation of this function calls drawPath() or drawPolygon() depending on the feature set of the paint engine.

Reimplemented from QPaintEngine.

Definition at line 336 of file qprintengine_mac.mm.

References QPrinter::Active, d, and Q_ASSERT.

◆ drawTextItem()

void QMacPrintEngine::drawTextItem ( const QPointF & p,
const QTextItem & textItem )
virtual

This function draws the text item textItem at position p.

The default implementation of this function converts the text to a QPainterPath and paints the resulting path.

Reimplemented from QPaintEngine.

Definition at line 385 of file qprintengine_mac.mm.

References QPrinter::Active, d, QPaintEngine::drawTextItem(), and Q_ASSERT.

+ Here is the call graph for this function:

◆ drawTiledPixmap()

void QMacPrintEngine::drawTiledPixmap ( const QRectF & rect,
const QPixmap & pixmap,
const QPointF & p )
virtual

Reimplement this function to draw the pixmap in the given rect, starting at the given p.

The pixmap will be drawn repeatedly until the rect is filled.

Reimplemented from QPaintEngine.

Definition at line 395 of file qprintengine_mac.mm.

References QPrinter::Active, d, pixmap, and Q_ASSERT.

◆ end()

bool QMacPrintEngine::end ( )
virtual

Reimplement this function to finish painting on the current paint device.

Return true if painting was finished successfully; otherwise return false.

See also
begin(), isActive()

Implements QPaintEngine.

Definition at line 82 of file qprintengine_mac.mm.

References QPrinter::Aborted, QPaintEngine::CoreGraphics, d, QCoreGraphicsPaintEngine::end(), and QPrinter::Idle.

Referenced by abort().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handle()

Qt::HANDLE QMacPrintEngine::handle ( ) const

Definition at line 105 of file qprintengine_mac.mm.

References paintEngine().

+ Here is the call graph for this function:

◆ metric()

int QMacPrintEngine::metric ( QPaintDevice::PaintDeviceMetric id) const
virtual

Returns the metric for the given id.

Implements QPrintEngine.

Definition at line 151 of file qprintengine_mac.mm.

References d, QPaintDevice::devicePixelRatioFScale(), metric(), QPageLayout::Millimeter, QPaintDevice::PdmDepth, QPaintDevice::PdmDevicePixelRatio, QPaintDevice::PdmDevicePixelRatioScaled, QPaintDevice::PdmDpiX, QPaintDevice::PdmDpiY, QPaintDevice::PdmHeight, QPaintDevice::PdmHeightMM, QPaintDevice::PdmNumColors, QPaintDevice::PdmPhysicalDpiX, QPaintDevice::PdmPhysicalDpiY, QPaintDevice::PdmWidth, QPaintDevice::PdmWidthMM, Q_FALLTHROUGH, qRound(), and qWarning.

Referenced by metric().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ newPage()

bool QMacPrintEngine::newPage ( )
virtual

Instructs the print engine to start a new page.

Returns true if the printer was able to create the new page; otherwise returns false.

Implements QPrintEngine.

Definition at line 122 of file qprintengine_mac.mm.

References abort(), QPrinter::Active, d, QPrinter::Error, Q_ASSERT, and qWarning.

+ Here is the call graph for this function:

◆ paintEngine()

QPaintEngine * QMacPrintEngine::paintEngine ( ) const

Definition at line 100 of file qprintengine_mac.mm.

Referenced by handle().

+ Here is the caller graph for this function:

◆ printerState()

QPrinter::PrinterState QMacPrintEngine::printerState ( ) const
virtual

Returns the current state of the printer being used by the print engine.

Implements QPrintEngine.

Definition at line 117 of file qprintengine_mac.mm.

References QPaintEngine::state.

◆ printInfo()

NSPrintInfo * QMacPrintEngine::printInfo ( )

Definition at line 760 of file qprintengine_mac.mm.

References d, and QPrinter::Idle.

◆ property()

QVariant QMacPrintEngine::property ( PrintEnginePropertyKey key) const
virtual

Returns the print engine's property specified by key.

See also
setProperty()

Implements QPrintEngine.

Definition at line 607 of file qprintengine_mac.mm.

References QPrinter::Auto, QMarginsF::bottom(), QPrinter::Color, d, QPrinter::DuplexLongSide, QPrinter::DuplexNone, QPrinter::DuplexShortSide, QPrinter::FirstPageFirst, QPageLayout::FullPageMode, QMarginsF::left(), list, out, QPageLayout::Point, QPrintEngine::PPK_CollateCopies, QPrintEngine::PPK_ColorMode, QPrintEngine::PPK_CopyCount, QPrintEngine::PPK_Creator, QPrintEngine::PPK_CustomBase, QPrintEngine::PPK_CustomPaperSize, QPrintEngine::PPK_DocumentName, QPrintEngine::PPK_Duplex, QPrintEngine::PPK_FontEmbedding, QPrintEngine::PPK_FullPage, QPrintEngine::PPK_NumberOfCopies, QPrintEngine::PPK_Orientation, QPrintEngine::PPK_OutputFileName, QPrintEngine::PPK_PageMargins, QPrintEngine::PPK_PageOrder, QPrintEngine::PPK_PageRect, QPrintEngine::PPK_PageSize, QPrintEngine::PPK_PaperName, QPrintEngine::PPK_PaperRect, QPrintEngine::PPK_PaperSource, QPrintEngine::PPK_PaperSources, QPrintEngine::PPK_PrinterName, QPrintEngine::PPK_PrinterProgram, QPrintEngine::PPK_QPageLayout, QPrintEngine::PPK_QPageMargins, QPrintEngine::PPK_QPageSize, QPrintEngine::PPK_Resolution, QPrintEngine::PPK_SelectionOption, QPrintEngine::PPK_SupportedResolutions, QPrintEngine::PPK_SupportsMultipleCopies, QPrintEngine::PPK_WindowsPageSize, qMakePair(), ret, QMarginsF::right(), QList< T >::size(), and QMarginsF::top().

+ Here is the call graph for this function:

◆ setProperty()

void QMacPrintEngine::setProperty ( PrintEnginePropertyKey key,
const QVariant & value )
virtual

Sets the print engine's property specified by key to the given value.

See also
property()

Implements QPrintEngine.

Definition at line 410 of file qprintengine_mac.mm.

References QPageLayout::Clamp, contains(), d, QCocoaPrinterSupport::defaultPrintDeviceId(), QPrint::DuplexAuto, QPrint::DuplexLongSide, QPrint::DuplexNone, QPrint::DuplexShortSide, QVariant::fromValue(), QPageLayout::FullPageMode, QPageSize::id(), QPageLayout::isValid(), QPageLayout::Landscape, QPageLayout::margins(), QPageLayout::mode(), QPageLayout::orientation(), QPageLayout::pageSize(), QPageSize::Point, QPageLayout::Portrait, QPrintEngine::PPK_CollateCopies, QPrintEngine::PPK_ColorMode, QPrintEngine::PPK_CopyCount, QPrintEngine::PPK_Creator, QPrintEngine::PPK_CustomBase, QPrintEngine::PPK_CustomPaperSize, QPrintEngine::PPK_DocumentName, QPrintEngine::PPK_Duplex, QPrintEngine::PPK_FontEmbedding, QPrintEngine::PPK_FullPage, QPrintEngine::PPK_NumberOfCopies, QPrintEngine::PPK_Orientation, QPrintEngine::PPK_OutputFileName, QPrintEngine::PPK_PageMargins, QPrintEngine::PPK_PageOrder, QPrintEngine::PPK_PageRect, QPrintEngine::PPK_PageSize, QPrintEngine::PPK_PaperName, QPrintEngine::PPK_PaperRect, QPrintEngine::PPK_PaperSource, QPrintEngine::PPK_PaperSources, QPrintEngine::PPK_PrinterName, QPrintEngine::PPK_PrinterProgram, QPrintEngine::PPK_QPageLayout, QPrintEngine::PPK_QPageMargins, QPrintEngine::PPK_QPageSize, QPrintEngine::PPK_Resolution, QPrintEngine::PPK_SelectionOption, QPrintEngine::PPK_SupportedResolutions, QPrintEngine::PPK_SupportsMultipleCopies, QPrintEngine::PPK_WindowsPageSize, property, Q_ASSERT, qAbs(), setProperty, QPageSize::size(), QPageLayout::StandardMode, toInt(), QPageLayout::units(), and QVariant::value().

+ Here is the call graph for this function:

◆ type()

virtual QPaintEngine::Type QMacPrintEngine::type ( ) const
inlinevirtual

Reimplement this function to return the paint engine \l{Type}.

Implements QPaintEngine.

Definition at line 47 of file qprintengine_mac_p.h.

References QPaintEngine::MacPrinter.

◆ updateState()

void QMacPrintEngine::updateState ( const QPaintEngineState & state)
virtual

Reimplement this function to update the state of a paint engine.

When implemented, this function is responsible for checking the paint engine's current state and update the properties that are changed. Use the QPaintEngineState::state() function to find out which properties that must be updated, then use the corresponding \l {GetFunction}{get function} to retrieve the current values for the given properties.

See also
QPaintEngineState

Implements QPaintEngine.

Definition at line 331 of file qprintengine_mac.mm.

References QPaintEngine::state.

Friends And Related Symbol Documentation

◆ QCocoaNativeInterface

friend class QCocoaNativeInterface
friend

Definition at line 78 of file qprintengine_mac_p.h.


The documentation for this class was generated from the following files: