CopperSpice API
1.9.2
|
The QPicture class is a paint device that records and replays QPainter commands. More...
Public Methods | |
QPicture (const QPicture &other) | |
QPicture (int formatVersion=-1) | |
~QPicture () | |
QRect | boundingRect () const |
const char * | data () const |
bool | isNull () const |
bool | load (const QString &fileName, const QString &format=QString ()) |
bool | load (QIODevice *dev, const QString &format=QString ()) |
QPicture & | operator= (const QPicture &other) |
QPicture & | operator= (QPicture &&other) |
QPaintEngine * | paintEngine () const override |
bool | play (QPainter *painter) |
bool | save (const QString &fileName, const QString &format=QString ()) |
bool | save (QIODevice *dev, const QString &format=QString ()) |
void | setBoundingRect (const QRect &rect) |
virtual void | setData (const char *data, uint size) |
uint | size () const |
void | swap (QPicture &other) |
Public Methods inherited from QPaintDevice | |
virtual | ~QPaintDevice () |
int | colorCount () const |
int | depth () const |
int | devicePixelRatio () const |
qreal | devicePixelRatioF () const |
int | height () const |
int | heightMM () const |
int | logicalDpiX () const |
int | logicalDpiY () const |
bool | paintingActive () const |
int | physicalDpiX () const |
int | physicalDpiY () const |
int | width () const |
int | widthMM () const |
Static Public Methods | |
static QStringList | inputFormatList () |
static QStringList | inputFormats () |
static QStringList | outputFormatList () |
static QStringList | outputFormats () |
static QString | pictureFormat (const QString &fileName) |
Protected Methods | |
int | metric (PaintDeviceMetric m) const override |
Protected Methods inherited from QPaintDevice | |
QPaintDevice () | |
Friends | |
QDataStream & | operator<< (QDataStream &stream, const QPicture &picture) |
QDataStream & | operator>> (QDataStream &stream, QPicture &picture) |
Additional Inherited Members | |
Public Types inherited from QPaintDevice | |
enum | PaintDeviceMetric |
The QPicture class is a paint device which records and replays QPainter commands. A picture serializes painter commands to an IO device in a platform-independent format. They are sometimes referred to as meta files.
CopperSpice pictures use a proprietary binary format. Unlike native picture (meta file) formats on many window systems. Pictures have no limitations regarding their contents. Everything that can be painted on a widget or pixmap (e.g., fonts, pixmaps, regions, transformed graphics, etc.) can also be stored in a picture.
QPicture is resolution independent, which means a QPicture can be displayed on different devices (for example svg, pdf, ps, printer and screen) looking the same. QPicture runs in the default system dpi, and scales the painter to match differences in resolution depending on the window system.
The following is an example of how to record a picture. The list of painter commands is reset on each call to the QPainter::begin().
The following is an example of how to replay a picture. Pictures can also be drawn using play(). Some basic data about a picture is available, for example, size(), isNull() and boundingRect().
|
explicit |
Constructs an empty QPicture.
The formatVersion parameter may be used to create a QPicture which can be read by applications compiled with earlier versions of CopperSpice. The default value is -1 which signifies the current release.
QPicture::QPicture | ( | const QPicture & | other | ) |
Copy constructs a new :QPicture from other.
QPicture::~QPicture | ( | ) |
Destroys the QPicture.
QRect QPicture::boundingRect | ( | ) | const |
Returns the picture's bounding rectangle or an invalid rectangle if the picture contains no data.
const char * QPicture::data | ( | ) | const |
|
deprecatedstatic |
If you want to iterate over the list you should iterate over a copy.
|
deprecatedstatic |
bool QPicture::isNull | ( | ) | const |
Returns true if the picture contains no data, otherwise returns false.
Loads a picture from the file specified by fileName and returns true if successful, otherwise returns false. The format parameter has been deprecated and will have no effect.
The value for dev is the device to use for loading.
|
overrideprotectedvirtual |
Returns the metric information for the given paint device metric.
Reimplemented from QPaintDevice::metric()
QPicture & QPicture::operator= | ( | const QPicture & | other | ) |
Copy assigns from other and returns a reference to this object.
|
inline |
Move assigns from other and returns a reference to this object.
|
deprecatedstatic |
If you want to iterate over the list, you should iterate over a copy.
|
deprecatedstatic |
|
overridevirtual |
Returns a pointer to the paint engine used for drawing on the device.
Implements QPaintDevice::paintEngine()
bool QPicture::play | ( | QPainter * | painter | ) |
Replays the picture using painter, and returns true if successful, otherwise returns false.
This function does exactly the same as QPainter::drawPicture() with (x, y) = (0, 0).
Saves a picture to the file specified by fileName and returns true if successful, otherwise returns false. The format parameter has been deprecated and will have no effect.
The value for dev is the device to use for saving.
void QPicture::setBoundingRect | ( | const QRect & | rect | ) |
Sets the picture's bounding rectangle to rect. The automatically calculated value is overridden.
|
virtual |
|
inline |
Swaps other with this object. This operation is very fast and never fails.
|
friend |
Writes the given picture to the stream. Returns a reference to the stream.
|
friend |
Reads from the stream into the given picture. Returns a reference to the stream.