QPdfBaseEngine Class Reference

#include <qpdf_p.h>

Inheritance diagram for QPdfBaseEngine:

Inheritance graph
[legend]
Collaboration diagram for QPdfBaseEngine:

Collaboration graph
[legend]
List of all members.

Detailed Description

Definition at line 138 of file qpdf_p.h.

Public Member Functions

 QPdfBaseEngine (QPdfBaseEnginePrivate &d, PaintEngineFeatures f)
 ~QPdfBaseEngine ()
bool begin (QPaintDevice *pdev)
bool end ()
void drawPoints (const QPointF *points, int pointCount)
void drawLines (const QLineF *lines, int lineCount)
void drawRects (const QRectF *rects, int rectCount)
void drawPolygon (const QPointF *points, int pointCount, PolygonDrawMode mode)
void drawPath (const QPainterPath &path)
void drawTextItem (const QPointF &p, const QTextItem &textItem)
void updateState (const QPaintEngineState &state)
int metric (QPaintDevice::PaintDeviceMetric metricType) const
bool newPage ()
void setProperty (PrintEnginePropertyKey key, const QVariant &value)
QVariant property (PrintEnginePropertyKey key) const
void setPen ()
virtual void setBrush ()=0
void setupGraphicsState (QPaintEngine::DirtyFlags flags)

Private Member Functions

void updateClipPath (const QPainterPath &path, Qt::ClipOperation op)


Constructor & Destructor Documentation

QPdfBaseEngine::QPdfBaseEngine ( QPdfBaseEnginePrivate d,
PaintEngineFeatures  f 
)

Definition at line 797 of file qpdf.cpp.

00798     : QPaintEngine(d, f)
00799 {
00800 }

QPdfBaseEngine::~QPdfBaseEngine (  )  [inline]

Definition at line 143 of file qpdf_p.h.

00143 {}


Member Function Documentation

bool QPdfBaseEngine::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 1331 of file qpdf.cpp.

References d.

Referenced by QPdfEngine::begin(), and QPSPrintEngine::begin().

01332 {
01333     Q_D(QPdfBaseEngine);
01334     d->pdev = pdev;
01335 
01336     d->postscript = false;
01337     d->currentObject = 1;
01338 
01339     d->currentPage = new QPdfPage;
01340     d->stroker.stream = d->currentPage;
01341 
01342     return d->openPrintDevice();
01343 }

bool QPdfBaseEngine::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 1345 of file qpdf.cpp.

References d, and qDeleteAll().

Referenced by QPSPrintEngine::end(), and QPdfEngine::end().

01346 {
01347     Q_D(QPdfBaseEngine);
01348     qDeleteAll(d->fonts);
01349     d->fonts.clear();
01350     delete d->currentPage;
01351     d->currentPage = 0;
01352 
01353     d->closePrintDevice();
01354     return true;
01355 }

Here is the call graph for this function:

void QPdfBaseEngine::drawPoints ( const QPointF points,
int  pointCount 
) [virtual]

Draws the first pointCount points in the buffer points

Reimplemented from QPaintEngine.

Definition at line 802 of file qpdf.cpp.

References d, drawPath(), and p.

00803 {
00804     Q_D(QPdfBaseEngine);
00805     if (!points || !d->hasPen)
00806         return;
00807 
00808     QPainterPath p;
00809     for (int i=0; i!=pointCount;++i) {
00810         p.moveTo(points[i]);
00811         p.lineTo(points[i] + QPointF(0, 0.001));
00812     }
00813     drawPath(p);
00814 }

Here is the call graph for this function:

void QPdfBaseEngine::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 816 of file qpdf.cpp.

References drawPath(), p, and QLineF::p1().

00817 {
00818     if (!lines)
00819         return;
00820 
00821     QPainterPath p;
00822     for (int i=0; i!=lineCount;++i) {
00823         p.moveTo(lines[i].p1());
00824         p.lineTo(lines[i].p2());
00825     }
00826     drawPath(p);
00827 }

Here is the call graph for this function:

void QPdfBaseEngine::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 829 of file qpdf.cpp.

References d, drawPath(), QPdf::generateMatrix(), QRectF::height(), p, QRectF::width(), QRectF::x(), and QRectF::y().

Referenced by QPdfEngine::drawTiledPixmap().

00830 {
00831     if (!rects)
00832         return;
00833 
00834     Q_D(QPdfBaseEngine);
00835     if (d->clipEnabled && d->allClipped)
00836         return;
00837     if (!d->hasPen && !d->hasBrush)
00838         return;
00839 
00840     QBrush penBrush = d->pen.brush();
00841     if (d->simplePen || !d->hasPen) {
00842         // draw strokes natively in this case for better output
00843         if(!d->simplePen && !d->stroker.matrix.isIdentity())
00844             *d->currentPage << "q\n" << QPdf::generateMatrix(d->stroker.matrix);
00845         for (int i = 0; i < rectCount; ++i)
00846             *d->currentPage << rects[i].x() << rects[i].y() << rects[i].width() << rects[i].height() << "re\n";
00847         *d->currentPage << (d->hasPen ? (d->hasBrush ? "B\n" : "S\n") : "f\n");
00848         if(!d->simplePen && !d->stroker.matrix.isIdentity())
00849             *d->currentPage << "Q\n";
00850     } else {
00851         QPainterPath p;
00852         for (int i=0; i!=rectCount; ++i)
00853             p.addRect(rects[i]);
00854         drawPath(p);
00855     }
00856 }

Here is the call graph for this function:

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

The default implementation of this function will try to use drawPath if the engine supports the feature QPaintEngine::PainterPaths or try the float based drawPolygon() implementation if not.

Reimplemented from QPaintEngine.

Definition at line 858 of file qpdf.cpp.

References QPaintEngine::ConvexMode, d, drawPath(), Qt::OddEvenFill, QPaintEngine::OddEvenMode, p, QPaintEngine::PolylineMode, Qt::WindingFill, and QPaintEngine::WindingMode.

00859 {
00860     if (!points || !pointCount)
00861         return;
00862     Q_D(QPdfBaseEngine);
00863 
00864     bool hb = d->hasBrush;
00865     QPainterPath p;
00866 
00867     switch(mode) {
00868     case OddEvenMode:
00869         p.setFillRule(Qt::OddEvenFill);
00870         break;
00871     case ConvexMode:
00872     case WindingMode:
00873         p.setFillRule(Qt::WindingFill);
00874         break;
00875     case PolylineMode:
00876         d->hasBrush = false;
00877         break;
00878     default:
00879         break;
00880     }
00881 
00882     p.moveTo(points[0]);
00883     for (int i = 1; i < pointCount; ++i)
00884         p.lineTo(points[i]);
00885 
00886     if (mode != PolylineMode)
00887         p.closeSubpath();
00888     drawPath(p);
00889 
00890     d->hasBrush = hb;
00891 }

Here is the call graph for this function:

void QPdfBaseEngine::drawPath ( const QPainterPath path  )  [virtual]

The default implementation ignores the path and does nothing.

Reimplemented from QPaintEngine.

Definition at line 893 of file qpdf.cpp.

References b, d, QPdf::FillAndStrokePath, QPdf::FillPath, QPdf::generatePath(), p, setBrush(), and QPdf::StrokePath.

Referenced by drawLines(), drawPoints(), drawPolygon(), and drawRects().

00894 {
00895     Q_D(QPdfBaseEngine);
00896     if (d->clipEnabled && d->allClipped)
00897         return;
00898     if (!d->hasPen && !d->hasBrush)
00899         return;
00900 
00901     if (d->simplePen) {
00902         // draw strokes natively in this case for better output
00903         *d->currentPage << QPdf::generatePath(p, QMatrix(), d->hasBrush ? QPdf::FillAndStrokePath : QPdf::StrokePath);
00904     } else {
00905         if (d->hasBrush)
00906             *d->currentPage << QPdf::generatePath(p, d->stroker.matrix, QPdf::FillPath);
00907         if (d->hasPen) {
00908             *d->currentPage << "q\n";
00909             QBrush b = d->brush;
00910             d->brush = d->pen.brush();
00911             setBrush();
00912             d->stroker.strokePath(p);
00913             *d->currentPage << "Q\n";
00914             d->brush = b;
00915         }
00916     }
00917 }

Here is the call graph for this function:

void QPdfBaseEngine::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 919 of file qpdf.cpp.

References b, d, QTextItemInt::fontEngine, QPdf::generateMatrix(), QFontEngine::Multi, p, setBrush(), and QFontEngine::type().

00920 {
00921     Q_D(QPdfBaseEngine);
00922 
00923     if (!d->hasPen || (d->clipEnabled && d->allClipped))
00924         return;
00925 
00926     *d->currentPage << "q\n";
00927     if(!d->simplePen)
00928         *d->currentPage << QPdf::generateMatrix(d->stroker.matrix);
00929 
00930     bool hp = d->hasPen;
00931     d->hasPen = false;
00932     QBrush b = d->brush;
00933     d->brush = d->pen.brush();
00934     setBrush();
00935 
00936     const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem);
00937     Q_ASSERT(ti.fontEngine->type() != QFontEngine::Multi);
00938     d->drawTextItem(p, ti);
00939     d->hasPen = hp;
00940     d->brush = b;
00941     *d->currentPage << "Q\n";
00942 }

Here is the call graph for this function:

void QPdfBaseEngine::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 {GetFunction}{get function} to retrieve the current values for the given properties.

See also:
QPaintEngineState

Implements QPaintEngine.

Definition at line 945 of file qpdf.cpp.

References QVector< T >::at(), QPaintEngineState::brush(), QPaintEngineState::brushOrigin(), QPaintEngineState::clipOperation(), QPaintEngineState::clipPath(), QPaintEngineState::clipRegion(), d, QPaintEngine::DirtyBrush, QPaintEngine::DirtyBrushOrigin, QPaintEngine::DirtyClipEnabled, QPaintEngine::DirtyClipPath, QPaintEngine::DirtyClipRegion, QPaintEngine::DirtyPen, QPaintEngine::DirtyTransform, flags, QPaintEngineState::isClipEnabled(), QBrush::isOpaque(), QPaintEngineState::matrix(), Qt::NoBrush, Qt::NoPen, path, QPaintEngineState::pen(), QRegion::rects(), setupGraphicsState(), QVector< T >::size(), Qt::SolidPattern, QPaintEngineState::state(), QPaintEngine::state, and updateClipPath().

00946 {
00947     Q_D(QPdfBaseEngine);
00948     QPaintEngine::DirtyFlags flags = state.state();
00949 
00950     if (flags & DirtyTransform)
00951         d->stroker.matrix = state.matrix();
00952 
00953     if (flags & DirtyPen) {
00954         d->pen = state.pen();
00955         d->hasPen = d->pen.style() != Qt::NoPen;
00956         d->stroker.setPen(d->pen);
00957         QBrush penBrush = d->pen.brush();
00958         bool oldSimple = d->simplePen;
00959         d->simplePen = (d->hasPen && penBrush == Qt::SolidPattern && penBrush.isOpaque());
00960         if (oldSimple != d->simplePen)
00961             flags |= DirtyTransform;
00962     }
00963     if (flags & DirtyBrush) {
00964         d->brush = state.brush();
00965         d->hasBrush = d->brush.style() != Qt::NoBrush;
00966     }
00967     if (flags & DirtyBrushOrigin) {
00968         d->brushOrigin = state.brushOrigin();
00969         flags |= DirtyBrush;
00970     }
00971 
00972     bool ce = d->clipEnabled;
00973     if (flags & DirtyClipPath) {
00974         d->clipEnabled = true;
00975         updateClipPath(state.clipPath(), state.clipOperation());
00976     } else if (flags & DirtyClipRegion) {
00977         d->clipEnabled = true;
00978         QPainterPath path;
00979         QVector<QRect> rects = state.clipRegion().rects();
00980         for (int i = 0; i < rects.size(); ++i)
00981             path.addRect(rects.at(i));
00982         updateClipPath(path, state.clipOperation());
00983         flags |= DirtyClipPath;
00984     } else if (flags & DirtyClipEnabled) {
00985         d->clipEnabled = state.isClipEnabled();
00986     }
00987 
00988     if (ce != d->clipEnabled)
00989         flags |= DirtyClipPath;
00990     else if (!d->clipEnabled)
00991         flags &= ~DirtyClipPath;
00992 
00993     setupGraphicsState(flags);
00994 }

Here is the call graph for this function:

int QPdfBaseEngine::metric ( QPaintDevice::PaintDeviceMetric  metricType  )  const [virtual]

Returns the metric for the given id.

Implements QPrintEngine.

Definition at line 1116 of file qpdf.cpp.

References d, QRect::height(), QPaintDevice::PdmDepth, QPaintDevice::PdmDpiX, QPaintDevice::PdmDpiY, QPaintDevice::PdmHeight, QPaintDevice::PdmHeightMM, QPaintDevice::PdmNumColors, QPaintDevice::PdmPhysicalDpiX, QPaintDevice::PdmPhysicalDpiY, QPaintDevice::PdmWidth, QPaintDevice::PdmWidthMM, qRound(), qWarning(), val, and QRect::width().

Referenced by QPSPrintEnginePrivate::emitHeader().

01117 {
01118     Q_D(const QPdfBaseEngine);
01119     int val;
01120     QRect r = d->fullPage ? d->paperRect() : d->pageRect();
01121     switch (metricType) {
01122     case QPaintDevice::PdmWidth:
01123         val = r.width();
01124         break;
01125     case QPaintDevice::PdmHeight:
01126         val = r.height();
01127         break;
01128     case QPaintDevice::PdmDpiX:
01129     case QPaintDevice::PdmDpiY:
01130         val = d->resolution;
01131         break;
01132     case QPaintDevice::PdmPhysicalDpiX:
01133     case QPaintDevice::PdmPhysicalDpiY:
01134         val = 1200;
01135         break;
01136     case QPaintDevice::PdmWidthMM:
01137         val = qRound(r.width()*25.4/d->resolution);
01138         break;
01139     case QPaintDevice::PdmHeightMM:
01140         val = qRound(r.height()*25.4/d->resolution);
01141         break;
01142     case QPaintDevice::PdmNumColors:
01143         val = INT_MAX;
01144         break;
01145     case QPaintDevice::PdmDepth:
01146         val = 32;
01147         break;
01148     default:
01149         qWarning("QPrinter::metric: Invalid metric command");
01150         return 0;
01151     }
01152     return val;
01153 }

Here is the call graph for this function:

bool QPdfBaseEngine::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 1109 of file qpdf.cpp.

References QPaintEngine::DirtyBrush, QPaintEngine::DirtyClipPath, QPaintEngine::DirtyPen, and setupGraphicsState().

Referenced by QPSPrintEngine::newPage(), and QPdfEngine::newPage().

01110 {
01111     setupGraphicsState(DirtyBrush|DirtyPen|DirtyClipPath);
01112     return true;
01113 }

Here is the call graph for this function:

void QPdfBaseEngine::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 1155 of file qpdf.cpp.

References d, QPrintEngine::PPK_CollateCopies, QPrintEngine::PPK_ColorMode, QPrintEngine::PPK_Creator, PPK_CupsOptions, PPK_CupsPageRect, PPK_CupsPaperRect, PPK_CupsStringPageSize, QPrintEngine::PPK_DocumentName, QPrintEngine::PPK_Duplex, QPrintEngine::PPK_FontEmbedding, QPrintEngine::PPK_FullPage, QPrintEngine::PPK_NumberOfCopies, QPrintEngine::PPK_Orientation, QPrintEngine::PPK_OutputFileName, QPrintEngine::PPK_PageOrder, QPrintEngine::PPK_PageSize, QPrintEngine::PPK_PaperSource, QPrintEngine::PPK_PrinterName, QPrintEngine::PPK_PrinterProgram, QPrintEngine::PPK_Resolution, QPrintEngine::PPK_SelectionOption, and value.

01156 {
01157     Q_D(QPdfBaseEngine);
01158     switch (key) {
01159     case PPK_CollateCopies:
01160         d->collate = value.toBool();
01161         break;
01162     case PPK_ColorMode:
01163         d->colorMode = QPrinter::ColorMode(value.toInt());
01164         break;
01165     case PPK_Creator:
01166         d->creator = value.toString();
01167         break;
01168     case PPK_DocumentName:
01169         d->title = value.toString();
01170         break;
01171     case PPK_FullPage:
01172         d->fullPage = value.toBool();
01173         break;
01174     case PPK_NumberOfCopies:
01175         d->copies = value.toInt();
01176         break;
01177     case PPK_Orientation:
01178         d->orientation = QPrinter::Orientation(value.toInt());
01179         break;
01180     case PPK_OutputFileName:
01181         d->outputFileName = value.toString();
01182         break;
01183     case PPK_PageOrder:
01184         d->pageOrder = QPrinter::PageOrder(value.toInt());
01185         break;
01186     case PPK_PageSize:
01187         d->pageSize = QPrinter::PageSize(value.toInt());
01188         break;
01189     case PPK_PaperSource:
01190         d->paperSource = QPrinter::PaperSource(value.toInt());
01191         break;
01192     case PPK_PrinterName:
01193         d->printerName = value.toString();
01194         break;
01195     case PPK_PrinterProgram:
01196         d->printProgram = value.toString();
01197         break;
01198     case PPK_Resolution:
01199         d->resolution = value.toInt();
01200         break;
01201     case PPK_SelectionOption:
01202         d->selectionOption = value.toString();
01203         break;
01204     case PPK_FontEmbedding:
01205         d->embedFonts = value.toBool();
01206         break;
01207     case PPK_Duplex:
01208         d->duplex = value.toBool();
01209         break;
01210     case PPK_CupsPageRect:
01211         d->cupsPageRect = value.toRect();
01212         break;
01213     case PPK_CupsPaperRect:
01214         d->cupsPaperRect = value.toRect();
01215         break;
01216     case PPK_CupsOptions:
01217         d->cupsOptions = value.toStringList();
01218         break;
01219     case PPK_CupsStringPageSize:
01220         d->cupsStringPageSize = value.toString();
01221         break;
01222     default:
01223         break;
01224     }
01225 }

QVariant QPdfBaseEngine::property ( PrintEnginePropertyKey  key  )  const [virtual]

Returns the print engine's property specified by key.

See also:
setProperty()

Implements QPrintEngine.

Definition at line 1227 of file qpdf.cpp.

References d, QPrintEngine::PPK_CollateCopies, QPrintEngine::PPK_ColorMode, QPrintEngine::PPK_Creator, PPK_CupsOptions, PPK_CupsPageRect, PPK_CupsPaperRect, PPK_CupsStringPageSize, QPrintEngine::PPK_DocumentName, QPrintEngine::PPK_Duplex, QPrintEngine::PPK_FontEmbedding, QPrintEngine::PPK_FullPage, QPrintEngine::PPK_NumberOfCopies, QPrintEngine::PPK_Orientation, QPrintEngine::PPK_OutputFileName, QPrintEngine::PPK_PageOrder, QPrintEngine::PPK_PageRect, QPrintEngine::PPK_PageSize, QPrintEngine::PPK_PaperRect, QPrintEngine::PPK_PaperSource, QPrintEngine::PPK_PrinterName, QPrintEngine::PPK_PrinterProgram, QPrintEngine::PPK_Resolution, QPrintEngine::PPK_SelectionOption, and QPrintEngine::PPK_SupportedResolutions.

01228 {
01229     Q_D(const QPdfBaseEngine);
01230 
01231     QVariant ret;
01232     switch (key) {
01233     case PPK_CollateCopies:
01234         ret = d->collate;
01235         break;
01236     case PPK_ColorMode:
01237         ret = d->colorMode;
01238         break;
01239     case PPK_Creator:
01240         ret = d->creator;
01241         break;
01242     case PPK_DocumentName:
01243         ret = d->title;
01244         break;
01245     case PPK_FullPage:
01246         ret = d->fullPage;
01247         break;
01248     case PPK_NumberOfCopies:
01249         ret = d->copies;
01250         break;
01251     case PPK_Orientation:
01252         ret = d->orientation;
01253         break;
01254     case PPK_OutputFileName:
01255         ret = d->outputFileName;
01256         break;
01257     case PPK_PageOrder:
01258         ret = d->pageOrder;
01259         break;
01260     case PPK_PageSize:
01261         ret = d->pageSize;
01262         break;
01263     case PPK_PaperSource:
01264         ret = d->paperSource;
01265         break;
01266     case PPK_PrinterName:
01267         ret = d->printerName;
01268         break;
01269     case PPK_PrinterProgram:
01270         ret = d->printProgram;
01271         break;
01272     case PPK_Resolution:
01273         ret = d->resolution;
01274         break;
01275     case PPK_SupportedResolutions:
01276         ret = QList<QVariant>() << 72;
01277         break;
01278     case PPK_PaperRect:
01279         ret = d->paperRect();
01280         break;
01281     case PPK_PageRect:
01282         ret = d->pageRect();
01283         break;
01284     case PPK_SelectionOption:
01285         ret = d->selectionOption;
01286         break;
01287     case PPK_FontEmbedding:
01288         ret = d->embedFonts;
01289         break;
01290     case PPK_Duplex:
01291         ret = d->duplex;
01292         break;
01293     case PPK_CupsPageRect:
01294         ret = d->cupsPageRect;
01295         break;
01296     case PPK_CupsPaperRect:
01297         ret = d->cupsPaperRect;
01298         break;
01299     case PPK_CupsOptions:
01300         ret = d->cupsOptions;
01301         break;
01302     case PPK_CupsStringPageSize:
01303         ret = d->cupsStringPageSize;
01304         break;
01305     default:
01306         break;
01307     }
01308     return ret;
01309 }

void QPdfBaseEngine::setPen (  ) 

Definition at line 1060 of file qpdf.cpp.

References b, Qt::BevelJoin, d, Qt::FlatCap, QPdf::generateDashes(), Qt::MiterJoin, Qt::RoundCap, Qt::RoundJoin, Qt::SolidPattern, and Qt::SquareCap.

Referenced by setupGraphicsState().

01061 {
01062     Q_D(QPdfBaseEngine);
01063     QBrush b = d->pen.brush();
01064     Q_ASSERT(b.style() == Qt::SolidPattern && b.isOpaque());
01065 
01066     QColor rgba = b.color();
01067     *d->currentPage << rgba.redF()
01068                    << rgba.greenF()
01069                    << rgba.blueF()
01070                    << "SCN\n";
01071 
01072     *d->currentPage << d->pen.widthF() << "w ";
01073 
01074     int pdfCapStyle = 0;
01075     switch(d->pen.capStyle()) {
01076     case Qt::FlatCap:
01077         pdfCapStyle = 0;
01078         break;
01079     case Qt::SquareCap:
01080         pdfCapStyle = 2;
01081         break;
01082     case Qt::RoundCap:
01083         pdfCapStyle = 1;
01084         break;
01085     default:
01086         break;
01087     }
01088     *d->currentPage << pdfCapStyle << "J ";
01089 
01090     int pdfJoinStyle = 0;
01091     switch(d->pen.joinStyle()) {
01092     case Qt::MiterJoin:
01093         pdfJoinStyle = 0;
01094         break;
01095     case Qt::BevelJoin:
01096         pdfJoinStyle = 2;
01097         break;
01098     case Qt::RoundJoin:
01099         pdfJoinStyle = 1;
01100         break;
01101     default:
01102         break;
01103     }
01104     *d->currentPage << pdfJoinStyle << "j ";
01105 
01106     *d->currentPage << QPdf::generateDashes(d->pen) << " 0 d\n";
01107 }

Here is the call graph for this function:

virtual void QPdfBaseEngine::setBrush (  )  [pure virtual]

Referenced by drawPath(), drawTextItem(), and setupGraphicsState().

void QPdfBaseEngine::setupGraphicsState ( QPaintEngine::DirtyFlags  flags  ) 

Definition at line 996 of file qpdf.cpp.

References QPdf::ClipPath, d, QPaintEngine::DirtyBrush, QPaintEngine::DirtyClipPath, QPaintEngine::DirtyPen, QPaintEngine::DirtyTransform, QPdf::generateMatrix(), QPdf::generatePath(), setBrush(), and setPen().

Referenced by newPage(), and updateState().

00997 {
00998     Q_D(QPdfBaseEngine);
00999     if (flags & DirtyClipPath)
01000         flags |= DirtyTransform|DirtyPen|DirtyBrush;
01001 
01002     if (flags & DirtyTransform) {
01003         *d->currentPage << "Q\n";
01004         flags |= DirtyPen|DirtyBrush;
01005     }
01006 
01007     if (flags & DirtyClipPath) {
01008         *d->currentPage << "Q q\n";
01009 
01010         d->allClipped = false;
01011         if (d->clipEnabled && !d->clips.isEmpty()) {
01012             for (int i = 0; i < d->clips.size(); ++i) {
01013                 if (d->clips.at(i).isEmpty()) {
01014                     d->allClipped = true;
01015                     break;
01016                 }
01017             }
01018             if (!d->allClipped) {
01019                 for (int i = 0; i < d->clips.size(); ++i) {
01020                     *d->currentPage << QPdf::generatePath(d->clips.at(i), QMatrix(), QPdf::ClipPath);
01021                 }
01022             }
01023         }
01024     }
01025 
01026     if (flags & DirtyTransform) {
01027         *d->currentPage << "q\n";
01028         if (d->simplePen && !d->stroker.matrix.isIdentity())
01029             *d->currentPage << QPdf::generateMatrix(d->stroker.matrix);
01030     }
01031     if (flags & DirtyBrush)
01032         setBrush();
01033     if (d->simplePen && flags & DirtyPen)
01034         setPen();
01035 }

Here is the call graph for this function:

void QPdfBaseEngine::updateClipPath ( const QPainterPath path,
Qt::ClipOperation  op 
) [private]

Definition at line 1037 of file qpdf.cpp.

References QPainter::clipPath(), d, Qt::IntersectClip, Qt::NoClip, p, QPaintEngine::painter(), path, and Qt::ReplaceClip.

Referenced by updateState().

01038 {
01039     Q_D(QPdfBaseEngine);
01040     QPainterPath path = d->stroker.matrix.map(p);
01041     //qDebug() << "updateClipPath: " << d->stroker.matrix << p.boundingRect() << path.boundingRect() << op;
01042 
01043     if (op == Qt::NoClip) {
01044         d->clipEnabled = false;
01045         d->clips.clear();
01046     } else if (op == Qt::ReplaceClip) {
01047         d->clips.clear();
01048         d->clips.append(path);
01049     } else if (op == Qt::IntersectClip) {
01050         d->clips.append(path);
01051     } else { // UniteClip
01052         // ask the painter for the current clipping path. that's the easiest solution
01053         path = painter()->clipPath();
01054         path = d->stroker.matrix.map(path);
01055         d->clips.clear();
01056         d->clips.append(path);
01057     }
01058 }

Here is the call graph for this function:


The documentation for this class was generated from the following files:
Generated on Thu Mar 15 18:37:35 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1