41 #include "qplatformdefs.h" 46 #include <private/qmath_p.h> 47 #include "private/qcups_p.h" 50 #include "private/qfont_p.h" 53 #include "private/qcore_unix_p.h" 64 const char *ret = buf;
77 unsigned int ival = (
unsigned int) val;
80 int ifrac = (int)(frac * 1000000000);
81 if (ifrac == 1000000000) {
88 output[i] =
'0' + (ival % 10);
97 *(buf++) = output[--i];
106 *(buf++) =
'0' + ((ifrac/fact) % 10);
116 const char *ret = buf;
124 output[i] =
'0' + (val % 10);
132 *(buf++) = output[--i];
143 fileBackingEnabled(fileBacking),
144 fileBackingActive(false),
270 #define QT_PATH_ELEMENT(elm) 305 qFatal(
"QPdf::generatePath(), unhandled type: %d", elm.
type);
358 for (
int i = 0; i < dasharray.
size(); ++i) {
360 if (dw < 0.0001) dw = 0.0001;
526 int style = b.
style();
532 #ifdef USE_NATIVE_GRADIENTS 533 static void writeTriangleLine(
uchar *&
data,
int xpos,
int ypos,
int xoff,
int yoff,
uint rgb,
uchar flag,
bool alpha)
581 for (
int i = stops.
size() - 2; i >= 0; --i) {
586 for (
int i = 0 ; i < stops.
size(); ++i)
587 stops[i].first /= 2.;
590 QPointF orthogonal(offset.
y(), -offset.
x());
591 qreal length = offset.
x()*offset.
x() + offset.
y()*offset.
y();
596 int off_max = INT_MIN;
598 qreal ort_max = INT_MIN;
599 for (
int i = 0; i < 4; ++i) {
600 qreal off = ((page_rect[i].
x() - start.x()) * offset.
x() + (page_rect[i].
y() - start.y()) * offset.
y())/length;
601 qreal ort = ((page_rect[i].
x() - start.x()) * orthogonal.x() + (page_rect[i].
y() - start.y()) * orthogonal.y())/length;
604 ort_min =
qMin(ort_min, ort);
605 ort_max =
qMax(ort_max, ort);
610 start += off_min * offset + ort_min * orthogonal;
611 orthogonal *= (ort_max - ort_min);
612 int num = off_max - off_min;
614 QPointF gradient_rect[4] = { start,
617 start + num*offset + orthogonal };
618 qreal xmin = gradient_rect[0].
x();
619 qreal xmax = gradient_rect[0].
x();
620 qreal ymin = gradient_rect[0].
y();
621 qreal ymax = gradient_rect[0].
y();
622 for (
int i = 1; i < 4; ++i) {
623 xmin =
qMin(xmin, gradient_rect[i].x());
624 xmax =
qMax(xmax, gradient_rect[i].x());
625 ymin =
qMin(ymin, gradient_rect[i].y());
626 ymax =
qMax(ymax, gradient_rect[i].y());
635 int xoff = (int)(orthogonal.x()*factor_x);
636 int yoff = (int)(orthogonal.y()*factor_y);
642 if (off_min > 0 || off_max < 1) {
646 int xpos = (int)(start.x()*factor_x);
647 int ypos = (int)(start.y()*factor_y);
648 writeTriangleLine(data, xpos, ypos, xoff, yoff, rgb, 0, alpha);
650 xpos = (int)(start.x()*factor_x);
651 ypos = (int)(start.y()*factor_y);
652 writeTriangleLine(data, xpos, ypos, xoff, yoff, rgb, 1, alpha);
657 int xpos = (int)(start.x()*factor_x);
658 int ypos = (int)(start.y()*factor_y);
659 writeTriangleLine(data, xpos, ypos, xoff, yoff, rgb, flag, alpha);
660 start -= off_min*offset;
663 for (
int s = 0; s < stops.
size(); ++s) {
666 int xpos = (int)(start.x()*factor_x);
667 int ypos = (int)(start.y()*factor_y);
668 writeTriangleLine(data, xpos, ypos, xoff, yoff, rgb, flag, alpha);
669 if (s < stops.
size()-1)
674 start += (off_max - 1)*offset;
676 int xpos = (int)(start.x()*factor_x);
677 int ypos = (int)(start.y()*factor_y);
678 writeTriangleLine(data, xpos, ypos, xoff, yoff, rgb, flag, alpha);
682 for (
int i = 0; i < num; ++i) {
684 for (
int s = 0; s < stops.
size(); ++s) {
686 int xpos = (int)(start.x()*factor_x);
687 int ypos = (int)(start.y()*factor_y);
688 writeTriangleLine(data, xpos, ypos, xoff, yoff, rgb, flag, alpha);
689 if (s < stops.
size()-1)
701 "/ColorSpace " << (alpha ?
"/DeviceGray\n" :
"/DeviceRGB\n") <<
703 "/BitsPerCoordinate 24\n" 704 "/BitsPerComponent 8\n" 706 "/Decode [" << xmin << xmax << ymin << ymax << (alpha ?
"0 1]\n" :
"0 1 0 1 0 1]\n") <<
708 "/Length " << triangles.
length() <<
"\n" 710 "stream\n" << triangles <<
"endstream\n" 723 *t->
stream << x << y <<
"m\n";
732 *t->
stream << x << y <<
"l\n";
755 dashStroker(&basicStroker)
772 bool zeroWidth = w < 0.0001;
784 for (
int i = 0; i < dashpattern.
size(); ++i)
785 dashpattern[i] *= 10.;
808 int isize = input.
size()/4*4;
811 char *out = output.
data();
813 for (
int i = 0; i < isize; i += 4) {
829 *(out++) = base[0] +
'!';
830 *(out++) = base[1] +
'!';
831 *(out++) = base[2] +
'!';
832 *(out++) = base[3] +
'!';
833 *(out++) = base[4] +
'!';
837 int remaining = input.
size() - isize;
840 for (
int i = isize; i < input.
size(); ++i)
841 val = (val << 8) + in[i];
842 val <<= 8*(4-remaining);
853 for (
int i = 0; i < remaining+1; ++i)
854 *(out++) = base[i] +
'!';
870 buffer[i] =
'A'+(hex-0x0a);
886 buffer[i] =
'A'+(hex-0x0a);
894 #define Q_MM(n) int((n * 720 + 127) / 254) 895 #define Q_IN(n) int(n * 72) 899 "A4",
"B5",
"Letter",
"Legal",
"Executive",
900 "A0",
"A1",
"A2",
"A3",
"A5",
"A6",
"A7",
"A8",
"A9",
"B0",
"B1",
901 "B10",
"B2",
"B3",
"B4",
"B6",
"B7",
"B8",
"B9",
"C5E",
"Comm10E",
902 "DLE",
"Folio",
"Ledger",
"Tabloid", 0
923 #if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) 929 for (
int i = 0; i < prnCount; ++i) {
930 if (printers[i].is_default) {
940 if (
d->printerName.isEmpty())
942 if (
d->printerName.isEmpty())
944 if (
d->printerName.isEmpty())
956 for (
int i=0; i!=pointCount;++i) {
961 bool hadBrush =
d->hasBrush;
964 d->hasBrush = hadBrush;
974 for (
int i=0; i!=lineCount;++i) {
978 bool hadBrush =
d->hasBrush;
981 d->hasBrush = hadBrush;
990 if (
d->useAlphaEngine) {
996 if (
d->clipEnabled &&
d->allClipped)
998 if (!
d->hasPen && !
d->hasBrush)
1001 QBrush penBrush =
d->pen.brush();
1002 if (
d->simplePen || !
d->hasPen) {
1004 if(!
d->simplePen && !
d->stroker.matrix.isIdentity())
1006 for (
int i = 0; i < rectCount; ++i)
1007 *
d->currentPage << rects[i].
x() << rects[i].
y() << rects[i].
width() << rects[i].
height() <<
"re\n";
1008 *
d->currentPage << (
d->hasPen ? (
d->hasBrush ?
"B\n" :
"S\n") :
"f\n");
1009 if(!
d->simplePen && !
d->stroker.matrix.isIdentity())
1010 *
d->currentPage <<
"Q\n";
1013 for (
int i=0; i!=rectCount; ++i)
1023 if (
d->useAlphaEngine) {
1029 if (!points || !pointCount)
1032 bool hb =
d->hasBrush;
1044 d->hasBrush =
false;
1051 for (
int i = 1; i < pointCount; ++i)
1065 if (
d->useAlphaEngine) {
1071 if (
d->clipEnabled &&
d->allClipped)
1073 if (!
d->hasPen && !
d->hasBrush)
1083 *
d->currentPage <<
"q\n";
1085 d->brush =
d->pen.brush();
1087 d->stroker.strokePath(p);
1088 *
d->currentPage <<
"Q\n";
1098 if (
d->useAlphaEngine) {
1104 if (!
d->hasPen || (
d->clipEnabled &&
d->allClipped))
1112 *
d->currentPage <<
"q\n";
1116 bool hp =
d->hasPen;
1119 d->brush =
d->pen.brush();
1124 d->drawTextItem(p, ti);
1127 *
d->currentPage <<
"Q\n";
1135 if (
d->useAlphaEngine) {
1141 QPaintEngine::DirtyFlags flags = state.
state();
1147 d->pen = state.
pen();
1149 d->stroker.setPen(
d->pen);
1150 QBrush penBrush =
d->pen.brush();
1151 bool oldSimple =
d->simplePen;
1153 if (oldSimple !=
d->simplePen)
1157 d->brush = state.
brush();
1169 bool ce =
d->clipEnabled;
1171 d->clipEnabled =
true;
1174 d->clipEnabled =
true;
1177 for (
int i = 0; i < rects.
size(); ++i)
1185 if (ce !=
d->clipEnabled)
1187 else if (!
d->clipEnabled)
1188 flags &= ~DirtyClipPath;
1200 *
d->currentPage <<
"Q\n";
1204 if (flags & DirtyClipPath) {
1205 *
d->currentPage <<
"Q q\n";
1207 d->allClipped =
false;
1208 if (
d->clipEnabled && !
d->clips.isEmpty()) {
1209 for (
int i = 0; i <
d->clips.size(); ++i) {
1210 if (
d->clips.at(i).isEmpty()) {
1211 d->allClipped =
true;
1215 if (!
d->allClipped) {
1216 for (
int i = 0; i <
d->clips.size(); ++i) {
1223 if (flags & DirtyTransform) {
1224 *
d->currentPage <<
"q\n";
1225 if (
d->simplePen && !
d->stroker.matrix.isIdentity())
1243 d->clipEnabled =
false;
1247 d->clips.append(path);
1249 d->clips.append(path);
1253 path =
d->stroker.matrix.map(path);
1255 d->clips.append(path);
1258 if (
d->useAlphaEngine) {
1264 if (!
d->clipEnabled) {
1265 QRect r =
d->fullPage ?
d->paperRect() :
d->pageRect();
1272 d->clipEnabled =
true;
1275 path =
d->stroker.matrix.map(path);
1279 d->clips.append(path);
1295 *
d->currentPage << gray << gray <<
gray;
1297 *
d->currentPage << rgba.redF()
1301 *
d->currentPage <<
"SCN\n";
1303 *
d->currentPage <<
d->pen.widthF() <<
"w ";
1305 int pdfCapStyle = 0;
1306 switch(
d->pen.capStyle()) {
1319 *
d->currentPage << pdfCapStyle <<
"J ";
1321 int pdfJoinStyle = 0;
1322 switch(
d->pen.joinStyle()) {
1335 *
d->currentPage << pdfJoinStyle <<
"j ";
1355 QRect r =
d->fullPage ?
d->paperRect() :
d->pageRect();
1356 switch (metricType) {
1365 val =
d->resolution;
1384 qWarning(
"QPrinter::metric: Invalid metric command");
1411 d->copies = value.
toInt();
1435 d->resolution = value.
toInt();
1441 d->embedFonts = value.
toBool();
1447 d->cupsPageRect = value.
toRect();
1450 d->cupsPaperRect = value.
toRect();
1456 d->cupsStringPageSize = value.
toString();
1460 d->customPaperSize = value.
toSizeF();
1466 d->leftMargin = margins.at(0).toReal();
1467 d->topMargin = margins.at(1).toReal();
1468 d->rightMargin = margins.at(2).toReal();
1469 d->bottomMargin = margins.at(3).toReal();
1470 d->hasCustomPageMargins =
true;
1503 #if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) 1511 #if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) 1519 ret =
d->orientation;
1522 ret =
d->outputFileName;
1531 ret =
d->paperSource;
1534 ret =
d->printerName;
1537 ret =
d->printProgram;
1540 ret =
d->resolution;
1546 ret =
d->paperRect();
1549 ret =
d->pageRect();
1552 ret =
d->selectionOption;
1555 ret =
d->embedFonts;
1561 ret =
d->cupsPageRect;
1564 ret =
d->cupsPaperRect;
1567 ret =
d->cupsOptions;
1570 ret =
d->cupsStringPageSize;
1573 ret =
d->customPaperSize;
1578 if (
d->hasCustomPageMargins) {
1579 margins <<
d->leftMargin <<
d->topMargin
1580 <<
d->rightMargin <<
d->bottomMargin;
1582 const qreal defaultMargin = 10;
1583 margins << defaultMargin << defaultMargin
1584 << defaultMargin << defaultMargin;
1596 : clipEnabled(false), allClipped(false), hasPen(true), hasBrush(false), simplePen(false),
1597 useAlphaEngine(false),
1598 outDevice(0), fd(-1),
1599 duplex(
QPrinter::DuplexNone), collate(false), fullPage(false), embedFonts(true), copies(1),
1602 hasCustomPageMargins(false),
1603 leftMargin(0), topMargin(0), rightMargin(0), bottomMargin(0)
1622 d->postscript =
false;
1623 d->currentObject = 1;
1626 d->stroker.stream =
d->currentPage;
1629 return d->openPrintDevice();
1637 delete d->currentPage;
1640 d->closePrintDevice();
1651 #if defined(_SC_OPEN_MAX) 1652 i = (int)sysconf(_SC_OPEN_MAX);
1653 #elif defined(_POSIX_OPEN_MAX) 1654 i = (int)_POSIX_OPEN_MAX;
1655 #elif defined(OPEN_MAX) 1678 #if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) 1682 if (ret.
first < 0) {
1683 qWarning(
"QPdfPrinter: Could not open temporary file to print");
1698 qWarning(
"QPdfPrinter: Could not open pipe to print");
1713 (void)execlp(
"true",
"true", (
char *)0);
1714 (void)execl(
"/bin/true",
"true", (
char *)0);
1715 (void)execl(
"/usr/bin/true",
"true", (
char *)0);
1738 for (
int i = 0; i < list.
size(); ++i)
1750 char ** lpargs =
new char *[lphack.
size()+6];
1754 for (i = 0; i < lphack.
size(); ++i)
1757 char dash_o[] =
"-o";
1759 lpargs[++i] = dash_o;
1761 lpargs[++i] = dash_o;
1764 lpargs[++i] = media.
data();
1768 char **lprargs =
new char *[lprhack.
size()+2];
1771 for (
int i = 0; i < lprhack.
size(); ++i)
1772 lprargs[i+1] = (
char *)lprhack[i].constData();
1773 lprargs[lprhack.
size() + 1] = 0;
1774 (void)execvp(
"lp", lpargs);
1775 (void)execvp(
"lpr", lprargs);
1776 (void)execv(
"/bin/lp", lpargs);
1777 (void)execv(
"/bin/lpr", lprargs);
1778 (void)execv(
"/usr/bin/lp", lpargs);
1779 (void)execv(
"/usr/bin/lpr", lprargs);
1814 #if defined(Q_OS_WIN) && defined(_MSC_VER) && _MSC_VER >= 1400 1823 #if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) 1839 qWarning(
"Could not determine printer to print to");
1886 for (
int c = 0;
c < options.
size(); ++
c) {
1888 opt.name = options[
c].
first.data();
1889 opt.value = options[
c].second.data();
1890 cupsOptStruct.
append(opt);
1894 cups_option_t* optPtr = cupsOptStruct.
size() ? &cupsOptStruct.
first() : 0;
1916 bool noEmbed =
false;
1919 || (fe->
fsType == 2) ))) {
1921 q->QPaintEngine::drawTextItem(p, ti);
1942 size = fe->
tm.tmHeight;
1951 if (glyphs.
size() == 0)
1957 <<
"/F" << font->
object_id << size <<
"Tf " 1959 ?
"0 .3 -1 0 0 Tm\n" 1960 :
"0 0 -1 0 0 Tm\n");
1965 const unsigned short *logClusters = ti.
logClusters;
1969 while (end < ti.
num_chars && logClusters[end] == logClusters[pos])
1972 for (
int i = pos; i <
end; ++i) {
1978 int ge = end == ti.
num_chars ? ti.num_glyphs : logClusters[
end];
1979 for (
int gs = logClusters[pos]; gs < ge; ++gs)
1981 *currentPage <<
"> Tj\n" 1988 for (
int i = 0; i < glyphs.
size(); ++i) {
1989 qreal x = positions[i].x.toReal();
1990 qreal y = positions[i].y.toReal();
1996 *
currentPage << x - last_x << last_y - y <<
"Td <" 2003 ?
"0 .3 -1 0 0 Tm\n" 2004 :
"0 0 -1 0 0 Tm\n");
2005 *
currentPage <<
"/Span << /ActualText <> >> BDC\n";
2008 for (
int i = 0; i < glyphs.
size(); ++i) {
2009 qreal x = positions[i].x.toReal();
2010 qreal y = positions[i].y.toReal();
2016 *currentPage << x - last_x << last_y - y <<
"Td <" 2021 *currentPage <<
"EMC\n";
2036 #if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) 2052 return QRect(0, 0, w, h);
2054 return QRect(0, 0, h, w);
2064 #if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) 2092 r =
QRect(x, y, w, h);
2094 r =
QRect(y, x, h, w);
ElementType type
the type of element
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
The QVariant class acts like a union for the most common Qt data types.
QPainterPath clipPath() const
Returns the currently clip as a path.
T qobject_cast(QObject *object)
virtual QFixed lineThickness() const
The QColor class provides colors based on RGB, HSV or CMYK values.
The QPainterPath::Element class specifies the position and type of a subpath.
bool isEmpty() const
Returns true if either there are no elements in this path, or if the only element is a MoveToElement;...
QPaintEngine::DirtyFlags state() const
Returns a combination of flags identifying the set of properties that need to be updated when updatin...
qreal y() const
Returns the y-coordinate of the rectangle's top edge.
void drawPath(const QPainterPath &path)
The default implementation ignores the path and does nothing.
virtual qint64 size() const
For open random-access devices, this function returns the size of the device.
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
static QPrinterInfo defaultPrinter()
Returns the default printer on the system.
bool isNull() const
Returns true if the rectangle is a null rectangle, otherwise returns false.
static QString fromLocal8Bit(const char *, int size=-1)
Returns a QString initialized with the first size characters of the 8-bit string str.
PaperSize paperSize(QPrinter::PaperSize paperSize)
qreal opacity() const
Returns the opacity in the current paint engine state.
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
#define QT_END_NAMESPACE
This macro expands to.
const QColor & color() const
Returns the brush color.
int availablePrintersCount() const
char * data()
Returns a pointer to the data stored in the byte array.
void setProperty(PrintEnginePropertyKey key, const QVariant &value)
Sets the print engine's property specified by key to the given value.
virtual void close()
First emits aboutToClose(), then closes the device and sets its OpenMode to NotOpen.
virtual void drawPath(const QPainterPath &path)
The default implementation ignores the path and does nothing.
void strokePath(const QPainterPath &path)
ushort unicode() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
QByteArray generateMatrix(const QTransform &matrix)
#define it(className, varName)
QPrinter::Orientation orientation
static int maxMemorySize()
Q_GUI_EXPORT_INLINE int qAlpha(QRgb rgb)
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
bool open(OpenMode flags)
Opens the file using OpenMode mode, returning true if successful; otherwise false.
QPaintEngineState * state
void setDashOffset(qreal offset)
Qt::PenStyle style() const
Returns the pen style.
qreal width() const
Returns the width.
virtual void drawRects(const QRect *rects, int rectCount)
The default implementation converts the first rectCount rectangles in the buffer rects to a QRectF an...
PrinterMode
This enum describes the mode the printer should work in.
void setupGraphicsState(QPaintEngine::DirtyFlags flags)
T & first()
Returns a reference to the first item in the vector.
The QByteArray class provides an array of bytes.
QTransform transform() const
Returns the matrix in the current paint engine state.
The QTemporaryFile class is an I/O device that operates on temporary files.
void setStrokeWidth(qfixed width)
QString & prepend(QChar c)
The QPointF class defines a point in the plane using floating point precision.
qreal height() const
Returns the height.
virtual qint64 pos() const
For random-access devices, this function returns the position that data is written to or read from...
void closeSubpath()
Closes the current subpath by drawing a line to the beginning of the subpath, automatically starting ...
virtual int synthesized() const
QPainterPath subtracted(const QPainterPath &r) const
Returns a path which is p's fill area subtracted from this path's fill area.
QPainterPath intersected(const QPainterPath &r) const
Returns a path which is the intersection of this path's fill area and p's fill area.
Orientation
This enum type (not to be confused with Orientation) is used to specify each page's orientation...
QString toString() const
Returns the variant as a QString if the variant has type() String , Bool , ByteArray ...
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the list.
int left() const
Returns the x-coordinate of the rectangle's left edge.
int width() const
Returns the width of the rectangle.
QList< QVariant > toList() const
Returns the variant as a QVariantList if the variant has type() List or StringList ; otherwise return...
bool open()
A QTemporaryFile will always be opened in QIODevice::ReadWrite mode, this allows easy access to the d...
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
bool toBool() const
Returns the variant as a bool if the variant has type() Bool.
void setJoinStyle(Qt::PenJoinStyle style)
const unsigned short * logClusters
QVariant property(PrintEnginePropertyKey key) const
Returns the print engine's property specified by key.
The QBuffer class provides a QIODevice interface for a QByteArray.
int height() const
Returns the height of the rectangle.
QByteArray generateDashes(const QPen &pen)
qreal y
the y coordinate of the element's position.
bool isClipEnabled() const
Returns whether clipping is enabled or not in the current paint engine state.
The QString class provides a Unicode character string.
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 point...
QPdfBaseEnginePrivate(QPrinter::PrinterMode m)
const char * paperSizeToString(QPrinter::PaperSize paperSize)
void setDashPattern(const QVector< qfixed > &dashPattern)
const cups_dest_t * availablePrinters() const
ByteStream(bool fileBacking=false)
static bool isAvailable()
The QPen class defines how a QPainter should draw lines and outlines of shapes.
virtual bool atEnd() const
Returns true if the current read and write position is at the end of the device (i.e.
virtual Type type() const =0
The QSizeF class defines the size of a two-dimensional object using floating point precision...
void moveTo(const QPointF &p)
Moves the current point to the given point, implicitly starting a new subpath and closing the previou...
QVector< qreal > dashPattern() const
Returns the dash pattern of this pen.
const QPainterPath::Element & elementAt(int i) const
Returns the element at the given index in the painter path.
const T value(const Key &key) const
Returns the value associated with the key.
Q_CORE_EXPORT QTextStream & hex(QTextStream &s)
static const char *const psToStr[QPrinter::NPaperSize+1]
void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
Reimplement this virtual function to draw the polygon defined by the pointCount first points in point...
void setCubicToHook(qStrokerCubicToHook cubicToHook)
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Q_GUI_EXPORT_INLINE int qRed(QRgb rgb)
qreal x() const
Returns the x-coordinate of this point.
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
The QLineF class provides a two-dimensional vector using floating point precision.
int toInt(bool *ok=0) const
Returns the variant as an int if the variant has type() Int , Bool , ByteArray , Char ...
qint64 read(char *data, qint64 maxlen)
Reads at most maxSize bytes from the device into data, and returns the number of bytes read...
const char * qt_real_to_string(qreal val, char *buf)
void drawRects(const QRectF *rects, int rectCount)
Draws the first rectCount rectangles in the buffer rects.
void setPen(const QPen &pen)
void lineTo(const QPointF &p)
Adds a straight line from the current position to the given endPoint.
QGradientStops stops() const
Returns the stop points for this gradient.
void setFillRule(Qt::FillRule fillRule)
Sets the fill rule of the painter path to the given fillRule.
static void moveToHook(qfixed x, qfixed y, void *data)
bool newPage()
Instructs the print engine to start a new page.
friend class const_iterator
static char toHex(quint8 c)
QStringList toStringList() const
Returns the variant as a QStringList if the variant has type() StringList, String ...
void append(const T &t)
Inserts value at the end of the list.
DuplexMode
This enum is used to indicate whether printing will occur on one or both sides of each sheet of paper...
void drawTextItem(const QPointF &p, const QTextItem &textItem)
This function draws the text item textItem at position p.
QPainter * painter() const
Returns the paint engine's painter.
bool begin(QPaintDevice *pdev)
Reimplement this function to initialise your paint engine when painting is to start on the paint devi...
#define QT_BEGIN_NAMESPACE
This macro expands to.
QBrush brush() const
Returns the brush in the current paint engine state.
The QRectF class defines a rectangle in the plane using floating point precision. ...
void strokePath(const QPainterPath &path, void *data, const QTransform &matrix)
Convenience function that decomposes path into begin(), moveTo(), lineTo(), curevTo() and end() calls...
bool end()
Reimplement this function to finish painting on the current paint device.
Qt::ClipOperation clipOperation() const
Returns the clip operation in the current paint engine state.
QPointF brushOrigin() const
Returns the brush origin in the current paint engine state.
bool isCosmetic() const
Returns true if the pen is cosmetic; otherwise returns false.
int printFile(const char *printerName, const char *filename, const char *title, int num_options, cups_option_t *options)
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
static const QCssKnownValue positions[NumKnownPositionModes - 1]
Qt::PenJoinStyle joinStyle() const
Returns the pen's join style.
qreal height() const
Returns the height of the rectangle.
The QPrinter class is a paint device that paints on a printer.
void setCapStyle(Qt::PenCapStyle capStyle)
const T & at(int i) const
Returns the item at index position i in the list.
The QStringList class provides a list of strings.
void adjust(int x1, int y1, int x2, int y2)
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
static const char * pattern_for_brush[]
void getGlyphPositions(const QGlyphLayout &glyphs, const QTransform &matrix, QTextItem::RenderFlags flags, QVarLengthArray< glyph_t > &glyphs_out, QVarLengthArray< QFixedPoint > &positions)
void append(const T &t)
Inserts value at the end of the vector.
Q_CORE_EXPORT void qWarning(const char *,...)
int metric(QPaintDevice::PaintDeviceMetric metricType) const
Returns the metric for the given id.
static int qt_safe_dup2(int oldfd, int newfd, int flags=FD_CLOEXEC)
static const char * data(const QByteArray &arr)
static int qt_safe_pipe(int pipefd[2], int flags=0)
void addRect(const QRectF &rect)
Adds the given rectangle to this path as a closed subpath.
QPair< int, QString > tempFd()
qreal width() const
Returns the width of the rectangle.
Q_AUTOTEST_EXPORT QPainterPath qt_regionToPath(const QRegion ®ion)
The QRegion class specifies a clip region for a painter.
QPainterPath clipPath() const
Returns the clip path in the current paint engine state.
virtual FaceId faceId() const
Qt::FillRule fillRule() const
Returns the painter path's currently set fill rule.
Qt::BrushStyle style() const
Returns the brush style.
QPrinter::DuplexMode duplex
bool isOpaque() const
Returns true if the brush is fully opaque otherwise false.
QSizeF qt_paperSizeToQSizeF(QPrinter::PaperSize size)
static void closeAllOpenFds()
QByteArray toLocal8Bit() const Q_REQUIRED_RESULT
Returns the local 8-bit representation of the string as a QByteArray.
Q_GUI_EXPORT_INLINE int qBlue(QRgb rgb)
QPointF start() const
Returns the start point of this linear gradient in logical coordinates.
Q_CORE_EXPORT bool qIsNaN(double d)
Returns true if the double {d} is not a number (NaN).
QHash< QFontEngine::FaceId, QFontSubset * > fonts
const T & at(int i) const
Returns the item at index position i in the vector.
virtual bool isSequential() const
Returns true if this device is sequential; otherwise returns false.
bool hasCustomPageMargins
const char * toHex(ushort u, char *buffer)
Spread
Specifies how the area outside the gradient area should be filled.
int length() const
Same as size().
void drawPoints(const QPointF *points, int pointCount)
Draws the first pointCount points in the buffer points.
QSizeF toSizeF() const
Returns the variant as a QSizeF if the variant has type() SizeF ; otherwise returns an invalid QSizeF...
T & first()
Returns a reference to the first item in the list.
const char * constData() const
Returns a pointer to the data stored in the byte array.
The QPrinterInfo class gives access to information about existing printers.
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Q_GUI_EXPORT_INLINE int qGray(int r, int g, int b)
QString printerName() const
Returns the name of the printer.
Q_CORE_EXPORT void qFatal(const char *,...)
int top() const
Returns the y-coordinate of the rectangle's top edge.
virtual void drawTextItem(const QPointF &p, const QTextItemInt &ti)
QPrinter::PaperSize paperSize
#define PPK_CupsStringPageSize
The QFile class provides an interface for reading from and writing to files.
The QLinearGradient class is used in combination with QBrush to specify a linear gradient brush...
static void cubicToHook(qfixed c1x, qfixed c1y, qfixed c2x, qfixed c2y, qfixed ex, qfixed ey, void *data)
void clear()
Clears the contents of the string and makes it empty.
qreal x() const
Returns the x-coordinate of the rectangle's left edge.
QRect toRect() const
Returns the variant as a QRect if the variant has type() Rect ; otherwise returns an invalid QRect...
Q_GUI_EXPORT int qt_defaultDpi()
qreal miterLimit() const
Returns the miter limit of the pen.
void setMiterLimit(qfixed length)
PaperSize
This enum type specifies what paper size QPrinter should use.
QVector< QRect > rects() const
Returns an array of non-overlapping rectangles that make up the region.
QByteArray patternForBrush(const QBrush &b)
void resize(int size)
Sets the size of the byte array to size bytes.
int size() const
Returns the number of items in the list.
static void lineToHook(qfixed x, qfixed y, void *data)
ColorMode
This enum type is used to indicate whether QPrinter should print in color or not. ...
qreal widthF() const
Returns the pen width with floating point precision.
The QRect class defines a rectangle in the plane using integer precision.
bool continueCall() const
#define Q_AUTOTEST_EXPORT
virtual bool reset()
Seeks to the start of input for random-access devices.
Spread spread() const
Returns the spread method use by this gradient.
void constructor_helper(QIODevice *dev)
bool isNull() const
Returns whether this QPrinterInfo object holds a printer definition.
int size() const
Returns the number of bytes in this byte array.
bool contains(const T &t) const
Returns true if the vector contains an occurrence of value; otherwise returns false.
qreal x
the x coordinate of the element's position.
virtual bool open(OpenMode mode)
Opens the device and sets its OpenMode to mode.
qreal y() const
Returns the y-coordinate of this point.
bool remove()
Removes the file specified by fileName().
PageOrder
This enum type is used by QPrinter to tell the application program how to print.
Q_GUI_EXPORT_INLINE int qGreen(QRgb rgb)
QRegion clipRegion() const
Returns the clip region in the current paint engine state.
qreal dashOffset() const
Returns the dash offset for the pen.
#define PPK_CupsPaperRect
The QPaintEngineState class provides information about the active paint engine's current state...
void setLineToHook(qStrokerLineToHook lineToHook)
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
bool isEmpty() const
Returns true if the vector has size 0; otherwise returns false.
QStringList split(const QString &sep, SplitBehavior behavior=KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const Q_REQUIRED_RESULT
Splits the string into substrings wherever sep occurs, and returns the list of those strings...
void drawLines(const QLineF *lines, int lineCount)
The default implementation splits the list of lines in lines into lineCount separate calls to drawPat...
int elementCount() const
Returns the number of path elements in the painter path.
const char * qt_int_to_string(int val, char *buf)
virtual void drawTextItem(const QPointF &p, const QTextItem &textItem)
This function draws the text item textItem at position p.
QPen pen() const
Returns the pen in the current paint engine state.
QString cupsStringPageSize
void setMoveToHook(qStrokerMoveToHook moveToHook)
FileError error() const
Returns the file error status.
qint64 write(const char *data, qint64 len)
Writes at most maxSize bytes of data from data to the device.
virtual void updateState(const QPaintEngineState &state)
Reimplement this function to update the state of a paint engine.
The QTextItem class provides all the information required to draw text in a custom paint engine...
Qt::PenCapStyle capStyle() const
Returns the pen's cap style.
QRegion alphaClipping() const
QByteArray generatePath(const QPainterPath &path, const QTransform &matrix, PathFlags flags)
static const KeyPair *const end
ByteStream & operator<<(char chr)
The QIODevice class is the base interface class of all I/O devices in Qt.
void updateState(const QPaintEngineState &state)
Reimplement this function to update the state of a paint engine.
virtual bool seek(qint64 pos)
For random-access devices, this function sets the current position to pos, returning true on success...
Q_OUTOFLINE_TEMPLATE void qDeleteAll(ForwardIterator begin, ForwardIterator end)
int size() const
Returns the number of items in the vector.
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
static pid_t qt_safe_waitpid(pid_t pid, int *status, int options)
Q_DECL_CONSTEXPR int qRound(qreal d)
void clear()
Clears the contents of the byte array and makes it empty.
virtual void setBrush()=0
int open(const char *, int,...)
QPdfBaseEngine(QPdfBaseEnginePrivate &d, PaintEngineFeatures f)
QPointF finalStop() const
Returns the final stop point of this linear gradient in logical coordinates.
PaperSource
This enum type specifies what paper source QPrinter is to use.
QByteArray ascii85Encode(const QByteArray &input)
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the list...
PrintEnginePropertyKey
This enum is used to communicate properties between the print engine and QPrinter.
void updateClipPath(const QPainterPath &path, Qt::ClipOperation op)
virtual void drawTextItem(const QPointF &p, const QTextItem &textItem)
This function draws the text item textItem at position p.