Qt 4.8
Public Functions | List of all members
QPSPrintEngine Class Reference

#include <qprintengine_ps_p.h>

Inheritance diagram for QPSPrintEngine:
QPdfBaseEngine QAlphaPaintEngine QPrintEngine QPaintEngine

Public Functions

virtual bool abort ()
 Instructs the print engine to abort the printing process. More...
 
virtual bool begin (QPaintDevice *pdev)
 Reimplement this function to initialise your paint engine when painting is to start on the paint device pdev. More...
 
virtual void drawImage (const QRectF &r, const QImage &img, const QRectF &sr, Qt::ImageConversionFlags)
 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. More...
 
virtual void drawImageInternal (const QRectF &r, QImage img, bool bitmap)
 
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. More...
 
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. More...
 
virtual bool end ()
 Reimplement this function to finish painting on the current paint device. More...
 
virtual Qt::HANDLE handle () const
 
virtual bool newPage ()
 Instructs the print engine to start a new page. More...
 
virtual QPrinter::PrinterState printerState () const
 Returns the current state of the printer being used by the print engine. More...
 
 QPSPrintEngine (QPrinter::PrinterMode m)
 
void setBrush ()
 
virtual QPaintEngine::Type type () const
 Reimplement this function to return the paint engine Type. More...
 
 ~QPSPrintEngine ()
 
- Public Functions inherited from QPdfBaseEngine
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. More...
 
void drawPath (const QPainterPath &path)
 The default implementation ignores the path and does nothing. More...
 
void drawPoints (const QPointF *points, int pointCount)
 Draws the first pointCount points in the buffer points. More...
 
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. More...
 
void drawRects (const QRectF *rects, int rectCount)
 Draws the first rectCount rectangles in the buffer rects. More...
 
void drawTextItem (const QPointF &p, const QTextItem &textItem)
 This function draws the text item textItem at position p. More...
 
int metric (QPaintDevice::PaintDeviceMetric metricType) const
 Returns the metric for the given id. More...
 
QVariant property (PrintEnginePropertyKey key) const
 Returns the print engine's property specified by key. More...
 
 QPdfBaseEngine (QPdfBaseEnginePrivate &d, PaintEngineFeatures f)
 
void setPen ()
 
void setProperty (PrintEnginePropertyKey key, const QVariant &value)
 Sets the print engine's property specified by key to the given value. More...
 
void setupGraphicsState (QPaintEngine::DirtyFlags flags)
 
void updateState (const QPaintEngineState &state)
 Reimplement this function to update the state of a paint engine. More...
 
 ~QPdfBaseEngine ()
 
- Public Functions inherited from QAlphaPaintEngine
virtual void drawImage (const QRectF &r, const QImage &image, const QRectF &sr)
 
 ~QAlphaPaintEngine ()
 
- Public Functions inherited from QPaintEngine
void clearDirty (DirtyFlags df)
 
virtual QPoint coordinateOffset () const
 Returns the offset from the painters origo to the engines origo. More...
 
virtual void drawEllipse (const QRectF &r)
 Reimplement this function to draw the largest ellipse that can be contained within rectangle rect. More...
 
virtual void drawEllipse (const QRect &r)
 The default implementation of this function calls the floating point version of this function. More...
 
virtual void drawLines (const QLine *lines, int lineCount)
 The default implementation converts the first lineCount lines in lines to a QLineF and calls the floating point version of this function. More...
 
virtual void drawPoints (const QPoint *points, int pointCount)
 Draws the first pointCount points in the buffer points. More...
 
virtual void drawPolygon (const QPoint *points, int pointCount, PolygonDrawMode mode)
 Reimplement this virtual function to draw the polygon defined by the pointCount first points in points, using mode mode. More...
 
virtual void drawRects (const QRect *rects, int rectCount)
 The default implementation converts the first rectCount rectangles in the buffer rects to a QRectF and calls the floating point version of this function. More...
 
void fix_neg_rect (int *x, int *y, int *w, int *h)
 
virtual HDC getDC () const
 Empty default implementation. More...
 
bool hasFeature (PaintEngineFeatures feature) const
 Returns true if the paint engine supports the specified feature; otherwise returns false. More...
 
bool isActive () const
 Returns true if the paint engine is actively drawing; otherwise returns false. More...
 
bool isExtended () const
 Returns true if the paint engine is a QPaintEngineEx derivative. More...
 
QPaintDevicepaintDevice () const
 Returns the device that this engine is painting on, if painting is active; otherwise returns 0. More...
 
QPainterpainter () const
 Returns the paint engine's painter. More...
 
 QPaintEngine (PaintEngineFeatures features=0)
 Creates a paint engine with the featureset specified by caps. More...
 
virtual void releaseDC (HDC hdc) const
 Empty default implementation. More...
 
void setActive (bool newState)
 Sets the active state of the paint engine to state. More...
 
void setDirty (DirtyFlags df)
 
void setPaintDevice (QPaintDevice *device)
 
void setSystemClip (const QRegion &baseClip)
 Sets the system clip for this engine. More...
 
void setSystemRect (const QRect &rect)
 Sets the target rect for drawing within the backing store. More...
 
void syncState ()
 Updates all dirty states in this engine. More...
 
QRegion systemClip () const
 Returns the system clip. More...
 
QRect systemRect () const
 Retrieves the rect for drawing within the backing store. More...
 
bool testDirty (DirtyFlags df)
 
virtual ~QPaintEngine ()
 Destroys the paint engine. More...
 
- Public Functions inherited from QPrintEngine
virtual HDC getPrinterDC () const
 
virtual void releasePrinterDC (HDC) const
 
virtual ~QPrintEngine ()
 Destroys the print engine. More...
 

Additional Inherited Members

- Public Types inherited from QPaintEngine
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
}
 QPaintEngine::updateState(). More...
 
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  PolygonDrawMode { OddEvenMode, WindingMode, ConvexMode, PolylineMode }
 
enum  Type {
  X11, Windows, QuickDraw, CoreGraphics,
  MacPrinter, QWindowSystem, PostScript, OpenGL,
  Picture, SVG, Raster, Direct3D,
  Pdf, OpenVG, OpenGL2, PaintBuffer,
  Blitter, User = 50, MaxUser = 100
}
 
- 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_SuppressSystemPrintStatus, PPK_Duplex, PPK_PaperSources, PPK_CustomPaperSize,
  PPK_PageMargins, PPK_CopyCount, PPK_SupportsMultipleCopies, PPK_PaperSize = PPK_PageSize,
  PPK_CustomBase = 0xff00
}
 This enum is used to communicate properties between the print engine and QPrinter. More...
 
- Protected Functions inherited from QAlphaPaintEngine
QRegion alphaClipping () const
 
void cleanUp ()
 
bool continueCall () const
 
void flushAndInit (bool init=true)
 
 QAlphaPaintEngine (QAlphaPaintEnginePrivate &data, PaintEngineFeatures devcaps=0)
 
- Protected Functions inherited from QPaintEngine
 QPaintEngine (QPaintEnginePrivate &data, PaintEngineFeatures devcaps=0)
 
- Protected Variables inherited from QPaintEngine
uint active: 1
 
QScopedPointer< QPaintEnginePrivated_ptr
 
uint extended: 1
 
PaintEngineFeatures gccaps
 
uint selfDestruct: 1
 
QPaintEngineStatestate
 

Detailed Description

Definition at line 71 of file qprintengine_ps_p.h.

Constructors and Destructors

◆ QPSPrintEngine()

QPSPrintEngine::QPSPrintEngine ( QPrinter::PrinterMode  m)
explicit

◆ ~QPSPrintEngine()

QPSPrintEngine::~QPSPrintEngine ( )

Definition at line 716 of file qprintengine_ps.cpp.

717 {
719  if (d->fd >= 0)
720 #if defined(Q_OS_WIN) && defined(_MSC_VER) && _MSC_VER >= 1400
721  ::_close(d->fd);
722 #else
723  ::close(d->fd);
724 #endif
725 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

Functions

◆ abort()

bool QPSPrintEngine::abort ( )
virtual

Instructs the print engine to abort the printing process.

Returns true if successful; otherwise returns false.

Implements QPrintEngine.

Definition at line 958 of file qprintengine_ps.cpp.

Referenced by type().

959 {
960  // ### abort!?!
961  return false;
962 }

◆ begin()

bool QPSPrintEngine::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()

Reimplemented from QPdfBaseEngine.

Definition at line 727 of file qprintengine_ps.cpp.

728 {
730 
731  if (d->fd >= 0)
732  return true;
733 
734  if (d->useAlphaEngine) {
736  if (!continueCall())
737  return true;
738  }
739 
740  if(!QPdfBaseEngine::begin(pdev)) {
741  d->printerState = QPrinter::Error;
742  return false;
743  }
744 
745  d->pageCount = 1; // initialize state
746 
747  d->pen = QPen(Qt::black);
748  d->brush = Qt::NoBrush;
749  d->hasPen = true;
750  d->hasBrush = false;
751  d->clipEnabled = false;
752  d->allClipped = false;
753  d->boundingBox = QRect();
754  d->fontsUsed = "";
755  d->hugeDocument = false;
756  d->simplePen = false;
757 
758  setActive(true);
759  d->printerState = QPrinter::Active;
760 
761  newPage();
762 
763  return true;
764 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QPen class defines how a QPainter should draw lines and outlines of shapes.
Definition: qpen.h:64
bool begin(QPaintDevice *pdev)
Reimplement this function to initialise your paint engine when painting is to start on the paint devi...
Definition: qpdf.cpp:1617
void setActive(bool newState)
Sets the active state of the paint engine to state.
Definition: qpaintengine.h:155
virtual bool begin(QPaintDevice *pdev)
Reimplement this function to initialise your paint engine when painting is to start on the paint devi...
virtual bool newPage()
Instructs the print engine to start a new page.
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58

◆ drawImage()

void QPSPrintEngine::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 871 of file qprintengine_ps.cpp.

873 {
875 
876  if (d->useAlphaEngine) {
877  QAlphaPaintEngine::drawImage(r, img, sr);
878  if (!continueCall())
879  return;
880  }
881  QImage image = img.copy(sr.toRect());
882  drawImageInternal(r, image, false);
883 }
double d
Definition: qnumeric_p.h:62
QImage copy(const QRect &rect=QRect()) const
Returns a sub-area of the image as a new image.
Definition: qimage.cpp:1410
#define Q_D(Class)
Definition: qglobal.h:2482
virtual void drawImage(const QRectF &r, const QImage &image, const QRectF &sr)
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
QRect toRect() const
Returns a QRect based on the values of this rectangle.
Definition: qrect.h:845
virtual void drawImageInternal(const QRectF &r, QImage img, bool bitmap)

◆ drawImageInternal()

void QPSPrintEngine::drawImageInternal ( const QRectF r,
QImage  img,
bool  bitmap 
)
virtual

Definition at line 833 of file qprintengine_ps.cpp.

Referenced by drawImage(), and drawPixmap().

834 {
836  if (d->clipEnabled && d->allClipped)
837  return;
838  if (bitmap && image.depth() != 1)
839  bitmap = false;
840  QImage mask;
841  // the below is not necessary since it's handled by the alpha
842  // engine
843  if (!d->useAlphaEngine && !bitmap) {
844  if (image.format() == QImage::Format_Mono || image.format() == QImage::Format_MonoLSB)
846  if (image.hasAlphaChannel()) {
847  // get better alpha dithering
848  int xscale = image.width();
849  xscale *= xscale <= 800 ? 4 : (xscale <= 1600 ? 2 : 1);
850  int yscale = image.height();
851  yscale *= yscale <= 800 ? 4 : (yscale <= 1600 ? 2 : 1);
852  image = image.scaled(xscale, yscale);
854  }
855  }
856  *d->currentPage << "q\n";
857  if(!d->simplePen)
858  *d->currentPage << QPdf::generateMatrix(d->stroker.matrix);
859  QBrush b = d->brush;
860  if (image.depth() == 1) {
861  // set current pen as brush
862  d->brush = d->pen.brush();
863  setBrush();
864  }
865  d->drawImage(r.x(), r.y(), r.width(), r.height(), image, mask);
866  *d->currentPage << "Q\n";
867  d->brush = b;
868 }
double d
Definition: qnumeric_p.h:62
qreal y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:667
QByteArray generateMatrix(const QTransform &matrix)
Definition: qpdf.cpp:334
#define Q_D(Class)
Definition: qglobal.h:2482
qreal height() const
Returns the height of the rectangle.
Definition: qrect.h:710
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
QImage createAlphaMask(Qt::ImageConversionFlags flags=Qt::AutoColor) const
Builds and returns a 1-bpp mask from the alpha buffer in this image.
Definition: qimage.cpp:4720
qreal width() const
Returns the width of the rectangle.
Definition: qrect.h:707
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
int width() const
Returns the width of the image.
Definition: qimage.cpp:1557
QImage convertToFormat(Format f, Qt::ImageConversionFlags flags=Qt::AutoColor) const Q_REQUIRED_RESULT
Returns a copy of the image in the given format.
Definition: qimage.cpp:3966
qreal x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:664

◆ drawPixmap()

void QPSPrintEngine::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.

Reimplemented from QAlphaPaintEngine.

Definition at line 885 of file qprintengine_ps.cpp.

886 {
888 
889  if (d->useAlphaEngine) {
891  if (!continueCall())
892  return;
893  }
894 
895  QImage img = pm.copy(sr.toRect()).toImage();
896  drawImageInternal(r, img, true);
897 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
QRect toRect() const
Returns a QRect based on the values of this rectangle.
Definition: qrect.h:845
virtual void drawImageInternal(const QRectF &r, QImage img, bool bitmap)
QPixmap copy(int x, int y, int width, int height) const
Returns a deep copy of the subset of the pixmap that is specified by the rectangle QRect( x...
Definition: qpixmap.h:302
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...

◆ drawTiledPixmap()

void QPSPrintEngine::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 QAlphaPaintEngine.

Definition at line 899 of file qprintengine_ps.cpp.

900 {
902 
903  if (d->useAlphaEngine) {
905  if (!continueCall())
906  return;
907  }
908 
909  if (d->clipEnabled && d->allClipped)
910  return;
911  // ### Optimize implementation!
912  qreal yPos = r.y();
913  qreal yOff = p.y();
914  while(yPos < r.y() + r.height()) {
915  qreal drawH = pixmap.height() - yOff; // Cropping first row
916  if (yPos + drawH > r.y() + r.height()) // Cropping last row
917  drawH = r.y() + r.height() - yPos;
918  qreal xPos = r.x();
919  qreal xOff = p.x();
920  while(xPos < r.x() + r.width()) {
921  qreal drawW = pixmap.width() - xOff; // Cropping first column
922  if (xPos + drawW > r.x() + r.width()) // Cropping last column
923  drawW = r.x() + r.width() - xPos;
924  // ########
925  painter()->drawPixmap(QPointF(xPos, yPos).toPoint(), pixmap,
926  QRectF(xOff, yOff, drawW, drawH).toRect());
927  xPos += drawW;
928  xOff = 0;
929  }
930  yPos += drawH;
931  yOff = 0;
932  }
933 
934 }
double d
Definition: qnumeric_p.h:62
double qreal
Definition: qglobal.h:1193
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...
int width() const
Returns the width of the pixmap.
Definition: qpixmap.cpp:630
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
#define Q_D(Class)
Definition: qglobal.h:2482
qreal x() const
Returns the x-coordinate of this point.
Definition: qpoint.h:282
QPainter * painter() const
Returns the paint engine&#39;s painter.
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
qreal y() const
Returns the y-coordinate of this point.
Definition: qpoint.h:287
void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect)
Draws the rectangular portion source of the given pixmap into the given target in the paint device...
Definition: qpainter.cpp:5619
int height() const
Returns the height of the pixmap.
Definition: qpixmap.cpp:645

◆ end()

bool QPSPrintEngine::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()

Reimplemented from QPdfBaseEngine.

Definition at line 766 of file qprintengine_ps.cpp.

767 {
769 
770  if (d->useAlphaEngine) {
772  if (!continueCall())
773  return true;
774  }
775 
776  // we're writing to lp/lpr through a pipe, we don't want to crash with SIGPIPE
777  // if lp/lpr dies
778  ignoreSigPipe(true);
779  d->flushPage(true);
780  QByteArray trailer;
781  QPdf::ByteStream s(&trailer);
782  s << "%%Trailer\n"
783  "%%Pages: " << d->pageCount - 1 << '\n' <<
784  wrapDSC("%%DocumentFonts: " + d->fontsUsed);
785  s << "%%EOF\n";
786  d->outDevice->write(trailer);
787 
789  ignoreSigPipe(false);
790 
791  d->firstPage = true;
792  d->headerDone = false;
793 
794  setActive(false);
795  d->printerState = QPrinter::Idle;
796  d->pdev = 0;
797 
798  return true;
799 }
double d
Definition: qnumeric_p.h:62
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
static QByteArray wrapDSC(const QByteArray &str)
static void ignoreSigPipe(bool b)
virtual bool end()
Reimplement this function to finish painting on the current paint device.
#define Q_D(Class)
Definition: qglobal.h:2482
bool end()
Reimplement this function to finish painting on the current paint device.
Definition: qpdf.cpp:1632
void setActive(bool newState)
Sets the active state of the paint engine to state.
Definition: qpaintengine.h:155

◆ handle()

virtual Qt::HANDLE QPSPrintEngine::handle ( ) const
inlinevirtual

Definition at line 98 of file qprintengine_ps_p.h.

98 { return 0; }

◆ newPage()

bool QPSPrintEngine::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.

Reimplemented from QPdfBaseEngine.

Definition at line 936 of file qprintengine_ps.cpp.

Referenced by begin(), and type().

937 {
939 
940  if (!d->firstPage && d->useAlphaEngine)
941  flushAndInit();
942 
943  // we're writing to lp/lpr through a pipe, we don't want to crash with SIGPIPE
944  // if lp/lpr dies
945  ignoreSigPipe(true);
946  if (!d->firstPage)
947  d->flushPage();
948  d->firstPage = false;
949  ignoreSigPipe(false);
950 
951  delete d->currentPage;
952  d->currentPage = new QPdfPage;
953  d->stroker.stream = d->currentPage;
954 
955  return QPdfBaseEngine::newPage();
956 }
double d
Definition: qnumeric_p.h:62
static void ignoreSigPipe(bool b)
#define Q_D(Class)
Definition: qglobal.h:2482
bool newPage()
Instructs the print engine to start a new page.
Definition: qpdf.cpp:1340
void flushAndInit(bool init=true)

◆ printerState()

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

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

Implements QPrintEngine.

Definition at line 964 of file qprintengine_ps.cpp.

Referenced by type().

965 {
966  Q_D(const QPSPrintEngine);
967  return d->printerState;
968 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ setBrush()

void QPSPrintEngine::setBrush ( )
virtual

Implements QPdfBaseEngine.

Definition at line 801 of file qprintengine_ps.cpp.

Referenced by drawImageInternal().

802 {
804 #if 0
805  bool specifyColor;
806  int gStateObject = 0;
807  int patternObject = d->addBrushPattern(brush, d->stroker.matrix, brushOrigin, &specifyColor, &gStateObject);
808 
809  *d->currentPage << (patternObject ? "/PCSp cs " : "/CSp cs ");
810  if (specifyColor) {
811  QColor rgba = brush.color();
812  *d->currentPage << rgba.redF()
813  << rgba.greenF()
814  << rgba.blueF();
815  }
816  if (patternObject)
817  *d->currentPage << "/Pat" << patternObject;
818  *d->currentPage << "scn\n";
819 #endif
820  QColor rgba = d->brush.color();
821  if (d->colorMode == QPrinter::GrayScale) {
822  qreal gray = qGray(rgba.rgba())/255.;
823  *d->currentPage << gray << gray << gray;
824  } else {
825  *d->currentPage << rgba.redF()
826  << rgba.greenF()
827  << rgba.blueF();
828  }
829  *d->currentPage << "scn\n"
830  << "/BSt " << d->brush.style() << "def\n";
831 }
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
double d
Definition: qnumeric_p.h:62
double qreal
Definition: qglobal.h:1193
qreal greenF() const
Returns the green color component of this color.
Definition: qcolor.cpp:1241
#define Q_D(Class)
Definition: qglobal.h:2482
Q_GUI_EXPORT_INLINE int qGray(int r, int g, int b)
Definition: qrgb.h:75
qreal redF() const
Returns the red color component of this color.
Definition: qcolor.cpp:1213
qreal blueF() const
Returns the blue color component of this color.
Definition: qcolor.cpp:1269
QRgb rgba() const
Returns the RGB value of the color, including its alpha.
Definition: qcolor.cpp:1019

◆ type()

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

Reimplement this function to return the paint engine Type.

Implements QPaintEngine.

Definition at line 91 of file qprintengine_ps_p.h.


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