You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
270 lines
14 KiB
270 lines
14 KiB
13 years ago
|
<!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>TQPicture Class</title>
|
||
|
<style type="text/css"><!--
|
||
|
fn { margin-left: 1cm; text-indent: -1cm; }
|
||
|
a:link { color: #004faf; text-decoration: none }
|
||
|
a:visited { color: #672967; text-decoration: none }
|
||
|
body { background: #ffffff; color: black; }
|
||
|
--></style>
|
||
|
</head>
|
||
|
<body>
|
||
|
|
||
|
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
||
|
<tr bgcolor="#E5E5E5">
|
||
|
<td valign=center>
|
||
|
<a href="index.html">
|
||
|
<font color="#004faf">Home</font></a>
|
||
|
| <a href="classes.html">
|
||
|
<font color="#004faf">All Classes</font></a>
|
||
|
| <a href="mainclasses.html">
|
||
|
<font color="#004faf">Main Classes</font></a>
|
||
|
| <a href="annotated.html">
|
||
|
<font color="#004faf">Annotated</font></a>
|
||
|
| <a href="groups.html">
|
||
|
<font color="#004faf">Grouped Classes</font></a>
|
||
|
| <a href="functions.html">
|
||
|
<font color="#004faf">Functions</font></a>
|
||
|
</td>
|
||
|
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQPicture Class Reference</h1>
|
||
|
|
||
|
<p>The TQPicture class is a paint device that records and
|
||
|
replays TQPainter commands.
|
||
|
<a href="#details">More...</a>
|
||
5 months ago
|
<p><tt>#include <<a href="tqpicture-h.html">tqpicture.h</a>></tt>
|
||
5 months ago
|
<p>Inherits <a href="tqpaintdevice.html">TQPaintDevice</a>.
|
||
5 months ago
|
<p><a href="tqpicture-members.html">List of all member functions.</a>
|
||
13 years ago
|
<h2>Public Members</h2>
|
||
|
<ul>
|
||
|
<li class=fn><a href="#TQPicture"><b>TQPicture</b></a> ( int formatVersion = -1 )</li>
|
||
|
<li class=fn><a href="#TQPicture-2"><b>TQPicture</b></a> ( const TQPicture & pic )</li>
|
||
|
<li class=fn><a href="#~TQPicture"><b>~TQPicture</b></a> ()</li>
|
||
|
<li class=fn>bool <a href="#isNull"><b>isNull</b></a> () const</li>
|
||
|
<li class=fn>uint <a href="#size"><b>size</b></a> () const</li>
|
||
|
<li class=fn>const char * <a href="#data"><b>data</b></a> () const</li>
|
||
|
<li class=fn>virtual void <a href="#setData"><b>setData</b></a> ( const char * data, uint size )</li>
|
||
|
<li class=fn>bool <a href="#play"><b>play</b></a> ( TQPainter * painter )</li>
|
||
|
<li class=fn>bool <a href="#load-2"><b>load</b></a> ( TQIODevice * dev, const char * format = 0 )</li>
|
||
|
<li class=fn>bool <a href="#load"><b>load</b></a> ( const TQString & fileName, const char * format = 0 )</li>
|
||
|
<li class=fn>bool <a href="#save-2"><b>save</b></a> ( TQIODevice * dev, const char * format = 0 )</li>
|
||
|
<li class=fn>bool <a href="#save"><b>save</b></a> ( const TQString & fileName, const char * format = 0 )</li>
|
||
|
<li class=fn>TQRect <a href="#boundingRect"><b>boundingRect</b></a> () const</li>
|
||
|
<li class=fn>void <a href="#setBoundingRect"><b>setBoundingRect</b></a> ( const TQRect & r )</li>
|
||
|
<li class=fn>TQPicture & <a href="#operator-eq"><b>operator=</b></a> ( const TQPicture & p )</li>
|
||
|
</ul>
|
||
|
<h2>Protected Members</h2>
|
||
|
<ul>
|
||
|
<li class=fn>virtual int <a href="#metric"><b>metric</b></a> ( int m ) const</li>
|
||
|
<li class=fn>void <a href="#detach"><b>detach</b></a> ()</li>
|
||
|
<li class=fn>TQPicture <a href="#copy"><b>copy</b></a> () const</li>
|
||
|
</ul>
|
||
|
<h2>Related Functions</h2>
|
||
|
<ul>
|
||
|
<li class=fn>TQDataStream & <a href="#operator-lt-lt"><b>operator<<</b></a> ( TQDataStream & s, const TQPicture & r )</li>
|
||
|
<li class=fn>TQDataStream & <a href="#operator-gt-gt"><b>operator>></b></a> ( TQDataStream & s, TQPicture & r )</li>
|
||
|
</ul>
|
||
|
<hr><a name="details"></a><h2>Detailed Description</h2>
|
||
|
|
||
|
|
||
|
The TQPicture class is a paint device that records and
|
||
5 months ago
|
replays <a href="tqpainter.html">TQPainter</a> commands.
|
||
13 years ago
|
<p>
|
||
|
|
||
|
|
||
|
<p> 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.
|
||
|
<p> Pictures are called meta-files on some platforms.
|
||
|
<p> TQt 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.
|
||
|
<p> TQPicture is an <a href="shclass.html">implicitly shared</a> class.
|
||
|
<p> Example of how to record a picture:
|
||
|
<pre>
|
||
|
TQPicture pic;
|
||
5 months ago
|
<a href="tqpainter.html">TQPainter</a> p;
|
||
|
p.<a href="tqpainter.html#begin">begin</a>( &pic ); // paint in picture
|
||
|
p.<a href="tqpainter.html#drawEllipse">drawEllipse</a>( 10,20, 80,70 ); // draw an ellipse
|
||
|
p.<a href="tqpainter.html#end">end</a>(); // painting done
|
||
13 years ago
|
pic.<a href="#save">save</a>( "drawing.pic" ); // save picture
|
||
|
</pre>
|
||
|
|
||
|
<p> Example of how to replay a picture:
|
||
|
<pre>
|
||
|
TQPicture pic;
|
||
|
pic.<a href="#load">load</a>( "drawing.pic" ); // load picture
|
||
5 months ago
|
<a href="tqpainter.html">TQPainter</a> p;
|
||
|
p.<a href="tqpainter.html#begin">begin</a>( &myWidget ); // paint in myWidget
|
||
|
p.<a href="tqpainter.html#drawPicture">drawPicture</a>( pic ); // draw the picture
|
||
|
p.<a href="tqpainter.html#end">end</a>(); // painting done
|
||
13 years ago
|
</pre>
|
||
|
|
||
|
<p> Pictures can also be drawn using <a href="#play">play</a>(). Some basic data about a
|
||
|
picture is available, for example, <a href="#size">size</a>(), <a href="#isNull">isNull</a>() and
|
||
|
<a href="#boundingRect">boundingRect</a>().
|
||
|
<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>.
|
||
|
|
||
|
<hr><h2>Member Function Documentation</h2>
|
||
|
<h3 class=fn><a name="TQPicture"></a>TQPicture::TQPicture ( int formatVersion = -1 )
|
||
|
</h3>
|
||
|
Constructs an empty picture.
|
||
|
<p> The <em>formatVersion</em> parameter may be used to <em>create</em> a TQPicture
|
||
|
that can be read by applications that are compiled with earlier
|
||
|
versions of TQt.
|
||
|
<ul>
|
||
|
<li> <em>formatVersion</em> == 1 is binary compatible with TQt 1.x and later.
|
||
|
<li> <em>formatVersion</em> == 2 is binary compatible with TQt 2.0.x and later.
|
||
|
<li> <em>formatVersion</em> == 3 is binary compatible with TQt 2.1.x and later.
|
||
|
<li> <em>formatVersion</em> == 4 is binary compatible with TQt 3.0.x and later.
|
||
|
<li> <em>formatVersion</em> == 5 is binary compatible with TQt 3.1.
|
||
|
</ul>
|
||
|
<p> 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.
|
||
|
<p> Reading pictures generated by earlier versions of TQt is supported
|
||
|
and needs no special coding; the format is automatically detected.
|
||
|
|
||
5 months ago
|
<h3 class=fn><a name="TQPicture-2"></a>TQPicture::TQPicture ( const <a href="tqpicture.html">TQPicture</a> & pic )
|
||
13 years ago
|
</h3>
|
||
|
Constructs a <a href="shclass.html">shallow copy</a> of <em>pic</em>.
|
||
|
|
||
|
<h3 class=fn><a name="~TQPicture"></a>TQPicture::~TQPicture ()
|
||
|
</h3>
|
||
|
Destroys the picture.
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqrect.html">TQRect</a> <a name="boundingRect"></a>TQPicture::boundingRect () const
|
||
13 years ago
|
</h3>
|
||
|
Returns the picture's bounding rectangle or an invalid rectangle
|
||
|
if the picture contains no data.
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqpicture.html">TQPicture</a> <a name="copy"></a>TQPicture::copy () const<tt> [protected]</tt>
|
||
13 years ago
|
</h3>
|
||
|
Returns a <a href="shclass.html">deep copy</a> of the picture.
|
||
|
|
||
|
<h3 class=fn>const char * <a name="data"></a>TQPicture::data () const
|
||
|
</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="#size">size</a>() and <a href="#isNull">isNull</a>().
|
||
|
|
||
|
<h3 class=fn>void <a name="detach"></a>TQPicture::detach ()<tt> [protected]</tt>
|
||
|
</h3>
|
||
|
Detaches from shared picture data and makes sure that this picture
|
||
|
is the only one referring to the data.
|
||
|
<p> 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.
|
||
|
|
||
|
<h3 class=fn>bool <a name="isNull"></a>TQPicture::isNull () const
|
||
|
</h3>
|
||
|
|
||
|
<p> Returns TRUE if the picture contains no data; otherwise returns
|
||
|
FALSE.
|
||
|
|
||
6 months ago
|
<h3 class=fn>bool <a name="load"></a>TQPicture::load ( const <a href="tqstring.html">TQString</a> & fileName, const char * format = 0 )
|
||
13 years ago
|
</h3>
|
||
|
Loads a picture from the file specified by <em>fileName</em> and returns
|
||
|
TRUE if successful; otherwise returns FALSE.
|
||
|
<p> By default, the file will be interpreted as being in the native
|
||
|
TQPicture format. Specifying the <em>format</em> string is optional and
|
||
|
is only needed for importing picture data stored in a different
|
||
|
format.
|
||
|
<p> Currently, the only external format supported is the <a href="http://www.w3.org/Graphics/SVG/">W3C SVG</a> format which
|
||
13 years ago
|
requires the <a href="xml.html">TQt XML module</a>. The
|
||
13 years ago
|
corresponding <em>format</em> string is "svg".
|
||
|
<p> <p>See also <a href="#save">save</a>().
|
||
|
|
||
|
<p>Examples: <a href="picture-example.html#x122">picture/picture.cpp</a> and <a href="xform-example.html#x1244">xform/xform.cpp</a>.
|
||
5 months ago
|
<h3 class=fn>bool <a name="load-2"></a>TQPicture::load ( <a href="tqiodevice.html">TQIODevice</a> * dev, const char * format = 0 )
|
||
13 years ago
|
</h3>
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p> <em>dev</em> is the device to use for loading.
|
||
|
|
||
|
<h3 class=fn>int <a name="metric"></a>TQPicture::metric ( int m ) const<tt> [virtual protected]</tt>
|
||
|
</h3>
|
||
|
Internal implementation of the virtual TQPaintDevice::metric()
|
||
|
function.
|
||
5 months ago
|
<p> Use the <a href="tqpaintdevicemetrics.html">TQPaintDeviceMetrics</a> class instead.
|
||
13 years ago
|
<p> A picture has the following hard-coded values: dpi=72,
|
||
|
numcolors=16777216 and depth=24.
|
||
|
<p> <em>m</em> is the metric to get.
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqpicture.html">TQPicture</a> & <a name="operator-eq"></a>TQPicture::operator= ( const <a href="tqpicture.html">TQPicture</a> & p )
|
||
13 years ago
|
</h3>
|
||
|
Assigns a <a href="shclass.html">shallow copy</a> of <em>p</em> to this
|
||
|
picture and returns a reference to this picture.
|
||
|
|
||
5 months ago
|
<h3 class=fn>bool <a name="play"></a>TQPicture::play ( <a href="tqpainter.html">TQPainter</a> * painter )
|
||
13 years ago
|
</h3>
|
||
|
Replays the picture using <em>painter</em>, and returns TRUE if
|
||
|
successful; otherwise returns FALSE.
|
||
5 months ago
|
<p> This function does exactly the same as <a href="tqpainter.html#drawPicture">TQPainter::drawPicture</a>()
|
||
13 years ago
|
with (x, y) = (0, 0).
|
||
|
|
||
6 months ago
|
<h3 class=fn>bool <a name="save"></a>TQPicture::save ( const <a href="tqstring.html">TQString</a> & fileName, const char * format = 0 )
|
||
13 years ago
|
</h3>
|
||
|
Saves a picture to the file specified by <em>fileName</em> and returns
|
||
|
TRUE if successful; otherwise returns FALSE.
|
||
|
<p> Specifying the file <em>format</em> 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.
|
||
|
<p> Currently, the only external format supported is the <a href="http://www.w3.org/Graphics/SVG/">W3C SVG</a> format which
|
||
13 years ago
|
requires the <a href="xml.html">TQt XML module</a>. The
|
||
13 years ago
|
corresponding <em>format</em> string is "svg".
|
||
|
<p> <p>See also <a href="#load">load</a>().
|
||
|
|
||
|
<p>Example: <a href="picture-example.html#x123">picture/picture.cpp</a>.
|
||
5 months ago
|
<h3 class=fn>bool <a name="save-2"></a>TQPicture::save ( <a href="tqiodevice.html">TQIODevice</a> * dev, const char * format = 0 )
|
||
13 years ago
|
</h3>
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p> <em>dev</em> is the device to use for saving.
|
||
|
|
||
5 months ago
|
<h3 class=fn>void <a name="setBoundingRect"></a>TQPicture::setBoundingRect ( const <a href="tqrect.html">TQRect</a> & r )
|
||
13 years ago
|
</h3>
|
||
|
Sets the picture's bounding rectangle to <em>r</em>. The automatically
|
||
|
calculated value is overriden.
|
||
|
|
||
|
<h3 class=fn>void <a name="setData"></a>TQPicture::setData ( const char * data, uint size )<tt> [virtual]</tt>
|
||
|
</h3>
|
||
|
Sets the picture data directly from <em>data</em> and <em>size</em>. This
|
||
|
function copies the input data.
|
||
|
<p> <p>See also <a href="#data">data</a>() and <a href="#size">size</a>().
|
||
|
|
||
|
<h3 class=fn>uint <a name="size"></a>TQPicture::size () const
|
||
|
</h3>
|
||
|
|
||
|
<p> Returns the size of the picture data.
|
||
|
<p> <p>See also <a href="#data">data</a>().
|
||
|
|
||
|
<hr><h2>Related Functions</h2>
|
||
5 months ago
|
<h3 class=fn><a href="tqdatastream.html">TQDataStream</a> & <a name="operator-lt-lt"></a>operator<< ( <a href="tqdatastream.html">TQDataStream</a> & s, const <a href="tqpicture.html">TQPicture</a> & r )
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p> Writes picture <em>r</em> to the stream <em>s</em> and returns a reference to
|
||
|
the stream.
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqdatastream.html">TQDataStream</a> & <a name="operator-gt-gt"></a>operator>> ( <a href="tqdatastream.html">TQDataStream</a> & s, <a href="tqpicture.html">TQPicture</a> & r )
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p> Reads a picture from the stream <em>s</em> into picture <em>r</em> and returns
|
||
|
a reference to the stream.
|
||
|
|
||
|
<!-- eof -->
|
||
|
<hr><p>
|
||
|
This file is part of the <a href="index.html">TQt toolkit</a>.
|
||
|
Copyright © 1995-2007
|
||
|
<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 © 2007
|
||
|
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
||
|
<td align=right><div align=right>TQt 3.3.8</div>
|
||
|
</table></div></address></body>
|
||
|
</html>
|