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
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Qt Toolkit - QPicture Class</title><style type="text/css"><!--
h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }body { background: white; color: black; }
--></style>
</head><body bgcolor="#ffffff">
<table width="100%">
<tr><td><a href="index.html">
<img width="100" height="100" src="qtlogo.png"
alt="Home" border="0"><img width="100"
height="100" src="face.png" alt="Home" border="0">
</a><td valign=top><div align=right><img src="dochead.png" width="472" height="27"><br>
<a href="classes.html"><b>Classes</b></a>
-<a href="annotated.html">Annotated</a>
- <a href="hierarchy.html">Tree</a>
-<a href="functions.html">Functions</a>
-<a href="index.html">Home</a>
-<a href="topicals.html"><b>Structure</b></a>
</div>
</table>
<h1 align=center>QPicture Class Reference</h1><br clear="all">
<p>
The QPicture class is a paint device that records and replays <a href="qpainter.html">QPainter</a> commands.
<a href="#details">More...</a>
<p>
<code>#include <<a href="qpicture-h.html">qpicture.h</a>></code>
<p>
Inherits <a href="qpaintdevice.html">QPaintDevice</a>.
<p><a href="qpicture-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class="fn"><a href="#c183ee"><b>QPicture</b></a>(intformatVersion=0)</div>
<li><div class="fn"><a href="#194c2b"><b>~QPicture</b></a>()</div>
<li><div class="fn">bool<a href="#c1c180"><b>isNull</b></a>()const</div>
<li><div class="fn">uint<a href="#4437b1"><b>size</b></a>()const</div>
<li><div class="fn">constchar*<a href="#616be4"><b>data</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="#51fac3"><b>setData</b></a>(constchar*data, uintsize)</div>
<li><div class="fn">bool<a href="#b515a5"><b>play</b></a>(QPainter*)</div>
<li><div class="fn">bool<a href="#f0cc08"><b>load</b></a>(constQString&fileName)</div>
<li><div class="fn">bool<a href="#2d7ded"><b>save</b></a>(constQString&fileName)</div>
<li><div class="fn">QPicture&<a href="#8d9cd8"><b>operator=</b></a>(constQPicture&)</div>
</ul>
<h2>Protected Members</h2>
<ul>
<li><div class="fn">virtualbool<b>cmd</b>(int, QPainter*, QPDevCmdParam*)(internal)</div>
<li><div class="fn">virtualint<a href="#1eba1e"><b>metric</b></a>(int)const</div>
</ul>
<h2>Related Functions</h2>
(Note that these are not member functions.)
<ul>
<li>QDataStream & <a href="qpicture.html#921c35"><b>operator>></b></a> (QDataStream & s, QPicture & r)
<li>QDataStream & <a href="qpicture.html#d648b2"><b>operator<<</b></a> (QDataStream & s, const QPicture & r)
</ul>
<hr><h2><a name="details"></a>Detailed Description</h2>
The QPicture class is a paint device that records and replays <a href="qpainter.html">QPainter</a> commands.
<p>
A picture serializes painter commands to an IO device in a
platform-independent format. A picture created under Windows
can be read on a Sun SPARC.
<p>Pictures are called meta-files on some platforms.
<p>Qt pictures use a proprietary binary format. Unlike native picture
(meta-file) formats on many window systems, Qt pictures have no
limitations regarding the contents. Everything that can be painted can
also be stored in a picture (fonts, pixmaps, regions, transformed
graphics etc.)
<p>Example of how to record a picture:
<pre> <a href="qpicture.html">QPicture</a> pic;
<a href="qpainter.html">QPainter</a> p;
p.<a href="qpainter.html#02ed5d">begin</a>( &pic ); // paint in picture
p.<a href="qpainter.html#f4ec3a">drawEllipse</a>( 10,20, 80,70 ); // draw an ellipse
p.<a href="qpainter.html#365784">end</a>(); // painting done
pic.<a href="#2d7ded">save</a>( "drawing.pic" ); // save picture
</pre>
<p>Example of how to replay a picture:
<pre> <a href="qpicture.html">QPicture</a> pic;
pic.<a href="#f0cc08">load</a>( "drawing.pic" ); // load picture
<a href="qpainter.html">QPainter</a> p;
p.<a href="qpainter.html#02ed5d">begin</a>( &myWidget ); // paint in myWidget
p.<a href="qpainter.html#de93a0">drawPicture</a>( pic ); // draw the picture
p.<a href="qpainter.html#365784">end</a>(); // painting done
</pre>
<p>Examples:
<a href="xform-xform-cpp.html#QPicture">xform/xform.cpp</a>
<a href="picture-picture-cpp.html#QPicture">picture/picture.cpp</a>
<hr><h2>Member Function Documentation</h2>
<h3 class="fn"><a name="c183ee"></a>QPicture::QPicture(intformatVer=0)</h3>
<p>Constructs an empty picture.
<p>The <em>formatVersion</em> parameter may be used to create a QPicture that
can be read by applications that are compiled with earlier versions of
Qt. Currently supported is <em>formatVersion</em> == 1, which will make a
QPicture which is stored in a format that is binary compatible with
Qt 1.x programs, and <em>formatVersion</em> == 2, for a format compatible
with Qt 2.0.x programs.
<p>Reading of pictures generated by earlier versions of Qt is supported and
needs no special coding; the format is automatically detected.
<h3 class="fn"><a name="194c2b"></a>QPicture::~QPicture()</h3>
<p>Destructs the picture.
<h3 class="fn">constchar*<a name="616be4"></a>QPicture::data()const</h3>
<p>Returns a pointer to the picture data. The returned pointer is null
if the picture contains no data.
<p>See also <a href="#4437b1">size</a>() and <a href="#c1c180">isNull</a>().
<h3 class="fn">bool<a name="c1c180"></a>QPicture::isNull()const</h3>
<p>Returns TRUE if the picture contains no data, otherwise FALSE.
<h3 class="fn">bool<a name="f0cc08"></a>QPicture::load(const<a href="qstring.html">QString</a>&fileName)</h3>
<p>Loads a picture from the file specified by <em>fileName</em> and returns TRUE
if successful, otherwise FALSE.
<p>See also <a href="#2d7ded">save</a>().
<p>Examples:
<a href="xform-xform-cpp.html#load">xform/xform.cpp</a>
<a href="picture-picture-cpp.html#load">picture/picture.cpp</a>
<h3 class="fn">int<a name="1eba1e"></a>QPicture::metric(intm)const <code>[virtualprotected]</code></h3>
<p>Internal implementation of the virtual <a href="qpaintdevice.html#43eff7">QPaintDevice::metric</a>() function.
<p>Use the <a href="qpaintdevicemetrics.html">QPaintDeviceMetrics</a> class instead.
<p>A picture has the following hard coded values:
width=640, height=480, dpi = 72, numcolors=16777216 and depth=24.
<p>Reimplemented from <a href="qpaintdevice.html#43eff7">QPaintDevice.</a>
<h3 class="fn">QPicture&<a name="8d9cd8"></a>QPicture::operator=(constQPicture&p)</h3>
<p>Makes this picture be a deep copy of <em>p.</em>
<h3 class="fn">bool<a name="b515a5"></a>QPicture::play(<a href="qpainter.html">QPainter</a>*painter)</h3>
<p>Replays the picture using <em>painter</em> and returns TRUE if successful, or
FALSE if the internal picture data is inconsistent.
<p>This function does exactly the same as <a href="qpainter.html#de93a0">QPainter::drawPicture</a>().
<h3 class="fn">bool<a name="2d7ded"></a>QPicture::save(const<a href="qstring.html">QString</a>&fileName)</h3>
<p>Saves a picture to the file specified by <em>fileName</em> and returns TRUE
if successful, otherwise FALSE.
<p>See also <a href="#f0cc08">load</a>().
<p>Examples:
<a href="picture-picture-cpp.html#save">picture/picture.cpp</a>
<h3 class="fn">void<a name="51fac3"></a>QPicture::setData(constchar*data, uintsize) <code>[virtual]</code></h3>
<p>Sets the picture data directly from <em>data</em> and <em>size.</em> This function
copies the input data.
<p>See also <a href="#616be4">data</a>() and <a href="#4437b1">size</a>().
<h3 class="fn">uint<a name="4437b1"></a>QPicture::size()const</h3>
<p>Returns the size of the picture data.
<p>See also <a href="#616be4">data</a>().
<h3 class="fn">bool<a name="89362c"></a>QPicture::cmd(intc, <a href="qpainter.html">QPainter</a>*, QPDevCmdParam*p) <code>[virtualprotected]</code></h3>
<p>For internal use only.
<p>Reimplemented from <a href="qpaintdevice.html#4d4225">QPaintDevice.</a>
<hr><h2>Related Functions</h2>
<h3><a href="qdatastream.html">QDataStream</a> & <a name="921c35"></a>operator>> (<a href="qdatastream.html">QDataStream</a> & s, QPicture & r)</h3>
<p>Reads a QPicture from the stream and returns a reference to the stream.
<h3><a href="qdatastream.html">QDataStream</a> & <a name="d648b2"></a>operator<< (<a href="qdatastream.html">QDataStream</a> & s, const QPicture & r)</h3>
<p>Writes a QPicture to the stream and returns a reference to the stream.
<hr><p>
Search the documentation, FAQ, qt-interest archive and more (uses
<a href="http://www.trolltech.com">www.trolltech.com</a>):<br>
<form method=post action="http://www.trolltech.com/search.cgi">
<input type=hidden name="version" value="2.3.2"><nobr>
<input size="50" name="search"><input type=submit value="Search">
</nobr></form><hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>,
copyright © 1995-2001
<a href="http://www.trolltech.com">Trolltech</a>, all rights reserved.<p><address><hr><div align="center">
<table width="100%" cellspacing="0" border="0"><tr>
<td>Copyright 2001 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align="right"><div align="right">Qt version 2.3.2</div>
</table></div></address></body></html>
|