Classes | |
| class | ByteStream |
| struct | Stroker |
| struct | PaperSize |
Enumerations | |
| enum | PathFlags |
Functions | |
| QByteArray | generatePath (const QPainterPath &path, const QMatrix &matrix, PathFlags flags) |
| QByteArray | generateMatrix (const QMatrix &matrix) |
| QByteArray | generateDashes (const QPen &pen) |
| QByteArray | patternForBrush (const QBrush &b) |
| QByteArray | ascii85Encode (const QByteArray &input) |
| const char * | toHex (ushort u, char *buffer) |
| const char * | toHex (uchar u, char *buffer) |
| QPdf::PaperSize | paperSize (QPrinter::PageSize pageSize) |
| const char * | paperSizeToString (QPrinter::PageSize pageSize) |
| QByteArray | stripSpecialCharacters (const QByteArray &string) |
| enum QPdf::PathFlags |
Definition at line 74 of file qpdf_p.h.
00074 { 00075 ClipPath, 00076 FillPath, 00077 StrokePath, 00078 FillAndStrokePath 00079 };
| QByteArray QPdf::ascii85Encode | ( | const QByteArray & | input | ) |
Definition at line 633 of file qpdf.cpp.
References base, QByteArray::constData(), QByteArray::data(), QByteArray::resize(), QByteArray::size(), and val.
Referenced by compress().
00634 { 00635 int isize = input.size()/4*4; 00636 QByteArray output; 00637 output.resize(input.size()*5/4+7); 00638 char *out = output.data(); 00639 const uchar *in = (const uchar *)input.constData(); 00640 for (int i = 0; i < isize; i += 4) { 00641 uint val = (((uint)in[i])<<24) + (((uint)in[i+1])<<16) + (((uint)in[i+2])<<8) + (uint)in[i+3]; 00642 if (val == 0) { 00643 *out = 'z'; 00644 ++out; 00645 } else { 00646 char base[5]; 00647 base[4] = val % 85; 00648 val /= 85; 00649 base[3] = val % 85; 00650 val /= 85; 00651 base[2] = val % 85; 00652 val /= 85; 00653 base[1] = val % 85; 00654 val /= 85; 00655 base[0] = val % 85; 00656 *(out++) = base[0] + '!'; 00657 *(out++) = base[1] + '!'; 00658 *(out++) = base[2] + '!'; 00659 *(out++) = base[3] + '!'; 00660 *(out++) = base[4] + '!'; 00661 } 00662 } 00663 //write the last few bytes 00664 int remaining = input.size() - isize; 00665 if (remaining) { 00666 uint val = 0; 00667 for (int i = isize; i < input.size(); ++i) 00668 val = (val << 8) + in[i]; 00669 val <<= 8*(4-remaining); 00670 char base[5]; 00671 base[4] = val % 85; 00672 val /= 85; 00673 base[3] = val % 85; 00674 val /= 85; 00675 base[2] = val % 85; 00676 val /= 85; 00677 base[1] = val % 85; 00678 val /= 85; 00679 base[0] = val % 85; 00680 for (int i = 0; i < remaining+1; ++i) 00681 *(out++) = base[i] + '!'; 00682 } 00683 *(out++) = '~'; 00684 *(out++) = '>'; 00685 output.resize(out-output.data()); 00686 return output; 00687 }
Here is the call graph for this function:

| QByteArray QPdf::generateDashes | ( | const QPen & | pen | ) |
Definition at line 180 of file qpdf.cpp.
References QVector< T >::at(), QPen::dashPattern(), i, s, QVector< T >::size(), w, and QPen::widthF().
Referenced by QPdfBaseEngine::setPen().
00181 { 00182 QByteArray result; 00183 ByteStream s(&result); 00184 s << "["; 00185 00186 QVector<qreal> dasharray = pen.dashPattern(); 00187 qreal w = pen.widthF(); 00188 if (w < 0.001) 00189 w = 1; 00190 for (int i = 0; i < dasharray.size(); ++i) { 00191 qreal dw = dasharray.at(i)*w; 00192 if (dw < 0.0001) dw = 0.0001; 00193 s << dw; 00194 } 00195 s << "]"; 00196 //qDebug() << "dasharray: pen has" << dasharray; 00197 //qDebug() << " => " << result; 00198 return result; 00199 }
Here is the call graph for this function:

| QByteArray QPdf::generateMatrix | ( | const QMatrix & | matrix | ) |
Definition at line 166 of file qpdf.cpp.
References QMatrix::dx(), QMatrix::dy(), QMatrix::m11(), QMatrix::m12(), QMatrix::m21(), QMatrix::m22(), and s.
Referenced by QPdfEnginePrivate::addBrushPattern(), QPdfEngine::drawImage(), QPSPrintEngine::drawImageInternal(), QPdfEngine::drawPixmap(), QPdfBaseEngine::drawRects(), QPdfBaseEngine::drawTextItem(), QPdfEnginePrivate::newPage(), and QPdfBaseEngine::setupGraphicsState().
00167 { 00168 QByteArray result; 00169 ByteStream s(&result); 00170 s << matrix.m11() 00171 << matrix.m12() 00172 << matrix.m21() 00173 << matrix.m22() 00174 << matrix.dx() 00175 << matrix.dy() 00176 << "cm\n"; 00177 return result; 00178 }
Here is the call graph for this function:

| QByteArray QPdf::generatePath | ( | const QPainterPath & | path, | |
| const QMatrix & | matrix, | |||
| PathFlags | flags | |||
| ) |
Definition at line 104 of file qpdf.cpp.
References ClipPath, QPainterPath::CurveToDataElement, QPainterPath::CurveToElement, FillAndStrokePath, FillPath, i, QPainterPath::LineToElement, QMatrix::map(), QPainterPath::MoveToElement, path, s, start, StrokePath, Qt::WindingFill, x, and y.
Referenced by QPdfBaseEngine::drawPath(), and QPdfBaseEngine::setupGraphicsState().
00105 { 00106 QByteArray result; 00107 if (!path.elementCount()) 00108 return result; 00109 00110 ByteStream s(&result); 00111 00112 int start = -1; 00113 for (int i = 0; i < path.elementCount(); ++i) { 00114 const QPainterPath::Element &elm = path.elementAt(i); 00115 switch (elm.type) { 00116 case QPainterPath::MoveToElement: 00117 if (start >= 0 00118 && path.elementAt(start).x == path.elementAt(i-1).x 00119 && path.elementAt(start).y == path.elementAt(i-1).y) 00120 s << "h\n"; 00121 s << matrix.map(QPointF(elm.x, elm.y)) << "m\n"; 00122 start = i; 00123 break; 00124 case QPainterPath::LineToElement: 00125 s << matrix.map(QPointF(elm.x, elm.y)) << "l\n"; 00126 break; 00127 case QPainterPath::CurveToElement: 00128 Q_ASSERT(path.elementAt(i+1).type == QPainterPath::CurveToDataElement); 00129 Q_ASSERT(path.elementAt(i+2).type == QPainterPath::CurveToDataElement); 00130 s << matrix.map(QPointF(elm.x, elm.y)) 00131 << matrix.map(QPointF(path.elementAt(i+1).x, path.elementAt(i+1).y)) 00132 << matrix.map(QPointF(path.elementAt(i+2).x, path.elementAt(i+2).y)) 00133 << "c\n"; 00134 i += 2; 00135 break; 00136 default: 00137 qFatal("QPdf::generatePath(), unhandled type: %d", elm.type); 00138 } 00139 } 00140 if (start >= 0 00141 && path.elementAt(start).x == path.elementAt(path.elementCount()-1).x 00142 && path.elementAt(start).y == path.elementAt(path.elementCount()-1).y) 00143 s << "h\n"; 00144 00145 Qt::FillRule fillRule = path.fillRule(); 00146 00147 const char *op = 0; 00148 switch (flags) { 00149 case ClipPath: 00150 op = (fillRule == Qt::WindingFill) ? "W n\n" : "W* n\n"; 00151 break; 00152 case FillPath: 00153 op = (fillRule == Qt::WindingFill) ? "f\n" : "f*\n"; 00154 break; 00155 case StrokePath: 00156 op = "S\n"; 00157 break; 00158 case FillAndStrokePath: 00159 op = (fillRule == Qt::WindingFill) ? "B\n" : "B*\n"; 00160 break; 00161 } 00162 s << op; 00163 return result; 00164 }
Here is the call graph for this function:

| PaperSize QPdf::paperSize | ( | QPrinter::PageSize | pageSize | ) |
Definition at line 766 of file qpdf.cpp.
References paperSizes.
Referenced by QPdfBaseEnginePrivate::pageRect(), QPdfBaseEnginePrivate::paperRect(), and QPrintDialogPrivate::setupPrinter().
00767 { 00768 return paperSizes[pageSize]; 00769 }
| const char * QPdf::paperSizeToString | ( | QPrinter::PageSize | pageSize | ) |
Definition at line 771 of file qpdf.cpp.
Referenced by QPdfBaseEnginePrivate::openPrintDevice().
00772 { 00773 return psToStr[pageSize]; 00774 }
| QByteArray QPdf::patternForBrush | ( | const QBrush & | b | ) |
Definition at line 356 of file qpdf.cpp.
References b, Qt::DiagCrossPattern, and pattern_for_brush.
Referenced by QPdfEnginePrivate::addBrushPattern().
00357 { 00358 int style = b.style(); 00359 if (style > Qt::DiagCrossPattern) 00360 return QByteArray(); 00361 return pattern_for_brush[style]; 00362 }
| QByteArray QPdf::stripSpecialCharacters | ( | const QByteArray & | string | ) |
Definition at line 777 of file qpdf.cpp.
References s.
Referenced by QFontEngineFT::properties(), and QFontEngine::properties().
00778 { 00779 QByteArray s = string; 00780 s.replace(" ", ""); 00781 s.replace("(", ""); 00782 s.replace(")", ""); 00783 s.replace("<", ""); 00784 s.replace(">", ""); 00785 s.replace("[", ""); 00786 s.replace("]", ""); 00787 s.replace("{", ""); 00788 s.replace("}", ""); 00789 s.replace("/", ""); 00790 s.replace("%", ""); 00791 return s; 00792 }
| const char * QPdf::toHex | ( | uchar | u, | |
| char * | buffer | |||
| ) |
Definition at line 705 of file qpdf.cpp.
References hex().
00706 { 00707 int i = 1; 00708 while (i >= 0) { 00709 ushort hex = (u & 0x000f); 00710 if (hex < 0x0a) 00711 buffer[i] = '0'+hex; 00712 else 00713 buffer[i] = 'A'+(hex-0x0a); 00714 u = u >> 4; 00715 i--; 00716 } 00717 buffer[2] = '\0'; 00718 return buffer; 00719 }
Here is the call graph for this function:

| const char * QPdf::toHex | ( | ushort | u, | |
| char * | buffer | |||
| ) |
Definition at line 689 of file qpdf.cpp.
References hex().
Referenced by QFontSubset::createToUnicodeMap(), QPdfBaseEnginePrivate::drawTextItem(), encodeNumber(), and QFontSubset::glyphName().
00690 { 00691 int i = 3; 00692 while (i >= 0) { 00693 ushort hex = (u & 0x000f); 00694 if (hex < 0x0a) 00695 buffer[i] = '0'+hex; 00696 else 00697 buffer[i] = 'A'+(hex-0x0a); 00698 u = u >> 4; 00699 i--; 00700 } 00701 buffer[4] = '\0'; 00702 return buffer; 00703 }
Here is the call graph for this function:

1.5.1