diff options
Diffstat (limited to 'doc/man/man3/tqpicture.3qt')
-rw-r--r-- | doc/man/man3/tqpicture.3qt | 255 |
1 files changed, 255 insertions, 0 deletions
diff --git a/doc/man/man3/tqpicture.3qt b/doc/man/man3/tqpicture.3qt new file mode 100644 index 000000000..0b885f6c0 --- /dev/null +++ b/doc/man/man3/tqpicture.3qt @@ -0,0 +1,255 @@ +'\" t +.TH QPicture 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the +.\" license file included in the distribution for a complete license +.\" statement. +.\" +.ad l +.nh +.SH NAME +QPicture \- Paint device that records and replays QPainter commands +.SH SYNOPSIS +\fC#include <ntqpicture.h>\fR +.PP +Inherits QPaintDevice. +.PP +.SS "Public Members" +.in +1c +.ti -1c +.BI "\fBQPicture\fR ( int formatVersion = -1 )" +.br +.ti -1c +.BI "\fBQPicture\fR ( const QPicture & pic )" +.br +.ti -1c +.BI "\fB~QPicture\fR ()" +.br +.ti -1c +.BI "bool \fBisNull\fR () const" +.br +.ti -1c +.BI "uint \fBsize\fR () const" +.br +.ti -1c +.BI "const char * \fBdata\fR () const" +.br +.ti -1c +.BI "virtual void \fBsetData\fR ( const char * data, uint size )" +.br +.ti -1c +.BI "bool \fBplay\fR ( QPainter * painter )" +.br +.ti -1c +.BI "bool \fBload\fR ( QIODevice * dev, const char * format = 0 )" +.br +.ti -1c +.BI "bool \fBload\fR ( const QString & fileName, const char * format = 0 )" +.br +.ti -1c +.BI "bool \fBsave\fR ( QIODevice * dev, const char * format = 0 )" +.br +.ti -1c +.BI "bool \fBsave\fR ( const QString & fileName, const char * format = 0 )" +.br +.ti -1c +.BI "QRect \fBboundingRect\fR () const" +.br +.ti -1c +.BI "void \fBsetBoundingRect\fR ( const QRect & r )" +.br +.ti -1c +.BI "QPicture & \fBoperator=\fR ( const QPicture & p )" +.br +.in -1c +.SS "Protected Members" +.in +1c +.ti -1c +.BI "virtual int \fBmetric\fR ( int m ) const" +.br +.ti -1c +.BI "void \fBdetach\fR ()" +.br +.ti -1c +.BI "QPicture \fBcopy\fR () const" +.br +.in -1c +.SH RELATED FUNCTION DOCUMENTATION +.in +1c +.ti -1c +.BI "QDataStream & \fBoperator<<\fR ( QDataStream & s, const QPicture & r )" +.br +.ti -1c +.BI "QDataStream & \fBoperator>>\fR ( QDataStream & s, QPicture & r )" +.br +.in -1c +.SH DESCRIPTION +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. +.SH "QPicture QPicture::copy () const\fC [protected]\fR" +Returns a deep copy of the picture. +.SH "const char * QPicture::data () const" +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. +.SH "bool QPicture::load ( const QString & fileName, const char * format = 0 )" +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. +.PP +Currently, the only external format supported is the W3C SVG format which requires the Qt XML module. The corresponding \fIformat\fR string is "svg". +.PP +See also save(). +.PP +Examples: +.)l picture/picture.cpp and xform/xform.cpp. +.SH "bool QPicture::load ( QIODevice * dev, const char * format = 0 )" +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +.PP +\fIdev\fR is the device to use for loading. +.SH "int QPicture::metric ( int m ) const\fC [virtual protected]\fR" +Internal implementation of the virtual QPaintDevice::metric() function. +.PP +Use the QPaintDeviceMetrics class instead. +.PP +A picture has the following hard-coded values: dpi=72, numcolors=16777216 and depth=24. +.PP +\fIm\fR is the metric to get. +.SH "QPicture & QPicture::operator= ( const QPicture & p )" +Assigns a shallow copy of \fIp\fR to this picture and returns a reference to this picture. +.SH "bool QPicture::play ( QPainter * painter )" +Replays the picture using \fIpainter\fR, and returns TRUE if successful; otherwise returns FALSE. +.PP +This function does exactly the same as QPainter::drawPicture() with (x, y) = (0, 0). +.SH "bool QPicture::save ( const QString & fileName, const char * format = 0 )" +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. +.PP +Currently, the only external format supported is the W3C SVG format which requires the Qt XML module. The corresponding \fIformat\fR string is "svg". +.PP +See also load(). +.PP +Example: picture/picture.cpp. +.SH "bool QPicture::save ( QIODevice * dev, const char * format = 0 )" +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +.PP +\fIdev\fR is the device to use for saving. +.SH "void QPicture::setBoundingRect ( const QRect & r )" +Sets the picture's bounding rectangle to \fIr\fR. The automatically calculated value is overriden. +.SH "void QPicture::setData ( const char * data, uint size )\fC [virtual]\fR" +Sets the picture data directly from \fIdata\fR and \fIsize\fR. This function copies the input data. +.PP +See also data() and size(). +.SH "uint QPicture::size () const" +Returns the size of the picture data. +.PP +See also data(). +.SH RELATED FUNCTION DOCUMENTATION +.SH "QDataStream & operator<< ( QDataStream & s, const QPicture & r )" +Writes picture \fIr\fR to the stream \fIs\fR and returns a reference to the stream. +.SH "QDataStream & operator>> ( QDataStream & s, QPicture & r )" +Reads a picture from the stream \fIs\fR into picture \fIr\fR and returns +a reference to the stream. + +.SH "SEE ALSO" +.BR http://doc.trolltech.com/ntqpicture.html +.BR http://www.trolltech.com/faq/tech.html +.SH COPYRIGHT +Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the +license file included in the distribution for a complete license +statement. +.SH AUTHOR +Generated automatically from the source code. +.SH BUGS +If you find a bug in Qt, please report it as described in +.BR http://doc.trolltech.com/bughowto.html . +Good bug reports help us to help you. Thank you. +.P +The definitive Qt documentation is provided in HTML format; it is +located at $QTDIR/doc/html and can be read using Qt Assistant or with +a web browser. This man page is provided as a convenience for those +users who prefer man pages, although this format is not officially +supported by Trolltech. +.P +If you find errors in this manual page, please report them to +.BR qt-bugs@trolltech.com . +Please include the name of the manual page (tqpicture.3qt) and the Qt +version (3.3.8). |