1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
|
'\" t
.TH TQPicture 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
TQPicture \- Paint device that records and replays TQPainter commands
.SH SYNOPSIS
\fC#include <tqpicture.h>\fR
.PP
Inherits TQPaintDevice.
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "\fBTQPicture\fR ( int formatVersion = -1 )"
.br
.ti -1c
.BI "\fBTQPicture\fR ( const TQPicture & pic )"
.br
.ti -1c
.BI "\fB~TQPicture\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 ( TQPainter * painter )"
.br
.ti -1c
.BI "bool \fBload\fR ( TQIODevice * dev, const char * format = 0 )"
.br
.ti -1c
.BI "bool \fBload\fR ( const TQString & fileName, const char * format = 0 )"
.br
.ti -1c
.BI "bool \fBsave\fR ( TQIODevice * dev, const char * format = 0 )"
.br
.ti -1c
.BI "bool \fBsave\fR ( const TQString & fileName, const char * format = 0 )"
.br
.ti -1c
.BI "TQRect \fBboundingRect\fR () const"
.br
.ti -1c
.BI "void \fBsetBoundingRect\fR ( const TQRect & r )"
.br
.ti -1c
.BI "TQPicture & \fBoperator=\fR ( const TQPicture & 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 "TQPicture \fBcopy\fR () const"
.br
.in -1c
.SH RELATED FUNCTION DOCUMENTATION
.in +1c
.ti -1c
.BI "TQDataStream & \fBoperator<<\fR ( TQDataStream & s, const TQPicture & r )"
.br
.ti -1c
.BI "TQDataStream & \fBoperator>>\fR ( TQDataStream & s, TQPicture & r )"
.br
.in -1c
.SH DESCRIPTION
The TQPicture class is a paint device that records and replays TQPainter 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, TQt 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
TQPicture is an implicitly shared class.
.PP
Example of how to record a picture:
.PP
.nf
.br
TQPicture pic;
.br
TQPainter 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
TQPicture pic;
.br
pic.load( "drawing.pic" ); // load picture
.br
TQPainter 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 "TQPicture::TQPicture ( int formatVersion = -1 )"
Constructs an empty picture.
.PP
The \fIformatVersion\fR parameter may be used to \fIcreate\fR a TQPicture that can be read by applications that are compiled with earlier versions of Qt.
.TP
\fIformatVersion\fR == 1 is binary compatible with TQt 1.x and later.
.TP
\fIformatVersion\fR == 2 is binary compatible with TQt 2.0.x and later.
.TP
\fIformatVersion\fR == 3 is binary compatible with TQt 2.1.x and later.
.TP
\fIformatVersion\fR == 4 is binary compatible with TQt 3.0.x and later.
.TP
\fIformatVersion\fR == 5 is binary compatible with TQt 3.1.
.PP
Note that the default formatVersion is -1 which signifies the current release, i.e. for TQt 3.1 a formatVersion of 5 is the same as the default formatVersion of -1.
.PP
Reading pictures generated by earlier versions of TQt is supported and needs no special coding; the format is automatically detected.
.SH "TQPicture::TQPicture ( const TQPicture & pic )"
Constructs a shallow copy of \fIpic\fR.
.SH "TQPicture::~TQPicture ()"
Destroys the picture.
.SH "TQRect TQPicture::boundingRect () const"
Returns the picture's bounding rectangle or an invalid rectangle if the picture contains no data.
.SH "TQPicture TQPicture::copy () const\fC [protected]\fR"
Returns a deep copy of the picture.
.SH "const char * TQPicture::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 TQPicture::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 TQPicture::isNull () const"
Returns TRUE if the picture contains no data; otherwise returns FALSE.
.SH "bool TQPicture::load ( const TQString & 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 TQPicture 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 TQt 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 TQPicture::load ( TQIODevice * 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 TQPicture::metric ( int m ) const\fC [virtual protected]\fR"
Internal implementation of the virtual TQPaintDevice::metric() function.
.PP
Use the TQPaintDeviceMetrics 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 "TQPicture & TQPicture::operator= ( const TQPicture & p )"
Assigns a shallow copy of \fIp\fR to this picture and returns a reference to this picture.
.SH "bool TQPicture::play ( TQPainter * painter )"
Replays the picture using \fIpainter\fR, and returns TRUE if successful; otherwise returns FALSE.
.PP
This function does exactly the same as TQPainter::drawPicture() with (x, y) = (0, 0).
.SH "bool TQPicture::save ( const TQString & 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 TQPicture file format.
.PP
Currently, the only external format supported is the W3C SVG format which requires the TQt XML module. The corresponding \fIformat\fR string is "svg".
.PP
See also load().
.PP
Example: picture/picture.cpp.
.SH "bool TQPicture::save ( TQIODevice * 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 TQPicture::setBoundingRect ( const TQRect & r )"
Sets the picture's bounding rectangle to \fIr\fR. The automatically calculated value is overriden.
.SH "void TQPicture::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 TQPicture::size () const"
Returns the size of the picture data.
.PP
See also data().
.SH RELATED FUNCTION DOCUMENTATION
.SH "TQDataStream & operator<< ( TQDataStream & s, const TQPicture & r )"
Writes picture \fIr\fR to the stream \fIs\fR and returns a reference to the stream.
.SH "TQDataStream & operator>> ( TQDataStream & s, TQPicture & 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/tqpicture.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 TQt documentation is provided in HTML format; it is
located at $TQTDIR/doc/html and can be read using TQt 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).
|