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
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QPicture Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QPicture Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><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>
<p>Inherits <a href="qpaintdevice.html">QPaintDevice</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qpicture.html#QPicture">__init__</a></b> (<i>self</i>, int <i>formatVersion</i> = -1)</li><li><div class="fn" /><b><a href="qpicture.html#QPicture-2">__init__</a></b> (<i>self</i>, QPicture)</li><li><div class="fn" />QRect <b><a href="qpicture.html#boundingRect">boundingRect</a></b> (<i>self</i>)</li><li><div class="fn" />str <b><a href="qpicture.html#data">data</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpicture.html#detach">detach</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qpicture.html#devType">devType</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qpicture.html#isDetached">isDetached</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qpicture.html#isNull">isNull</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qpicture.html#load">load</a></b> (<i>self</i>, QIODevice <i>dev</i>, str <i>format</i> = None)</li><li><div class="fn" />bool <b><a href="qpicture.html#load-2">load</a></b> (<i>self</i>, QString <i>fileName</i>, str <i>format</i> = None)</li><li><div class="fn" />int <b><a href="qpicture.html#metric">metric</a></b> (<i>self</i>, QPaintDevice.PaintDeviceMetric <i>m</i>)</li><li><div class="fn" />QPaintEngine <b><a href="qpicture.html#paintEngine">paintEngine</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qpicture.html#play">play</a></b> (<i>self</i>, QPainter <i>p</i>)</li><li><div class="fn" />bool <b><a href="qpicture.html#save">save</a></b> (<i>self</i>, QIODevice <i>dev</i>, str <i>format</i> = None)</li><li><div class="fn" />bool <b><a href="qpicture.html#save-2">save</a></b> (<i>self</i>, QString <i>fileName</i>, str <i>format</i> = None)</li><li><div class="fn" /><b><a href="qpicture.html#setBoundingRect">setBoundingRect</a></b> (<i>self</i>, QRect <i>r</i>)</li><li><div class="fn" /><b><a href="qpicture.html#setData">setData</a></b> (<i>self</i>, str <i>data</i>)</li><li><div class="fn" />unsigned long <b><a href="qpicture.html#size">size</a></b> (<i>self</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" />QStringList <b><a href="qpicture.html#inputFormatList">inputFormatList</a></b> ()</li><li><div class="fn" />QByteArray-list <b><a href="qpicture.html#inputFormats">inputFormats</a></b> ()</li><li><div class="fn" />QStringList <b><a href="qpicture.html#outputFormatList">outputFormatList</a></b> ()</li><li><div class="fn" />QByteArray-list <b><a href="qpicture.html#outputFormats">outputFormats</a></b> ()</li><li><div class="fn" />str <b><a href="qpicture.html#pictureFormat">pictureFormat</a></b> (QString <i>fileName</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QPicture class is a paint device that records and replays <a href="qpainter.html">QPainter</a> commands.</p>
<p>A picture serializes painter commands to an IO device in a platform-independent format. They are sometimes referred to as meta-files.</p>
<p>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 on a widget or pixmap (e.g., fonts, pixmaps, regions, transformed graphics, etc.) can also be stored in a picture.</p>
<p>QPicture is resolution independent, i.e. a QPicture can be displayed on different devices (for example svg, pdf, ps, printer and screen) looking the same. This is, for instance, needed for WYSIWYG print preview. QPicture runs in the default system dpi, and scales the painter to match differences in resolution depending on the window system.</p>
<p>QPicture is an <a href="shclass.html">implicitly shared</a> class.</p>
<p>Example of how to record a picture:</p>
<pre>
QPicture picture;
QPainter painter;
painter.begin(&picture); // paint in picture
painter.drawEllipse(10,20, 80,70); // draw an ellipse
painter.end(); // painting done
picture.save("drawing.pic"); // save picture
</pre>
<p>Example of how to replay a picture:</p>
<pre>
QPicture picture;
picture.load("drawing.pic"); // load picture
QPainter painter;
painter.begin(&myWidget); // paint in myWidget
painter.drawPicture(0, 0, picture); // draw the picture at (0,0)
painter.end(); // painting done
</pre>
<p>Pictures can also be drawn using <a href="qpicture.html#play">play</a>(). Some basic data about a picture is available, for example, <a href="qpicture.html#size">size</a>(), <a href="qpicture.html#isNull">isNull</a>() and <a href="qpicture.html#boundingRect">boundingRect</a>().</p>
<p>See also <a href="qmovie.html">QMovie</a>.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QPicture" />QPicture.__init__ (<i>self</i>, int <i>formatVersion</i> = -1)</h3><p>Constructs an empty picture.</p>
<p>The <i>formatVersion</i> parameter may be used to <i>create</i> a <a href="qpicture.html">QPicture</a> that can be read by applications that are compiled with earlier versions of Qt.</p>
<p>Note that the default formatVersion is -1 which signifies the current release, i.e. for Qt 4.0 a formatVersion of 7 is the same as the default formatVersion of -1.</p>
<p>Reading pictures generated by earlier versions of Qt is not supported in Qt 4.0.</p>
<h3 class="fn"><a name="QPicture-2" />QPicture.__init__ (<i>self</i>, <a href="qpicture.html">QPicture</a>)</h3><p>Constructs a <a href="shclass.html">shallow copy</a> of <i>pic</i>.</p>
<h3 class="fn"><a name="boundingRect" /><a href="qrect.html">QRect</a> QPicture.boundingRect (<i>self</i>)</h3><p>Returns the picture's bounding rectangle or an invalid rectangle if the picture contains no data.</p>
<p>See also <a href="qpicture.html#setBoundingRect">setBoundingRect</a>().</p>
<h3 class="fn"><a name="data" />str QPicture.data (<i>self</i>)</h3><p>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.</p>
<p>See also <a href="qpicture.html#setData">setData</a>(), <a href="qpicture.html#size">size</a>(), and <a href="qpicture.html#isNull">isNull</a>().</p>
<h3 class="fn"><a name="detach" />QPicture.detach (<i>self</i>)</h3><h3 class="fn"><a name="devType" />int QPicture.devType (<i>self</i>)</h3><h3 class="fn"><a name="inputFormatList" /><a href="qstringlist.html">QStringList</a> QPicture.inputFormatList ()</h3><p>Returns a list of picture formats that are supported for picture input.</p>
<p>Note that if you want to iterate over the list, you should iterate over a copy, e.g.</p>
<pre>
QStringList list = QPicture.inputFormatList();
foreach (QString string, list)
myProcessing(string);
</pre>
<p>See also <a href="qpicture.html#outputFormatList">outputFormatList</a>(), <a href="qpicture.html#inputFormats">inputFormats</a>(), and <a href="qpictureio.html">QPictureIO</a>.</p>
<h3 class="fn"><a name="inputFormats" />QByteArray-list QPicture.inputFormats ()</h3><p>Returns a list of picture formats that are supported for picture input.</p>
<p>See also <a href="qpicture.html#outputFormats">outputFormats</a>(), <a href="qpicture.html#inputFormatList">inputFormatList</a>(), and <a href="qpictureio.html">QPictureIO</a>.</p>
<h3 class="fn"><a name="isDetached" />bool QPicture.isDetached (<i>self</i>)</h3><h3 class="fn"><a name="isNull" />bool QPicture.isNull (<i>self</i>)</h3><p>Returns true if the picture contains no data; otherwise returns false.</p>
<h3 class="fn"><a name="load" />bool QPicture.load (<i>self</i>, <a href="qiodevice.html">QIODevice</a> <i>dev</i>, str <i>format</i> = None)</h3><p>Loads a picture from the file specified by <i>fileName</i> and returns true if successful; otherwise returns false.</p>
<p>By default, the file will be interpreted as being in the native <a href="qpicture.html">QPicture</a> format. Specifying the <i>format</i> string is optional and is only needed for importing picture data stored in a different format.</p>
<p>See also <a href="qpicture.html#save">save</a>().</p>
<h3 class="fn"><a name="load-2" />bool QPicture.load (<i>self</i>, <a href="qstring.html">QString</a> <i>fileName</i>, str <i>format</i> = None)</h3><p>This is an overloaded member function, provided for convenience.</p>
<p><i>dev</i> is the device to use for loading.</p>
<h3 class="fn"><a name="metric" />int QPicture.metric (<i>self</i>, <a href="qpaintdevice.html#PaintDeviceMetric-enum">QPaintDevice.PaintDeviceMetric</a> <i>m</i>)</h3><p>Internal implementation of the virtual <a href="qpaintdevice.html#metric">QPaintDevice.metric</a>() function.</p>
<p>A picture has the following hard-coded values: numcolors=16777216 and depth=24.</p>
<p><i>m</i> is the metric to get.</p>
<p>Reimplemented from <a href="qpaintdevice.html#metric">QPaintDevice</a>.</p>
<h3 class="fn"><a name="outputFormatList" /><a href="qstringlist.html">QStringList</a> QPicture.outputFormatList ()</h3><p>Returns a list of picture formats that are supported for picture output.</p>
<p>Note that if you want to iterate over the list, you should iterate over a copy, e.g.</p>
<pre>
QStringList list = QPicture.outputFormatList();
foreach (QString string, list)
myProcessing(string);
</pre>
<p>See also <a href="qpicture.html#inputFormatList">inputFormatList</a>(), <a href="qpicture.html#outputFormats">outputFormats</a>(), and <a href="qpictureio.html">QPictureIO</a>.</p>
<h3 class="fn"><a name="outputFormats" />QByteArray-list QPicture.outputFormats ()</h3><p>Returns a list of picture formats that are supported for picture output.</p>
<p>See also <a href="qpicture.html#inputFormats">inputFormats</a>(), <a href="qpicture.html#outputFormatList">outputFormatList</a>(), and <a href="qpictureio.html">QPictureIO</a>.</p>
<h3 class="fn"><a name="paintEngine" /><a href="qpaintengine.html">QPaintEngine</a> QPicture.paintEngine (<i>self</i>)</h3><h3 class="fn"><a name="pictureFormat" />str QPicture.pictureFormat (<a href="qstring.html">QString</a> <i>fileName</i>)</h3><p>Returns a string that specifies the picture format of the file <i>fileName</i>, or 0 if the file cannot be read or if the format is not recognized.</p>
<p>The <a href="qpictureio.html">QPictureIO</a> documentation lists the guaranteed supported picture formats, or use <a href="qpicture.html#inputFormats">QPicture.inputFormats</a>() and <a href="qpicture.html#outputFormats">QPicture.outputFormats</a>() to get lists that include the installed formats.</p>
<p>See also <a href="qpicture.html#load">load</a>() and <a href="qpicture.html#save">save</a>().</p>
<h3 class="fn"><a name="play" />bool QPicture.play (<i>self</i>, <a href="qpainter.html">QPainter</a> <i>p</i>)</h3><p>Replays the picture using <i>painter</i>, and returns true if successful; otherwise returns false.</p>
<p>This function does exactly the same as <a href="qpainter.html#drawPicture">QPainter.drawPicture</a>() with (x, y) = (0, 0).</p>
<h3 class="fn"><a name="save" />bool QPicture.save (<i>self</i>, <a href="qiodevice.html">QIODevice</a> <i>dev</i>, str <i>format</i> = None)</h3><p>Saves a picture to the file specified by <i>fileName</i> and returns true if successful; otherwise returns false.</p>
<p>Specifying the file <i>format</i> string is optional. By default the data will be saved in the native <a href="qpicture.html">QPicture</a> file format.</p>
<p>See also <a href="qpicture.html#load">load</a>().</p>
<h3 class="fn"><a name="save-2" />bool QPicture.save (<i>self</i>, <a href="qstring.html">QString</a> <i>fileName</i>, str <i>format</i> = None)</h3><p>This is an overloaded member function, provided for convenience.</p>
<p><i>dev</i> is the device to use for saving.</p>
<h3 class="fn"><a name="setBoundingRect" />QPicture.setBoundingRect (<i>self</i>, <a href="qrect.html">QRect</a> <i>r</i>)</h3><p>Sets the picture's bounding rectangle to <i>r</i>. The automatically calculated value is overridden.</p>
<p>See also <a href="qpicture.html#boundingRect">boundingRect</a>().</p>
<h3 class="fn"><a name="setData" />QPicture.setData (<i>self</i>, str <i>data</i>)</h3><p>Sets the picture data directly from <i>data</i> and <i>size</i>. This function copies the input data.</p>
<p>See also <a href="qpicture.html#data">data</a>() and <a href="qpicture.html#size">size</a>().</p>
<h3 class="fn"><a name="size" />unsigned long QPicture.size (<i>self</i>)</h3><p>Returns the size of the picture data.</p>
<p>See also <a href="qpicture.html#data">data</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td width="25%">PyQt 4.0.1 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.trolltech.com">Trolltech AS</a> 2006</td><td align="right" width="25%">Qt 4.1.4</td></tr></table></div></address></body></html>
|