1QPicture(3qt)                                                    QPicture(3qt)
2
3
4

NAME

6       QPicture - Paint device that records and replays QPainter commands
7

SYNOPSIS

9       #include <qpicture.h>
10
11       Inherits QPaintDevice.
12
13   Public Members
14       QPicture ( int formatVersion = -1 )
15       QPicture ( const QPicture & pic )
16       ~QPicture ()
17       bool isNull () const
18       uint size () const
19       const char * data () const
20       virtual void setData ( const char * data, uint size )
21       bool play ( QPainter * painter )
22       bool load ( QIODevice * dev, const char * format = 0 )
23       bool load ( const QString & fileName, const char * format = 0 )
24       bool save ( QIODevice * dev, const char * format = 0 )
25       bool save ( const QString & fileName, const char * format = 0 )
26       QRect boundingRect () const
27       void setBoundingRect ( const QRect & r )
28       QPicture & operator= ( const QPicture & p )
29
30   Protected Members
31       virtual int metric ( int m ) const
32       void detach ()
33       QPicture copy () const
34
36       QDataStream & operator<< ( QDataStream & s, const QPicture & r )
37       QDataStream & operator>> ( QDataStream & s, QPicture & r )
38

DESCRIPTION

40       The QPicture class is a paint device that records and replays QPainter
41       commands.
42
43       A picture serializes painter commands to an IO device in a platform-
44       independent format. For example, a picture created under Windows can be
45       read on a Sun SPARC.
46
47       Pictures are called meta-files on some platforms.
48
49       Qt pictures use a proprietary binary format. Unlike native picture
50       (meta-file) formats on many window systems, Qt pictures have no
51       limitations regarding their contents. Everything that can be painted
52       can also be stored in a picture, e.g. fonts, pixmaps, regions,
53       transformed graphics, etc.
54
55       QPicture is an implicitly shared class.
56
57       Example of how to record a picture:
58
59           QPicture  pic;
60           QPainter  p;
61           p.begin( &pic );               // paint in picture
62           p.drawEllipse( 10,20, 80,70 ); // draw an ellipse
63           p.end();                       // painting done
64           pic.save( "drawing.pic" );     // save picture
65
66       Example of how to replay a picture:
67
68           QPicture  pic;
69           pic.load( "drawing.pic" );     // load picture
70           QPainter  p;
71           p.begin( &myWidget );          // paint in myWidget
72           p.drawPicture( pic );          // draw the picture
73           p.end();                       // painting done
74
75       Pictures can also be drawn using play(). Some basic data about a
76       picture is available, for example, size(), isNull() and boundingRect().
77
78       See also Graphics Classes, Image Processing Classes, and Implicitly and
79       Explicitly Shared Classes.
80

MEMBER FUNCTION DOCUMENTATION

QPicture::QPicture ( int formatVersion = -1 )

83       Constructs an empty picture.
84
85       The formatVersion parameter may be used to create a QPicture that can
86       be read by applications that are compiled with earlier versions of Qt.
87
88       formatVersion == 1 is binary compatible with Qt 1.x and later.
89
90       formatVersion == 2 is binary compatible with Qt 2.0.x and later.
91
92       formatVersion == 3 is binary compatible with Qt 2.1.x and later.
93
94       formatVersion == 4 is binary compatible with Qt 3.0.x and later.
95
96       formatVersion == 5 is binary compatible with Qt 3.1.
97
98       Note that the default formatVersion is -1 which signifies the current
99       release, i.e. for Qt 3.1 a formatVersion of 5 is the same as the
100       default formatVersion of -1.
101
102       Reading pictures generated by earlier versions of Qt is supported and
103       needs no special coding; the format is automatically detected.
104

QPicture::QPicture ( const QPicture & pic )

106       Constructs a shallow copy of pic.
107

QPicture::~QPicture ()

109       Destroys the picture.
110

QRect QPicture::boundingRect () const

112       Returns the picture's bounding rectangle or an invalid rectangle if the
113       picture contains no data.
114

QPicture QPicture::copy () const [protected]

116       Returns a deep copy of the picture.
117

const char * QPicture::data () const

119       Returns a pointer to the picture data. The pointer is only valid until
120       the next non-const function is called on this picture. The returned
121       pointer is 0 if the picture contains no data.
122
123       See also size() and isNull().
124

void QPicture::detach () [protected]

126       Detaches from shared picture data and makes sure that this picture is
127       the only one referring to the data.
128
129       If multiple pictures share common data, this picture makes a copy of
130       the data and detaches itself from the sharing mechanism. Nothing is
131       done if there is just a single reference.
132

bool QPicture::isNull () const

134       Returns TRUE if the picture contains no data; otherwise returns FALSE.
135

bool QPicture::load ( const QString & fileName, const char * format = 0 )

137       Loads a picture from the file specified by fileName and returns TRUE if
138       successful; otherwise returns FALSE.
139
140       By default, the file will be interpreted as being in the native
141       QPicture format. Specifying the format string is optional and is only
142       needed for importing picture data stored in a different format.
143
144       Currently, the only external format supported is the W3C SVG format
145       which requires the Qt XML module. The corresponding format string is
146       "svg".
147
148       See also save().
149
150       Examples:
151

bool QPicture::load ( QIODevice * dev, const char * format = 0 )

153       This is an overloaded member function, provided for convenience. It
154       behaves essentially like the above function.
155
156       dev is the device to use for loading.
157

int QPicture::metric ( int m ) const [virtual protected]

159       Internal implementation of the virtual QPaintDevice::metric() function.
160
161       Use the QPaintDeviceMetrics class instead.
162
163       A picture has the following hard-coded values: dpi=72,
164       numcolors=16777216 and depth=24.
165
166       m is the metric to get.
167

QPicture & QPicture::operator= ( const QPicture & p )

169       Assigns a shallow copy of p to this picture and returns a reference to
170       this picture.
171

bool QPicture::play ( QPainter * painter )

173       Replays the picture using painter, and returns TRUE if successful;
174       otherwise returns FALSE.
175
176       This function does exactly the same as QPainter::drawPicture() with (x,
177       y) = (0, 0).
178

bool QPicture::save ( const QString & fileName, const char * format = 0 )

180       Saves a picture to the file specified by fileName and returns TRUE if
181       successful; otherwise returns FALSE.
182
183       Specifying the file format string is optional. It's not recommended
184       unless you intend to export the picture data for use by a third party
185       reader. By default the data will be saved in the native QPicture file
186       format.
187
188       Currently, the only external format supported is the W3C SVG format
189       which requires the Qt XML module. The corresponding format string is
190       "svg".
191
192       See also load().
193
194       Example: picture/picture.cpp.
195

bool QPicture::save ( QIODevice * dev, const char * format = 0 )

197       This is an overloaded member function, provided for convenience. It
198       behaves essentially like the above function.
199
200       dev is the device to use for saving.
201

void QPicture::setBoundingRect ( const QRect & r )

203       Sets the picture's bounding rectangle to r. The automatically
204       calculated value is overriden.
205

void QPicture::setData ( const char * data, uint size ) [virtual]

207       Sets the picture data directly from data and size. This function copies
208       the input data.
209
210       See also data() and size().
211

uint QPicture::size () const

213       Returns the size of the picture data.
214
215       See also data().
216

QDataStream & operator<< ( QDataStream & s, const QPicture & r )

219       Writes picture r to the stream s and returns a reference to the stream.
220

QDataStream & operator>> ( QDataStream & s, QPicture & r )

222       Reads a picture from the stream s into picture r and returns a
223       reference to the stream.
224
225

SEE ALSO

227       http://doc.trolltech.com/qpicture.html
228       http://www.trolltech.com/faq/tech.html
229
231       Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
232       license file included in the distribution for a complete license
233       statement.
234

AUTHOR

236       Generated automatically from the source code.
237

BUGS

239       If you find a bug in Qt, please report it as described in
240       http://doc.trolltech.com/bughowto.html.  Good bug reports help us to
241       help you. Thank you.
242
243       The definitive Qt documentation is provided in HTML format; it is
244       located at $QTDIR/doc/html and can be read using Qt Assistant or with a
245       web browser. This man page is provided as a convenience for those users
246       who prefer man pages, although this format is not officially supported
247       by Trolltech.
248
249       If you find errors in this manual page, please report them to qt-
250       bugs@trolltech.com.  Please include the name of the manual page
251       (qpicture.3qt) and the Qt version (3.3.8).
252
253
254
255Trolltech AS                    2 February 2007                  QPicture(3qt)
Impressum