Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qpicture.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QPICTURE_H
6#define QPICTURE_H
7
8#include <QtGui/qtguiglobal.h>
9#include <QtCore/qiodevice.h>
10#include <QtCore/qshareddata.h>
11#include <QtCore/qstringlist.h>
12#include <QtGui/qpaintdevice.h>
13
15
16#ifndef QT_NO_PICTURE
17
18class QPicturePrivate;
19class Q_GUI_EXPORT QPicture : public QPaintDevice
20{
21 Q_DECLARE_PRIVATE(QPicture)
22public:
23 explicit QPicture(int formatVersion = -1);
24 QPicture(const QPicture &);
25 ~QPicture();
26
27 bool isNull() const;
28
29 int devType() const override;
30 uint size() const;
31 const char* data() const;
32 virtual void setData(const char* data, uint size);
33
34 bool play(QPainter *p);
35
36 bool load(QIODevice *dev);
37 bool load(const QString &fileName);
38 bool save(QIODevice *dev);
39 bool save(const QString &fileName);
40
41 QRect boundingRect() const;
42 void setBoundingRect(const QRect &r);
43
44 QPicture& operator=(const QPicture &p);
45 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPicture)
46 inline void swap(QPicture &other) noexcept
47 { d_ptr.swap(other.d_ptr); }
48 void detach();
49 bool isDetached() const;
50
51 friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &in, const QPicture &p);
52 friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &in, QPicture &p);
53
54 QPaintEngine *paintEngine() const override;
55
56protected:
57 QPicture(QPicturePrivate &data);
58
59 int metric(PaintDeviceMetric m) const override;
60
61private:
62 bool exec(QPainter *p, QDataStream &ds, int i);
63
64 QExplicitlySharedDataPointer<QPicturePrivate> d_ptr;
65 friend class QPicturePaintEngine;
66 friend class QAlphaPaintEngine;
67 friend class QPreviewPaintEngine;
68
69public:
70 typedef QExplicitlySharedDataPointer<QPicturePrivate> DataPtr;
71 inline DataPtr &data_ptr() { return d_ptr; }
72};
73
75
76/*****************************************************************************
77 QPicture stream functions
78 *****************************************************************************/
79
80#ifndef QT_NO_DATASTREAM
81Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPicture &);
82Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPicture &);
83#endif
84
85#endif // QT_NO_PICTURE
86
87QT_END_NAMESPACE
88
89#endif // QPICTURE_H
\inmodule QtCore\reentrant
Definition qdatastream.h:50
void updateOpacity(qreal opacity)
void drawImage(const QRectF &r, const QImage &image, const QRectF &sr, Qt::ImageConversionFlags flags=Qt::AutoColor) override
Reimplement this function to draw the part of the image specified by the sr rectangle in the given re...
void updateMatrix(const QTransform &matrix)
void updatePen(const QPen &pen)
void drawPolygon(const QPointF *points, int numPoints, PolygonDrawMode mode) override
Reimplement this virtual function to draw the polygon defined by the pointCount first points in point...
void updateClipRegion(const QRegion &region, Qt::ClipOperation op)
void drawPath(const QPainterPath &path) override
The default implementation ignores the path and does nothing.
void drawTextItem(const QPointF &p, const QTextItem &ti) override
This function draws the text item textItem at position p.
QPicturePaintEngine(QPaintEnginePrivate &dptr)
void updateBrushOrigin(const QPointF &origin)
void updateFont(const QFont &font)
void updateCompositionMode(QPainter::CompositionMode cmode)
void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s) override
Reimplement this function to draw the pixmap in the given rect, starting at the given p.
void updateClipEnabled(bool enabled)
void updateState(const QPaintEngineState &state) override
Reimplement this function to update the state of a paint engine.
bool end() override
Reimplement this function to finish painting on the current paint device.
void updateBrush(const QBrush &brush)
void drawEllipse(const QRectF &rect) override
Reimplement this function to draw the largest ellipse that can be contained within rectangle rect.
void updateClipPath(const QPainterPath &path, Qt::ClipOperation op)
void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override
Reimplement this function to draw the part of the pm specified by the sr rectangle in the given r.
void updateRenderHints(QPainter::RenderHints hints)
void updateBackground(Qt::BGMode bgmode, const QBrush &bgBrush)
Type type() const override
Reimplement this function to return the paint engine \l{Type}.
bool begin(QPaintDevice *pdev) override
Reimplement this function to initialise your paint engine when painting is to start on the paint devi...
The QPicture class is a paint device that records and replays QPainter commands.
Definition qpicture.h:20
The QPolygonF class provides a list of points using floating point precision.
Definition qpolygon.h:97
Combined button and popup list for selecting options.
#define SERIALIZE_CMD(c)