The QPicture class is a paint device that records and replays QPainter commands.
.PP
A picture serializes painter commands to an IO device in a platform-independent format. For example, a picture created under Windows can be read on a Sun SPARC.
.PP
Pictures are called meta-files on some platforms.
.PP
Qt pictures use a proprietary binary format. Unlike native picture (meta-file) formats on many window systems, Qt pictures have no limitations regarding their contents. Everything that can be painted can also be stored in a picture, e.g. fonts, pixmaps, regions, transformed graphics, etc.
.PP
QPicture is an implicitly shared class.
.PP
Example of how to record a picture:
.PP
.nf
.br
QPicture pic;
.br
QPainter p;
.br
p.begin( &pic ); // paint in picture
.br
p.drawEllipse( 10,20, 80,70 ); // draw an ellipse
.br
p.end(); // painting done
.br
pic.save( "drawing.pic" ); // save picture
.br
.fi
.PP
Example of how to replay a picture:
.PP
.nf
.br
QPicture pic;
.br
pic.load( "drawing.pic" ); // load picture
.br
QPainter p;
.br
p.begin( &myWidget ); // paint in myWidget
.br
p.drawPicture( pic ); // draw the picture
.br
p.end(); // painting done
.br
.fi
.PP
Pictures can also be drawn using play(). Some basic data about a picture is available, for example, size(), isNull() and boundingRect().
.PP
See also Graphics Classes, Image Processing Classes, and Implicitly and Explicitly Shared Classes.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QPicture::QPicture ( int formatVersion = -1 )"
Constructs an empty picture.
.PP
The \fIformatVersion\fR parameter may be used to \fIcreate\fR a QPicture that can be read by applications that are compiled with earlier versions of Qt.
.TP
\fIformatVersion\fR == 1 is binary compatible with Qt 1.x and later.
.TP
\fIformatVersion\fR == 2 is binary compatible with Qt 2.0.x and later.
.TP
\fIformatVersion\fR == 3 is binary compatible with Qt 2.1.x and later.
.TP
\fIformatVersion\fR == 4 is binary compatible with Qt 3.0.x and later.
.TP
\fIformatVersion\fR == 5 is binary compatible with Qt 3.1.
.PP
Note that the default formatVersion is -1 which signifies the current release, i.e. for Qt 3.1 a formatVersion of 5 is the same as the default formatVersion of -1.
.PP
Reading pictures generated by earlier versions of Qt is supported and needs no special coding; the format is automatically detected.
.SH "QPicture::QPicture ( const QPicture & pic )"
Constructs a shallow copy of \fIpic\fR.
.SH "QPicture::~QPicture ()"
Destroys the picture.
.SH "QRect QPicture::boundingRect () const"
Returns the picture's bounding rectangle or an invalid rectangle if the picture contains no data.
Returns a pointer to the picture data. The pointer is only valid until the next non-const function is called on this picture. The returned pointer is 0 if the picture contains no data.
.PP
See also size() and isNull().
.SH "void QPicture::detach ()\fC [protected]\fR"
Detaches from shared picture data and makes sure that this picture is the only one referring to the data.
.PP
If multiple pictures share common data, this picture makes a copy of the data and detaches itself from the sharing mechanism. Nothing is done if there is just a single reference.
.SH "bool QPicture::isNull () const"
Returns TRUE if the picture contains no data; otherwise returns FALSE.
Loads a picture from the file specified by \fIfileName\fR and returns TRUE if successful; otherwise returns FALSE.
.PP
By default, the file will be interpreted as being in the native QPicture format. Specifying the \fIformat\fR string is optional and is only needed for importing picture data stored in a different format.
Saves a picture to the file specified by \fIfileName\fR and returns TRUE if successful; otherwise returns FALSE.
.PP
Specifying the file \fIformat\fR string is optional. It's not recommended unless you intend to export the picture data for use by a third party reader. By default the data will be saved in the native QPicture file format.