1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qpicture.cpp:53 -->
|
---|
3 | <html>
|
---|
4 | <head>
|
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
6 | <title>QPicture Class</title>
|
---|
7 | <style type="text/css"><!--
|
---|
8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
9 | a:link { color: #004faf; text-decoration: none }
|
---|
10 | a:visited { color: #672967; text-decoration: none }
|
---|
11 | body { background: #ffffff; color: black; }
|
---|
12 | --></style>
|
---|
13 | </head>
|
---|
14 | <body>
|
---|
15 |
|
---|
16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
17 | <tr bgcolor="#E5E5E5">
|
---|
18 | <td valign=center>
|
---|
19 | <a href="index.html">
|
---|
20 | <font color="#004faf">Home</font></a>
|
---|
21 | | <a href="classes.html">
|
---|
22 | <font color="#004faf">All Classes</font></a>
|
---|
23 | | <a href="mainclasses.html">
|
---|
24 | <font color="#004faf">Main Classes</font></a>
|
---|
25 | | <a href="annotated.html">
|
---|
26 | <font color="#004faf">Annotated</font></a>
|
---|
27 | | <a href="groups.html">
|
---|
28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
29 | | <a href="functions.html">
|
---|
30 | <font color="#004faf">Functions</font></a>
|
---|
31 | </td>
|
---|
32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QPicture Class Reference</h1>
|
---|
33 |
|
---|
34 | <p>The QPicture class is a paint device that records and
|
---|
35 | replays QPainter commands.
|
---|
36 | <a href="#details">More...</a>
|
---|
37 | <p><tt>#include <<a href="qpicture-h.html">qpicture.h</a>></tt>
|
---|
38 | <p>Inherits <a href="qpaintdevice.html">QPaintDevice</a>.
|
---|
39 | <p><a href="qpicture-members.html">List of all member functions.</a>
|
---|
40 | <h2>Public Members</h2>
|
---|
41 | <ul>
|
---|
42 | <li class=fn><a href="#QPicture"><b>QPicture</b></a> ( int formatVersion = -1 )</li>
|
---|
43 | <li class=fn><a href="#QPicture-2"><b>QPicture</b></a> ( const QPicture & pic )</li>
|
---|
44 | <li class=fn><a href="#~QPicture"><b>~QPicture</b></a> ()</li>
|
---|
45 | <li class=fn>bool <a href="#isNull"><b>isNull</b></a> () const</li>
|
---|
46 | <li class=fn>uint <a href="#size"><b>size</b></a> () const</li>
|
---|
47 | <li class=fn>const char * <a href="#data"><b>data</b></a> () const</li>
|
---|
48 | <li class=fn>virtual void <a href="#setData"><b>setData</b></a> ( const char * data, uint size )</li>
|
---|
49 | <li class=fn>bool <a href="#play"><b>play</b></a> ( QPainter * painter )</li>
|
---|
50 | <li class=fn>bool <a href="#load-2"><b>load</b></a> ( QIODevice * dev, const char * format = 0 )</li>
|
---|
51 | <li class=fn>bool <a href="#load"><b>load</b></a> ( const QString & fileName, const char * format = 0 )</li>
|
---|
52 | <li class=fn>bool <a href="#save-2"><b>save</b></a> ( QIODevice * dev, const char * format = 0 )</li>
|
---|
53 | <li class=fn>bool <a href="#save"><b>save</b></a> ( const QString & fileName, const char * format = 0 )</li>
|
---|
54 | <li class=fn>QRect <a href="#boundingRect"><b>boundingRect</b></a> () const</li>
|
---|
55 | <li class=fn>void <a href="#setBoundingRect"><b>setBoundingRect</b></a> ( const QRect & r )</li>
|
---|
56 | <li class=fn>QPicture & <a href="#operator-eq"><b>operator=</b></a> ( const QPicture & p )</li>
|
---|
57 | </ul>
|
---|
58 | <h2>Protected Members</h2>
|
---|
59 | <ul>
|
---|
60 | <li class=fn>virtual int <a href="#metric"><b>metric</b></a> ( int m ) const</li>
|
---|
61 | <li class=fn>void <a href="#detach"><b>detach</b></a> ()</li>
|
---|
62 | <li class=fn>QPicture <a href="#copy"><b>copy</b></a> () const</li>
|
---|
63 | </ul>
|
---|
64 | <h2>Related Functions</h2>
|
---|
65 | <ul>
|
---|
66 | <li class=fn>QDataStream & <a href="#operator-lt-lt"><b>operator<<</b></a> ( QDataStream & s, const QPicture & r )</li>
|
---|
67 | <li class=fn>QDataStream & <a href="#operator-gt-gt"><b>operator>></b></a> ( QDataStream & s, QPicture & r )</li>
|
---|
68 | </ul>
|
---|
69 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
70 |
|
---|
71 |
|
---|
72 | The QPicture class is a paint device that records and
|
---|
73 | replays <a href="qpainter.html">QPainter</a> commands.
|
---|
74 | <p>
|
---|
75 |
|
---|
76 |
|
---|
77 | <p> A picture serializes painter commands to an IO device in a
|
---|
78 | platform-independent format. For example, a picture created under
|
---|
79 | Windows can be read on a Sun SPARC.
|
---|
80 | <p> Pictures are called meta-files on some platforms.
|
---|
81 | <p> Qt pictures use a proprietary binary format. Unlike native picture
|
---|
82 | (meta-file) formats on many window systems, Qt pictures have no
|
---|
83 | limitations regarding their contents. Everything that can be
|
---|
84 | painted can also be stored in a picture, e.g. fonts, pixmaps,
|
---|
85 | regions, transformed graphics, etc.
|
---|
86 | <p> QPicture is an <a href="shclass.html">implicitly shared</a> class.
|
---|
87 | <p> Example of how to record a picture:
|
---|
88 | <pre>
|
---|
89 | QPicture pic;
|
---|
90 | <a href="qpainter.html">QPainter</a> p;
|
---|
91 | p.<a href="qpainter.html#begin">begin</a>( &pic ); // paint in picture
|
---|
92 | p.<a href="qpainter.html#drawEllipse">drawEllipse</a>( 10,20, 80,70 ); // draw an ellipse
|
---|
93 | p.<a href="qpainter.html#end">end</a>(); // painting done
|
---|
94 | pic.<a href="#save">save</a>( "drawing.pic" ); // save picture
|
---|
95 | </pre>
|
---|
96 |
|
---|
97 | <p> Example of how to replay a picture:
|
---|
98 | <pre>
|
---|
99 | QPicture pic;
|
---|
100 | pic.<a href="#load">load</a>( "drawing.pic" ); // load picture
|
---|
101 | <a href="qpainter.html">QPainter</a> p;
|
---|
102 | p.<a href="qpainter.html#begin">begin</a>( &myWidget ); // paint in myWidget
|
---|
103 | p.<a href="qpainter.html#drawPicture">drawPicture</a>( pic ); // draw the picture
|
---|
104 | p.<a href="qpainter.html#end">end</a>(); // painting done
|
---|
105 | </pre>
|
---|
106 |
|
---|
107 | <p> Pictures can also be drawn using <a href="#play">play</a>(). Some basic data about a
|
---|
108 | picture is available, for example, <a href="#size">size</a>(), <a href="#isNull">isNull</a>() and
|
---|
109 | <a href="#boundingRect">boundingRect</a>().
|
---|
110 | <p> <p>See also <a href="graphics.html">Graphics Classes</a>, <a href="images.html">Image Processing Classes</a>, and <a href="shared.html">Implicitly and Explicitly Shared Classes</a>.
|
---|
111 |
|
---|
112 | <hr><h2>Member Function Documentation</h2>
|
---|
113 | <h3 class=fn><a name="QPicture"></a>QPicture::QPicture ( int formatVersion = -1 )
|
---|
114 | </h3>
|
---|
115 | Constructs an empty picture.
|
---|
116 | <p> The <em>formatVersion</em> parameter may be used to <em>create</em> a QPicture
|
---|
117 | that can be read by applications that are compiled with earlier
|
---|
118 | versions of Qt.
|
---|
119 | <ul>
|
---|
120 | <li> <em>formatVersion</em> == 1 is binary compatible with Qt 1.x and later.
|
---|
121 | <li> <em>formatVersion</em> == 2 is binary compatible with Qt 2.0.x and later.
|
---|
122 | <li> <em>formatVersion</em> == 3 is binary compatible with Qt 2.1.x and later.
|
---|
123 | <li> <em>formatVersion</em> == 4 is binary compatible with Qt 3.0.x and later.
|
---|
124 | <li> <em>formatVersion</em> == 5 is binary compatible with Qt 3.1.
|
---|
125 | </ul>
|
---|
126 | <p> Note that the default formatVersion is -1 which signifies the
|
---|
127 | current release, i.e. for Qt 3.1 a formatVersion of 5 is the same
|
---|
128 | as the default formatVersion of -1.
|
---|
129 | <p> Reading pictures generated by earlier versions of Qt is supported
|
---|
130 | and needs no special coding; the format is automatically detected.
|
---|
131 |
|
---|
132 | <h3 class=fn><a name="QPicture-2"></a>QPicture::QPicture ( const <a href="qpicture.html">QPicture</a> & pic )
|
---|
133 | </h3>
|
---|
134 | Constructs a <a href="shclass.html">shallow copy</a> of <em>pic</em>.
|
---|
135 |
|
---|
136 | <h3 class=fn><a name="~QPicture"></a>QPicture::~QPicture ()
|
---|
137 | </h3>
|
---|
138 | Destroys the picture.
|
---|
139 |
|
---|
140 | <h3 class=fn><a href="qrect.html">QRect</a> <a name="boundingRect"></a>QPicture::boundingRect () const
|
---|
141 | </h3>
|
---|
142 | Returns the picture's bounding rectangle or an invalid rectangle
|
---|
143 | if the picture contains no data.
|
---|
144 |
|
---|
145 | <h3 class=fn><a href="qpicture.html">QPicture</a> <a name="copy"></a>QPicture::copy () const<tt> [protected]</tt>
|
---|
146 | </h3>
|
---|
147 | Returns a <a href="shclass.html">deep copy</a> of the picture.
|
---|
148 |
|
---|
149 | <h3 class=fn>const char * <a name="data"></a>QPicture::data () const
|
---|
150 | </h3>
|
---|
151 |
|
---|
152 | <p> Returns a pointer to the picture data. The pointer is only valid
|
---|
153 | until the next non-const function is called on this picture. The
|
---|
154 | returned pointer is 0 if the picture contains no data.
|
---|
155 | <p> <p>See also <a href="#size">size</a>() and <a href="#isNull">isNull</a>().
|
---|
156 |
|
---|
157 | <h3 class=fn>void <a name="detach"></a>QPicture::detach ()<tt> [protected]</tt>
|
---|
158 | </h3>
|
---|
159 | Detaches from shared picture data and makes sure that this picture
|
---|
160 | is the only one referring to the data.
|
---|
161 | <p> If multiple pictures share common data, this picture makes a copy
|
---|
162 | of the data and detaches itself from the sharing mechanism.
|
---|
163 | Nothing is done if there is just a single reference.
|
---|
164 |
|
---|
165 | <h3 class=fn>bool <a name="isNull"></a>QPicture::isNull () const
|
---|
166 | </h3>
|
---|
167 |
|
---|
168 | <p> Returns TRUE if the picture contains no data; otherwise returns
|
---|
169 | FALSE.
|
---|
170 |
|
---|
171 | <h3 class=fn>bool <a name="load"></a>QPicture::load ( const <a href="qstring.html">QString</a> & fileName, const char * format = 0 )
|
---|
172 | </h3>
|
---|
173 | Loads a picture from the file specified by <em>fileName</em> and returns
|
---|
174 | TRUE if successful; otherwise returns FALSE.
|
---|
175 | <p> By default, the file will be interpreted as being in the native
|
---|
176 | QPicture format. Specifying the <em>format</em> string is optional and
|
---|
177 | is only needed for importing picture data stored in a different
|
---|
178 | format.
|
---|
179 | <p> Currently, the only external format supported is the <a href="http://www.w3.org/Graphics/SVG/">W3C SVG</a> format which
|
---|
180 | requires the <a href="xml.html">Qt XML module</a>. The
|
---|
181 | corresponding <em>format</em> string is "svg".
|
---|
182 | <p> <p>See also <a href="#save">save</a>().
|
---|
183 |
|
---|
184 | <p>Examples: <a href="picture-example.html#x122">picture/picture.cpp</a> and <a href="xform-example.html#x1244">xform/xform.cpp</a>.
|
---|
185 | <h3 class=fn>bool <a name="load-2"></a>QPicture::load ( <a href="qiodevice.html">QIODevice</a> * dev, const char * format = 0 )
|
---|
186 | </h3>
|
---|
187 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
188 | <p> <em>dev</em> is the device to use for loading.
|
---|
189 |
|
---|
190 | <h3 class=fn>int <a name="metric"></a>QPicture::metric ( int m ) const<tt> [virtual protected]</tt>
|
---|
191 | </h3>
|
---|
192 | Internal implementation of the virtual QPaintDevice::metric()
|
---|
193 | function.
|
---|
194 | <p> Use the <a href="qpaintdevicemetrics.html">QPaintDeviceMetrics</a> class instead.
|
---|
195 | <p> A picture has the following hard-coded values: dpi=72,
|
---|
196 | numcolors=16777216 and depth=24.
|
---|
197 | <p> <em>m</em> is the metric to get.
|
---|
198 |
|
---|
199 | <h3 class=fn><a href="qpicture.html">QPicture</a> & <a name="operator-eq"></a>QPicture::operator= ( const <a href="qpicture.html">QPicture</a> & p )
|
---|
200 | </h3>
|
---|
201 | Assigns a <a href="shclass.html">shallow copy</a> of <em>p</em> to this
|
---|
202 | picture and returns a reference to this picture.
|
---|
203 |
|
---|
204 | <h3 class=fn>bool <a name="play"></a>QPicture::play ( <a href="qpainter.html">QPainter</a> * painter )
|
---|
205 | </h3>
|
---|
206 | Replays the picture using <em>painter</em>, and returns TRUE if
|
---|
207 | successful; otherwise returns FALSE.
|
---|
208 | <p> This function does exactly the same as <a href="qpainter.html#drawPicture">QPainter::drawPicture</a>()
|
---|
209 | with (x, y) = (0, 0).
|
---|
210 |
|
---|
211 | <h3 class=fn>bool <a name="save"></a>QPicture::save ( const <a href="qstring.html">QString</a> & fileName, const char * format = 0 )
|
---|
212 | </h3>
|
---|
213 | Saves a picture to the file specified by <em>fileName</em> and returns
|
---|
214 | TRUE if successful; otherwise returns FALSE.
|
---|
215 | <p> Specifying the file <em>format</em> string is optional. It's not
|
---|
216 | recommended unless you intend to export the picture data for
|
---|
217 | use by a third party reader. By default the data will be saved in
|
---|
218 | the native QPicture file format.
|
---|
219 | <p> Currently, the only external format supported is the <a href="http://www.w3.org/Graphics/SVG/">W3C SVG</a> format which
|
---|
220 | requires the <a href="xml.html">Qt XML module</a>. The
|
---|
221 | corresponding <em>format</em> string is "svg".
|
---|
222 | <p> <p>See also <a href="#load">load</a>().
|
---|
223 |
|
---|
224 | <p>Example: <a href="picture-example.html#x123">picture/picture.cpp</a>.
|
---|
225 | <h3 class=fn>bool <a name="save-2"></a>QPicture::save ( <a href="qiodevice.html">QIODevice</a> * dev, const char * format = 0 )
|
---|
226 | </h3>
|
---|
227 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
228 | <p> <em>dev</em> is the device to use for saving.
|
---|
229 |
|
---|
230 | <h3 class=fn>void <a name="setBoundingRect"></a>QPicture::setBoundingRect ( const <a href="qrect.html">QRect</a> & r )
|
---|
231 | </h3>
|
---|
232 | Sets the picture's bounding rectangle to <em>r</em>. The automatically
|
---|
233 | calculated value is overriden.
|
---|
234 |
|
---|
235 | <h3 class=fn>void <a name="setData"></a>QPicture::setData ( const char * data, uint size )<tt> [virtual]</tt>
|
---|
236 | </h3>
|
---|
237 | Sets the picture data directly from <em>data</em> and <em>size</em>. This
|
---|
238 | function copies the input data.
|
---|
239 | <p> <p>See also <a href="#data">data</a>() and <a href="#size">size</a>().
|
---|
240 |
|
---|
241 | <h3 class=fn>uint <a name="size"></a>QPicture::size () const
|
---|
242 | </h3>
|
---|
243 |
|
---|
244 | <p> Returns the size of the picture data.
|
---|
245 | <p> <p>See also <a href="#data">data</a>().
|
---|
246 |
|
---|
247 | <hr><h2>Related Functions</h2>
|
---|
248 | <h3 class=fn><a href="qdatastream.html">QDataStream</a> & <a name="operator-lt-lt"></a>operator<< ( <a href="qdatastream.html">QDataStream</a> & s, const <a href="qpicture.html">QPicture</a> & r )
|
---|
249 | </h3>
|
---|
250 |
|
---|
251 | <p> Writes picture <em>r</em> to the stream <em>s</em> and returns a reference to
|
---|
252 | the stream.
|
---|
253 |
|
---|
254 | <h3 class=fn><a href="qdatastream.html">QDataStream</a> & <a name="operator-gt-gt"></a>operator>> ( <a href="qdatastream.html">QDataStream</a> & s, <a href="qpicture.html">QPicture</a> & r )
|
---|
255 | </h3>
|
---|
256 |
|
---|
257 | <p> Reads a picture from the stream <em>s</em> into picture <em>r</em> and returns
|
---|
258 | a reference to the stream.
|
---|
259 |
|
---|
260 | <!-- eof -->
|
---|
261 | <hr><p>
|
---|
262 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
263 | Copyright © 1995-2007
|
---|
264 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
265 | <table width=100% cellspacing=0 border=0><tr>
|
---|
266 | <td>Copyright © 2007
|
---|
267 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
268 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
269 | </table></div></address></body>
|
---|
270 | </html>
|
---|