src/gui/painting/qpdf.cpp File Reference

#include "qplatformdefs.h"
#include <qdebug.h>
#include "qpdf_p.h"
#include <qfile.h>
#include "private/qcups_p.h"

Include dependency graph for qpdf.cpp:

Go to the source code of this file.

Defines

#define QT_PATH_ELEMENT(elm)
#define Q_MM(n)   int((n * 720 + 127) / 254)
#define Q_IN(n)   int(n * 72)

Functions

int qt_defaultDpi ()
const char * qt_real_to_string (qreal val, char *buf)
const char * qt_int_to_string (int val, char *buf)
QByteArray QPdf::generatePath (const QPainterPath &path, const QMatrix &matrix, PathFlags flags)
QByteArray QPdf::generateMatrix (const QMatrix &matrix)
QByteArray QPdf::generateDashes (const QPen &pen)
QByteArray QPdf::patternForBrush (const QBrush &b)
static void moveToHook (qfixed x, qfixed y, void *data)
static void lineToHook (qfixed x, qfixed y, void *data)
static void cubicToHook (qfixed c1x, qfixed c1y, qfixed c2x, qfixed c2y, qfixed ex, qfixed ey, void *data)
QByteArray QPdf::ascii85Encode (const QByteArray &input)
const char * QPdf::toHex (ushort u, char *buffer)
const char * QPdf::toHex (uchar u, char *buffer)
QPdf::PaperSize QPdf::paperSize (QPrinter::PageSize pageSize)
const char * QPdf::paperSizeToString (QPrinter::PageSize pageSize)
QByteArray QPdf::stripSpecialCharacters (const QByteArray &string)
static void closeAllOpenFds ()

Variables

static const char * pattern_for_brush []
static const QPdf::PaperSize paperSizes [QPrinter::NPageSize]
static const char *const psToStr [QPrinter::NPageSize+1]


Define Documentation

#define Q_IN (  )     int(n * 72)

Definition at line 722 of file qpdf.cpp.

#define Q_MM (  )     int((n * 720 + 127) / 254)

Definition at line 721 of file qpdf.cpp.

#define QT_PATH_ELEMENT ( elm   ) 

Definition at line 102 of file qpdf.cpp.


Function Documentation

static void closeAllOpenFds (  )  [static]

Definition at line 1358 of file qpdf.cpp.

References int.

Referenced by QPdfBaseEnginePrivate::openPrintDevice().

01359 {
01360     // hack time... getting the maximum number of open
01361     // files, if possible.  if not we assume it's the
01362     // larger of 256 and the fd we got
01363     int i;
01364 #if defined(_SC_OPEN_MAX)
01365     i = (int)sysconf(_SC_OPEN_MAX);
01366 #elif defined(_POSIX_OPEN_MAX)
01367     i = (int)_POSIX_OPEN_MAX;
01368 #elif defined(OPEN_MAX)
01369     i = (int)OPEN_MAX;
01370 #else
01371     i = 256;
01372 #endif
01373     // leave stdin/out/err untouched
01374     while(--i > 2)
01375         ::close(i);
01376 }

static void cubicToHook ( qfixed  c1x,
qfixed  c1y,
qfixed  c2x,
qfixed  c2y,
qfixed  ex,
qfixed  ey,
void *  data 
) [static]

Definition at line 567 of file qpdf.cpp.

References t.

Referenced by QPdf::Stroker::Stroker().

00571 {
00572     QPdf::Stroker *t = (QPdf::Stroker *)data;
00573     if (!t->zeroWidth) {
00574         t->matrix.map(c1x, c1y, &c1x, &c1y);
00575         t->matrix.map(c2x, c2y, &c2x, &c2y);
00576         t->matrix.map(ex, ey, &ex, &ey);
00577     }
00578     *t->stream << c1x << c1y
00579                << c2x << c2y
00580                << ex << ey
00581                << "c\n";
00582 }

static void lineToHook ( qfixed  x,
qfixed  y,
void *  data 
) [static]

Definition at line 559 of file qpdf.cpp.

References t.

Referenced by QPdf::Stroker::Stroker().

00560 {
00561     QPdf::Stroker *t = (QPdf::Stroker *)data;
00562     if (!t->zeroWidth)
00563         t->matrix.map(x, y, &x, &y);
00564     *t->stream << x << y << "l\n";
00565 }

static void moveToHook ( qfixed  x,
qfixed  y,
void *  data 
) [static]

Definition at line 548 of file qpdf.cpp.

References t.

Referenced by QPdf::Stroker::Stroker().

00549 {
00550     QPdf::Stroker *t = (QPdf::Stroker *)data;
00551     if (!t->first)
00552         *t->stream << "h\n";
00553     if (!t->zeroWidth)
00554         t->matrix.map(x, y, &x, &y);
00555     *t->stream << x << y << "m\n";
00556     t->first = false;
00557 }

int qt_defaultDpi (  ) 

Definition at line 119 of file qfont.cpp.

00120 {
00121     if (!qt_is_gui_used)
00122         return 75;
00123 
00124     int dpi;
00125 #ifdef Q_WS_X11
00126     dpi = QX11Info::appDpiY();
00127 #elif defined(Q_WS_WIN)
00128     dpi = GetDeviceCaps(shared_dc,LOGPIXELSY);
00129 #elif defined(Q_WS_MAC)
00130     short hr;
00131     short mdpi;
00132     ScreenRes(&hr, &mdpi);
00133     dpi = int(mdpi);
00134 #elif defined(Q_WS_QWS)
00135     if (!qt_screen)
00136         return 72;
00137     QScreen *screen = qt_screen;
00138     const QList<QScreen*> subScreens = qt_screen->subScreens();
00139     if (!subScreens.isEmpty())
00140         screen = subScreens.at(0);
00141     dpi = qRound(screen->height() / double(screen->physicalHeight() / 25.4));
00142 #endif // Q_WS_X11
00143 
00144     return dpi;
00145 }

const char* qt_int_to_string ( int  val,
char *  buf 
)

Definition at line 78 of file qpdf.cpp.

References i.

Referenced by QPdf::ByteStream::operator<<().

00078                                                  {
00079     const char *ret = buf;
00080     if (val < 0) {
00081         *(buf++) = '-';
00082         val = -val;
00083     }
00084     char output[256];
00085     int i = 0;
00086     while (val) {
00087         output[i] = '0' + (val % 10);
00088         ++i;
00089         val /= 10;
00090     }
00091     if (i == 0) {
00092         *(buf++) = '0';
00093     } else {
00094         while (i)
00095             *(buf++) = output[--i];
00096     }
00097     *(buf++) = ' ';
00098     *buf = 0;
00099     return ret;
00100 }

const char* qt_real_to_string ( qreal  val,
char *  buf 
)

Definition at line 34 of file qpdf.cpp.

References i, and int.

Referenced by QPdf::ByteStream::operator<<().

00034                                                     {
00035     const char *ret = buf;
00036     if (val < 0) {
00037         *(buf++) = '-';
00038         val = -val;
00039     }
00040     int ival = (int) val;
00041     qreal frac = val - (qreal)ival;
00042 
00043     int ifrac = (int)(frac * 1000000);
00044     if (ifrac == 1000000) {
00045         ++ival;
00046         ifrac = 0;
00047     }
00048     char output[256];
00049     int i = 0;
00050     while (ival) {
00051         output[i] = '0' + (ival % 10);
00052         ++i;
00053         ival /= 10;
00054     }
00055     int fact = 100000;
00056     if (i == 0) {
00057         *(buf++) = '0';
00058     } else {
00059         while (i) {
00060             *(buf++) = output[--i];
00061             fact /= 10;
00062             ifrac /= 10;
00063         }
00064     }
00065 
00066     if (ifrac) {
00067         *(buf++) =  '.';
00068         while (fact) {
00069             *(buf++) = '0' + ((ifrac/fact) % 10);
00070             fact /= 10;
00071         }
00072     }
00073     *(buf++) = ' ';
00074     *buf = 0;
00075     return ret;
00076 }


Variable Documentation

const QPdf::PaperSize paperSizes[QPrinter::NPageSize] [static]

Definition at line 724 of file qpdf.cpp.

Referenced by QPdf::paperSize().

const char* pattern_for_brush[] [static]

Definition at line 203 of file qpdf.cpp.

Referenced by QPdf::patternForBrush().

const char* const psToStr[QPrinter::NPageSize+1] [static]

Initial value:

{
    "A4", "B5", "Letter", "Legal", "Executive",
    "A0", "A1", "A2", "A3", "A5", "A6", "A7", "A8", "A9", "B0", "B1",
    "B10", "B2", "B3", "B4", "B6", "B7", "B8", "B9", "C5E", "Comm10E",
    "DLE", "Folio", "Ledger", "Tabloid", 0
}

Definition at line 758 of file qpdf.cpp.


Generated on Thu Mar 15 13:35:44 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1