42 #include "qplatformdefs.h" 44 #include <private/qprintengine_ps_p.h> 45 #include <private/qpainter_p.h> 46 #include <private/qfontengine_p.h> 47 #include <private/qpaintengine_p.h> 48 #include <private/qpdf_p.h> 67 #include <private/qpainterpath_p.h> 69 #include <private/qdrawhelper_p.h> 70 #include <private/qmutexpool_p.h> 88 "/BD{bind def}bind def/d2{dup dup}BD/ED{exch def}BD/D0{0 ED}BD/F{setfont}BD\n" 89 "/RL{rlineto}BD/CM{currentmatrix}BD/SM{setmatrix}BD/TR{translate}BD/SD\n" 90 "{setdash}BD/SC{aload pop setrgbcolor}BD/CR{currentfile read pop}BD/i{index}\n" 91 "BD/scs{setcolorspace}BD/DB{dict dup begin}BD/DE{end def}BD/ie{ifelse}BD/gs\n" 92 "{gsave}BD/gr{grestore}BD/w{setlinewidth}BD/d{setdash}BD/J{setlinecap}BD/j\n" 93 "{setlinejoin}BD/scn{3 array astore/BCol exch def}BD/SCN{3 array astore/PCol\n" 94 "exch def}BD/cm{6 array astore concat}BD/m{moveto}BD/l{lineto}BD/c{curveto}BD\n" 95 "/h{closepath}BD/W{clip}BD/W*{eoclip}BD/n{newpath}BD/q{gsave 10 dict begin}BD\n" 96 "/Q{end grestore}BD/re{4 2 roll m dup 0 exch RL exch 0 RL 0 exch neg RL h}BD\n" 97 "/S{gs PCol SC stroke gr n}BD/BT{gsave 10 dict begin/_m matrix CM def BCol\n" 98 "SC}BD/ET{end grestore}BD/Tf{/_fs ED findfont[_fs 0 0 _fs 0 0]makefont F}BD\n" 99 "/Tm{6 array astore concat}BD/Td{translate}BD/Tj{0 0 m show}BD/BDC{pop pop}BD\n" 100 "/EMC{}BD/BSt 0 def/WFi false def/BCol[1 1 1]def/PCol[0 0 0]def/BDArr[0.94\n" 101 "0.88 0.63 0.50 0.37 0.12 0.06]def/level3{/languagelevel where{pop\n" 102 "languagelevel 3 ge}{false}ie}BD/QCIgray D0/QCIcolor D0/QCIindex D0/QCI{\n" 103 "/colorimage where{pop false 3 colorimage}{exec/QCIcolor ED/QCIgray QCIcolor\n" 104 "length 3 idiv string def 0 1 QCIcolor length 3 idiv 1 sub{/QCIindex ED/_x\n" 105 "QCIindex 3 mul def QCIgray QCIindex QCIcolor _x get 0.30 mul QCIcolor _x 1\n" 106 "add get 0.59 mul QCIcolor _x 2 add get 0.11 mul add add cvi put}for QCIgray\n" 107 "image}ie}BD/di{gs TR 1 i 1 eq{pop pop false 3 1 roll BCol SC imagemask}{dup\n" 108 "false ne{level3}{false}ie{/_ma ED 8 eq{/_dc[0 1]def/DeviceGray}{/_dc[0 1 0 1\n" 109 "0 1]def/DeviceRGB}ie scs/_im ED/_mt ED/_h ED/_w ED <</ImageType 3/DataDict\n" 110 "<</ImageType 1/Width _w/Height _h/ImageMatrix _mt/DataSource _im\n" 111 "/BitsPerComponent 8/Decode _dc >>/MaskDict <</ImageType 1/Width _w/Height _h\n" 112 "/ImageMatrix _mt/DataSource _ma/BitsPerComponent 1/Decode[0 1]>>\n" 113 "/InterleaveType 3 >> image}{pop 8 4 1 roll 8 eq{image}{QCI}ie}ie}ie gr}BD/BF\n" 114 "{gs BSt 1 eq{BCol SC WFi{fill}{eofill}ie}if BSt 2 ge BSt 8 le and{BDArr BSt\n" 115 "2 sub get/_sc ED BCol{1. exch sub _sc mul 1. exch sub}forall 3 array astore\n" 116 "SC WFi{fill}{eofill}ie}if BSt 9 ge BSt 14 le and{WFi{W}{W*}ie pathbbox 3 i 3\n" 117 "i TR 4 2 roll 3 2 roll exch sub/_h ED sub/_w ED BCol SC 0.3 w n BSt 9 eq BSt\n" 118 "11 eq or{0 4 _h{dup 0 exch m _w exch l}for}if BSt 10 eq BSt 11 eq or{0 4 _w{\n" 119 "dup 0 m _h l}for}if BSt 12 eq BSt 14 eq or{_w _h gt{0 6 _w _h add{dup 0 m _h\n" 120 "sub _h l}for}{0 6 _w _h add{dup 0 exch m _w sub _w exch l}for}ie}if BSt 13\n" 121 "eq BSt 14 eq or{_w _h gt{0 6 _w _h add{dup _h m _h sub 0 l}for}{0 6 _w _h\n" 122 "add{dup _w exch m _w sub 0 exch l}for}ie}if stroke}if BSt 15 eq{}if BSt 24\n" 123 "eq{}if gr}BD/f{/WFi true def BF n}BD/f*{/WFi false def BF n}BD/B{/WFi true\n" 124 "def BF S n}BD/B*{/WFi false def BF S n}BD/QI{/C save def pageinit q n}BD/QP{\n" 125 "Q C restore showpage}BD/SPD{/setpagedevice where{<< 3 1 roll >>\n" 126 "setpagedevice}{pop pop}ie}BD/T1AddMapping{10 dict begin/glyphs ED/fnt ED\n" 127 "/current fnt/NumGlyphs get def/CMap fnt/CMap get def 0 1 glyphs length 1 sub\n" 128 "{glyphs exch get/gn ED current dup 256 mod/min ED 256 idiv/maj ED CMap dup\n" 129 "maj get dup null eq{pop 256 array 0 1 255{1 i exch/.notdef put}for}if dup\n" 130 "min gn put maj exch put/current current 1 add def}for fnt/CMap CMap put fnt\n" 131 "/NumGlyphs current put end}def/T1AddGlyphs{10 dict begin/glyphs ED/fnt ED\n" 132 "/current fnt/NumGlyphs get def/CMap fnt/CMap get def/CharStrings fnt\n" 133 "/CharStrings get def 0 1 glyphs length 2 idiv 1 sub{2 mul dup glyphs exch\n" 134 "get/gn ED 1 add glyphs exch get/cs ED current dup 256 mod/min ED 256 idiv\n" 135 "/maj ED CMap dup maj get dup null eq{pop 256 array 0 1 255{1 i exch/.notdef\n" 136 "put}for}if dup min gn put maj exch put CharStrings gn cs put/current current\n" 137 "1 add def}for fnt/CharStrings CharStrings put fnt/CMap CMap put fnt\n" 138 "/NumGlyphs current put end}def/StringAdd{1 i length 1 i length add string 3\n" 139 "1 roll 2 i 0 3 i putinterval 2 i 2 i length 2 i putinterval pop pop}def\n" 140 "/T1Setup{10 dict begin dup/FontName ED (-Base) StringAdd cvx cvn/Font ED\n" 141 "/MaxPage Font/NumGlyphs get 1 sub 256 idiv def/FDepVector MaxPage 1 add\n" 142 "array def/Encoding MaxPage 1 add array def 0 1 MaxPage{dup Encoding exch dup\n" 143 "put dup/Page ED FontName (-) StringAdd exch 20 string cvs StringAdd cvn Font\n" 144 "0 dict copy d2/CMap get Page get/Encoding exch put definefont FDepVector\n" 145 "exch Page exch put}for FontName cvn <</FontType 0/FMapType 2/FontMatrix[1 0\n" 146 "0 1 0 0]/Encoding Encoding/FDepVector FDepVector >> definefont pop end}def\n";
156 const int wrapAt = 254;
158 if (dsc.
length() < wrapAt)
161 wrapped = dsc.
left(wrapAt);
163 while (tmp.
length() > wrapAt-3) {
164 wrapped +=
"\n%%+" + tmp.
left(wrapAt-3);
165 tmp = tmp.
mid(wrapAt-3);
167 wrapped +=
"\n%%+" + tmp;
169 return wrapped +
'\n';
176 printerState(
QPrinter::Idle), hugeDocument(false), headerDone(false)
183 #ifndef QT_NO_SETTINGS 207 line[col++] = s[i++];
208 if (i < l - 1 && col >= 76) {
211 stream << (
const char *)line;
220 stream << (
const char *)line;
249 state = (last == data[i]) ?
Equal : Diff;
256 if (data[i] == last) {
262 if (flush || i - start == 128) {
263 int size = i - start;
264 if (state ==
Equal) {
271 out.
append(data[start++]);
276 if (i == input.
size())
293 "/RunLengthDecode filter ",
301 int depth = image.
depth();
312 int width = image.
width();
313 int height = image.
height();
314 int size = width*height;
317 size = (width+7)/8*height;
326 memset(pixel, 0xff, size);
327 for(
int y=0; y < height; y++) {
329 for(
int x=0; x < width; x++) {
332 (*(s + (x >> 3)) >> (x & 7)) & 1 :
333 (*(s + (x >> 3)) << (x & 7)) & 0x80 ;
335 pixel[i >> 3] ^= (0x80 >> (i & 7));
339 i = (i+7) & 0xffffff8;
341 }
else if (depth == 8) {
342 for(
int y=0; y < height; y++) {
344 for(
int x=0; x < width; x++) {
347 pixel[i] = (
unsigned char)
qGray(rgb);
350 pixel[i] = (
unsigned char)
qRed(rgb);
351 pixel[i+1] = (
unsigned char)
qGreen(rgb);
352 pixel[i+2] = (
unsigned char)
qBlue(rgb);
358 for(
int y=0; y < height; y++) {
360 for(
int x=0; x < width; x++) {
363 pixel[i] = (
unsigned char)
qGray(rgb);
366 pixel[i] = (
unsigned char)
qRed(rgb);
367 pixel[i+1] = (
unsigned char)
qGreen(rgb);
368 pixel[i+2] = (
unsigned char)
qBlue(rgb);
389 int width = img.
width();
390 int height = img.
height();
399 size = (width+7)/8*height;
400 *
currentPage <<
"/mask currentfile/ASCII85Decode filter" 402 << size <<
" string readstring\n";
406 if (img.
depth() == 1) {
407 size = (width+7)/8*height;
413 size = width*height*3;
419 *
currentPage <<
"/sl currentfile/ASCII85Decode filter" 421 << size <<
" string readstring\n";
424 *currentPage << width <<
' ' << height <<
'[' << scaleX <<
" 0 0 " << scaleY <<
" 0 0]sl " 425 << bits << (!mask.
isNull() ?
"mask " :
"false ")
426 << x <<
' ' << y <<
" di\n";
433 if (!w || !h || image.
isNull())
return;
444 int width = img.
width();
445 int height = img.
height();
446 qreal scaleX = width/w;
447 qreal scaleY = height/h;
450 int splitSize = 21830 * (gray ? 3 : 1);
451 if (width * height > splitSize) {
452 int images, subheight;
453 images = (width * height + splitSize - 1) / splitSize;
454 subheight = (height + images-1) / images;
455 while (subheight * width > splitSize) {
457 subheight = (height + images-1) / images;
460 const QImage constImg(img);
461 const QImage constMask(mask);
462 while(suby < height) {
463 qreal subImageHeight =
qMin(subheight, height-suby);
464 const QImage subImage(constImg.
scanLine(suby), width, subImageHeight,
469 subImage, subMask, gray, scaleX, scaleY);
491 int mtop = pageRect.
top() - paperRect.
top();
492 int mleft = pageRect.
left() - paperRect.
left();
494 int mright = paperRect.
right() - pageRect.
right();
495 int width = pageRect.
width();
496 int height = pageRect.
height();
502 s <<
"%!PS-Adobe-3.0";
508 s <<
" EPSF-3.0\n%%BoundingBox: " 516 s <<
" EPSF-3.0\n%%BoundingBox: " 523 s <<
"%!PS-Adobe-1.0";
524 int w = width + (
fullPage ? 0 : mleft + mright);
525 int h = height + (
fullPage ? 0 : mtop + mbottom);
530 s <<
"\n%%BoundingBox: 0 0 " << h << w;
532 s <<
"\n%%BoundingBox: 0 0 " << w << h;
537 #ifndef QT_NO_DATESTRING 540 s <<
"\n%%Orientation: ";
546 s <<
"\n%%Pages: (atend)" 547 "\n%%DocumentFonts: (atend)" 551 "% Prolog copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).\n" 552 "% You may copy this prolog in any way that is directly related to this document.\n" 553 "% For other use of this prolog, see your licensing agreement for Qt.\n" 557 s <<
"/pageinit {\n";
560 s << mleft*scale << mbottom*scale <<
"translate\n";
562 s << mtop*scale << mleft*scale <<
"translate\n";
566 <<
"mm (portrait)\n0 " << height*scale
567 <<
"translate " << scale <<
'-' << scale <<
"scale } def\n";
570 <<
" mm (landscape)\n 90 rotate " << scale <<
'-' << scale <<
"scale } def\n";
572 s <<
"%%EndProlog\n";
589 while (!content->
atEnd()) {
596 while (!content->
atEnd()) {
630 if ((*it)->downloaded_glyphs == 0) {
631 buffer << (*it)->toType1();
632 (*it)->downloaded_glyphs = 0;
634 buffer << (*it)->type1AddedGlyphs();
642 buffer <<
"%%EndPageSetup\nq\n";
674 static struct sigaction *users_sigpipe_handler = 0;
675 static int lockCount = 0;
685 if (users_sigpipe_handler != 0)
688 users_sigpipe_handler =
new struct sigaction;
690 tmp_sigpipe_handler.sa_handler = SIG_IGN;
691 sigemptyset(&tmp_sigpipe_handler.sa_mask);
692 tmp_sigpipe_handler.sa_flags = 0;
694 if (
sigaction(SIGPIPE, &tmp_sigpipe_handler, users_sigpipe_handler) == -1) {
695 delete users_sigpipe_handler;
696 users_sigpipe_handler = 0;
703 if (users_sigpipe_handler == 0)
706 if (
sigaction(SIGPIPE, users_sigpipe_handler, 0) == -1)
707 qWarning(
"QPSPrintEngine: Could not restore SIGPIPE handler");
709 delete users_sigpipe_handler;
710 users_sigpipe_handler = 0;
720 #if defined(Q_OS_WIN) && defined(_MSC_VER) && _MSC_VER >= 1400 734 if (
d->useAlphaEngine) {
751 d->clipEnabled =
false;
752 d->allClipped =
false;
755 d->hugeDocument =
false;
756 d->simplePen =
false;
770 if (
d->useAlphaEngine) {
783 "%%Pages: " <<
d->pageCount - 1 <<
'\n' <<
784 wrapDSC(
"%%DocumentFonts: " +
d->fontsUsed);
786 d->outDevice->write(trailer);
792 d->headerDone =
false;
806 int gStateObject = 0;
807 int patternObject =
d->addBrushPattern(brush,
d->stroker.matrix, brushOrigin, &specifyColor, &gStateObject);
809 *
d->currentPage << (patternObject ?
"/PCSp cs " :
"/CSp cs ");
811 QColor rgba = brush.color();
812 *
d->currentPage << rgba.
redF()
817 *
d->currentPage <<
"/Pat" << patternObject;
818 *
d->currentPage <<
"scn\n";
820 QColor rgba =
d->brush.color();
823 *
d->currentPage << gray << gray <<
gray;
825 *
d->currentPage << rgba.
redF()
829 *
d->currentPage <<
"scn\n" 830 <<
"/BSt " <<
d->brush.style() <<
"def\n";
836 if (
d->clipEnabled &&
d->allClipped)
838 if (bitmap && image.
depth() != 1)
843 if (!
d->useAlphaEngine && !bitmap) {
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);
856 *
d->currentPage <<
"q\n";
860 if (image.
depth() == 1) {
862 d->brush =
d->pen.brush();
866 *
d->currentPage <<
"Q\n";
872 Qt::ImageConversionFlags)
876 if (
d->useAlphaEngine) {
889 if (
d->useAlphaEngine) {
903 if (
d->useAlphaEngine) {
909 if (
d->clipEnabled &&
d->allClipped)
914 while(yPos < r.
y() + r.
height()) {
916 if (yPos + drawH > r.
y() + r.
height())
917 drawH = r.
y() + r.
height() - yPos;
920 while(xPos < r.
x() + r.
width()) {
922 if (xPos + drawW > r.
x() + r.
width())
923 drawW = r.
x() + r.
width() - xPos;
926 QRectF(xOff, yOff, drawW, drawH).toRect());
940 if (!
d->firstPage &&
d->useAlphaEngine)
948 d->firstPage =
false;
951 delete d->currentPage;
953 d->stroker.stream =
d->currentPage;
967 return d->printerState;
972 #endif // QT_NO_PRINTER The QColor class provides colors based on RGB, HSV or CMYK values.
Format
The following image formats are available in Qt.
qreal y() const
Returns the y-coordinate of the rectangle's top edge.
virtual qint64 size() const
For open random-access devices, this function returns the size of the device.
QImage copy(const QRect &rect=QRect()) const
Returns a sub-area of the image as a new image.
The QHash::const_iterator class provides an STL-style const iterator for QHash and QMultiHash...
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
Returns the value for setting key.
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...
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
#define QT_END_NAMESPACE
This macro expands to.
static QByteArray compressHelper(const QImage &image, bool gray, int *format)
int width() const
Returns the width of the pixmap.
char * data()
Returns a pointer to the data stored in the byte array.
QPSPrintEngine(QPrinter::PrinterMode m)
qreal greenF() const
Returns the green color component of this color.
QByteArray generateMatrix(const QTransform &matrix)
#define it(className, varName)
QPrinter::Orientation orientation
QByteArray & append(char c)
Appends the character ch to this byte array.
The QSettings class provides persistent platform-independent application settings.
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...
QByteArray toUtf8() const Q_REQUIRED_RESULT
Returns a UTF-8 representation of the string as a QByteArray.
virtual QPrinter::PrinterState printerState() const
Returns the current state of the printer being used by the print engine.
PrinterMode
This enum describes the mode the printer should work in.
bool isNull() const
Returns true if it is a null image, otherwise returns false.
QPSPrintEnginePrivate(QPrinter::PrinterMode m)
The QByteArray class provides an array of bytes.
virtual bool end()
Reimplement this function to finish painting on the current paint device.
The QPointF class defines a point in the plane using floating point precision.
static QByteArray wrapDSC(const QByteArray &str)
void beginGroup(const QString &prefix)
Appends prefix to the current group.
int left() const
Returns the x-coordinate of the rectangle's left edge.
void setQuality(int quality)
This is an image format specific function that sets the quality level of the image to quality...
int width() const
Returns the width of the rectangle.
#define QT_END_INCLUDE_NAMESPACE
This macro is equivalent to QT_BEGIN_NAMESPACE.
bool hasAlphaChannel() const
Returns true if the image has a format that respects the alpha channel, otherwise returns false...
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.
int bytesPerLine() const
Returns the number of bytes per image scanline.
static void ignoreSigPipe(bool b)
The QBuffer class provides a QIODevice interface for a QByteArray.
int height() const
Returns the height of the rectangle.
int bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
virtual bool end()
Reimplement this function to finish painting on the current paint device.
void emitHeader(bool finished)
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.
QString toString(Qt::DateFormat f=Qt::TextDate) const
Returns the datetime as a string in the format given.
Format format() const
Returns the format of the image.
virtual void drawImage(const QRectF &r, const QImage &image, const QRectF &sr)
Q_GUI_EXPORT_INLINE int qRed(QRgb rgb)
qreal x() const
Returns the x-coordinate of this point.
qint64 read(char *data, qint64 maxlen)
Reads at most maxSize bytes from the device into data, and returns the number of bytes read...
QByteArray simplified() const
Returns a byte array that has whitespace removed from the start and the end, and which has each seque...
bool newPage()
Instructs the print engine to start a new page.
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.
The QRectF class defines a rectangle in the plane using floating point precision. ...
QBool contains(const T &t) const
Returns true if the list contains an occurrence of value; otherwise returns false.
bool end()
Reimplement this function to finish painting on the current paint device.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
The QImageWriter class provides a format independent interface for writing images to files or other d...
void setActive(bool newState)
Sets the active state of the paint engine to state.
qreal height() const
Returns the height of the rectangle.
The QPrinter class is a paint device that paints on a printer.
virtual bool begin(QPaintDevice *pdev)
Reimplement this function to initialise your paint engine when painting is to start on the paint devi...
static const char *const ps_header
Q_CORE_EXPORT void qWarning(const char *,...)
The QImage class provides a hardware-independent image representation that allows direct access to th...
int metric(QPaintDevice::PaintDeviceMetric metricType) const
Returns the metric for the given id.
static const char * data(const QByteArray &arr)
#define QT_VERSION_STR
This macro expands to a string that specifies Qt's version number (for example, "4.
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
QImage createAlphaMask(Qt::ImageConversionFlags flags=Qt::AutoColor) const
Builds and returns a 1-bpp mask from the alpha buffer in this image.
qreal width() const
Returns the width of the rectangle.
int depth() const
Returns the depth of the image.
QByteArray left(int len) const
Returns a byte array that contains the leftmost len bytes of this byte array.
The State element defines configurations of objects and properties.
QByteArray mid(int index, int len=-1) const
Returns a byte array containing len bytes from this byte array, starting at position pos...
Q_GUI_EXPORT_INLINE int qBlue(QRgb rgb)
QRect toRect() const
Returns a QRect based on the values of this rectangle.
QHash< QFontEngine::FaceId, QFontSubset * > fonts
const T & at(int i) const
Returns the item at index position i in the vector.
static void ps_r7(QPdf::ByteStream &stream, const char *s, int l)
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 re...
QPrinter::ColorMode colorMode
int length() const
Same as size().
const char * constData() const
Returns a pointer to the data stored in the byte array.
The QBrush class defines the fill pattern of shapes drawn by QPainter.
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the hash.
Q_GUI_EXPORT_INLINE int qGray(int r, int g, int b)
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the hash...
void flushPage(bool last=false)
static const char *const filters[3]
int top() const
Returns the y-coordinate of the rectangle's top edge.
int width() const
Returns the width of the image.
The QMutexLocker class is a convenience class that simplifies locking and unlocking mutexes...
QImage convertToFormat(Format f, Qt::ImageConversionFlags flags=Qt::AutoColor) const Q_REQUIRED_RESULT
Returns a copy of the image in the given format.
int right() const
Returns the x-coordinate of the rectangle's right edge.
virtual void drawImageInternal(const QRectF &r, QImage img, bool bitmap)
qreal x() const
Returns the x-coordinate of the rectangle's left edge.
static const int max_in_memory_size
qreal redF() const
Returns the red color component of this color.
int sigaction(int, const struct sigaction *, struct sigaction *)
void setRect(int x, int y, int w, int h)
Sets the coordinates of the rectangle's top-left corner to ({x}, {y}), and its size to the given widt...
void resize(int size)
Sets the size of the byte array to size bytes.
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.
qreal blueF() const
Returns the blue color component of this color.
The QRect class defines a rectangle in the plane using integer precision.
bool continueCall() const
static QDateTime currentDateTime()
Returns the current datetime, as reported by the system clock, in the local time zone.
int height() const
Returns the height of the image.
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 y() const
Returns the y-coordinate of this point.
The QPixmap class is an off-screen image representation that can be used as a paint device...
void drawImageHelper(qreal x, qreal y, qreal w, qreal h, const QImage &img, const QImage &mask, bool gray, qreal scaleX, qreal scaleY)
Q_GUI_EXPORT_INLINE int qGreen(QRgb rgb)
#define QT_BEGIN_INCLUDE_NAMESPACE
This macro is equivalent to QT_END_NAMESPACE.
Q_CORE_EXPORT QTextStream & flush(QTextStream &s)
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...
int height() const
Returns the height of the pixmap.
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
QRgb rgba() const
Returns the RGB value of the color, including its alpha.
static QList< QByteArray > supportedImageFormats()
Returns the list of image formats supported by QImageWriter.
qint64 write(const char *data, qint64 len)
Writes at most maxSize bytes of data from data to the device.
void flushAndInit(bool init=true)
static QByteArray runlengthEncode(const QByteArray &input)
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...
QImage scaled(int w, int h, Qt::AspectRatioMode aspectMode=Qt::IgnoreAspectRatio, Qt::TransformationMode mode=Qt::FastTransformation) const
bool isValid() const
Returns true if the rectangle is valid, otherwise returns false.
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
void translate(int dx, int dy)
Moves the rectangle dx along the x axis and dy along the y axis, relative to the current position...
The QIODevice class is the base interface class of all I/O devices in Qt.
bool write(const QImage &image)
Writes the image image to the assigned device or file name.
void qt_generate_epsf(bool b)
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
void drawImage(qreal x, qreal y, qreal w, qreal h, const QImage &img, const QImage &mask)
int size() const
Returns the number of items in the vector.
virtual bool abort()
Instructs the print engine to abort the printing process.
static QByteArray number(int, int base=10)
Returns a byte array containing the string equivalent of the number n to base base (10 by default)...
static QMutex * globalInstanceGet(const void *address)
Returns a QMutex from the global mutex pool.
QRgb color(int i) const
Returns the color in the color table at index i.
void clear()
Clears the contents of the byte array and makes it empty.
uchar * scanLine(int)
Returns a pointer to the pixel data at the scanline with index i.
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...
bool allGray() const
Returns true if all the colors in the image are shades of gray (i.e.
QByteArray ascii85Encode(const QByteArray &input)
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...