summaryrefslogtreecommitdiffstats
path: root/doc/html/qcanvaspixmap.html
blob: cb4424b9a0717b590746536cc51be19b6f964ccb (plain)
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/canvas/qcanvas.cpp:2800 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QCanvasPixmap 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&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;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>QCanvasPixmap Class Reference<br><small>[<a href="canvas.html">canvas module</a>]</small></h1>

<p>The QCanvasPixmap class provides pixmaps for QCanvasSprites.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qcanvas-h.html">qcanvas.h</a>&gt;</tt>
<p>Inherits <a href="qpixmap.html">QPixmap</a>.
<p><a href="qcanvaspixmap-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#QCanvasPixmap"><b>QCanvasPixmap</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;datafilename )</li>
<li class=fn><a href="#QCanvasPixmap-2"><b>QCanvasPixmap</b></a> ( const&nbsp;QImage&nbsp;&amp;&nbsp;image )</li>
<li class=fn><a href="#QCanvasPixmap-3"><b>QCanvasPixmap</b></a> ( const&nbsp;QPixmap&nbsp;&amp;&nbsp;pm, const&nbsp;QPoint&nbsp;&amp;&nbsp;offset )</li>
<li class=fn><a href="#~QCanvasPixmap"><b>~QCanvasPixmap</b></a> ()</li>
<li class=fn>int <a href="#offsetX"><b>offsetX</b></a> () const</li>
<li class=fn>int <a href="#offsetY"><b>offsetY</b></a> () const</li>
<li class=fn>void <a href="#setOffset"><b>setOffset</b></a> ( int&nbsp;x, int&nbsp;y )</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>


The QCanvasPixmap class provides pixmaps for QCanvasSprites.

<p> 


<p> If you want to show a single pixmap on a <a href="qcanvas.html">QCanvas</a> use a
<a href="qcanvassprite.html">QCanvasSprite</a> with just one pixmap.
<p> When pixmaps are inserted into a <a href="qcanvaspixmaparray.html">QCanvasPixmapArray</a> they are held
as QCanvasPixmaps. <a href="qcanvassprite.html">QCanvasSprite</a>s are used to show pixmaps on
<a href="qcanvas.html">QCanvas</a>es and hold their pixmaps in a QCanvasPixmapArray. If
you retrieve a frame (pixmap) from a QCanvasSprite it will be
returned as a QCanvasPixmap.
<p> The pixmap is a <a href="qpixmap.html">QPixmap</a> and can only be set in the constructor.
There are three different constructors, one taking a QPixmap, one
a <a href="qimage.html">QImage</a> and one a file name that refers to a file in any
supported file format (see <a href="qimageio.html">QImageIO</a>).
<p> QCanvasPixmap can have a hotspot which is defined in terms of an (x,
y) offset. When you create a QCanvasPixmap from a PNG file or from
a QImage that has a <a href="qimage.html#offset">QImage::offset</a>(), the offset() is initialized
appropriately, otherwise the constructor leaves it at (0, 0). You
can set it later using <a href="#setOffset">setOffset</a>(). When the QCanvasPixmap is used
in a <a href="qcanvassprite.html">QCanvasSprite</a>, the offset position is the point at
<a href="qcanvasitem.html#x">QCanvasItem::x</a>() and <a href="qcanvasitem.html#y">QCanvasItem::y</a>(), not the top-left corner of
the pixmap.
<p> Note that for QCanvasPixmap objects created by a QCanvasSprite, the
position of each QCanvasPixmap object is set so that the hotspot
stays in the same position.
<p> <p>See also <a href="qcanvaspixmaparray.html">QCanvasPixmapArray</a>, <a href="qcanvasitem.html">QCanvasItem</a>, <a href="qcanvassprite.html">QCanvasSprite</a>, <a href="graphics.html">Graphics Classes</a>, and <a href="images.html">Image Processing Classes</a>.

<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QCanvasPixmap"></a>QCanvasPixmap::QCanvasPixmap ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;datafilename )
</h3>
Constructs a QCanvasPixmap that uses the image stored in <em>datafilename</em>.

<h3 class=fn><a name="QCanvasPixmap-2"></a>QCanvasPixmap::QCanvasPixmap ( const&nbsp;<a href="qimage.html">QImage</a>&nbsp;&amp;&nbsp;image )
</h3>
Constructs a QCanvasPixmap from the image <em>image</em>.

<h3 class=fn><a name="QCanvasPixmap-3"></a>QCanvasPixmap::QCanvasPixmap ( const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp;&nbsp;pm, const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;offset )
</h3>
Constructs a QCanvasPixmap from the pixmap <em>pm</em> using the offset
<em>offset</em>.

<h3 class=fn><a name="~QCanvasPixmap"></a>QCanvasPixmap::~QCanvasPixmap ()
</h3>
Destroys the pixmap.

<h3 class=fn>int <a name="offsetX"></a>QCanvasPixmap::offsetX () const
</h3>

<p> Returns the x-offset of the pixmap's hotspot.
<p> <p>See also <a href="#setOffset">setOffset</a>().

<h3 class=fn>int <a name="offsetY"></a>QCanvasPixmap::offsetY () const
</h3>

<p> Returns the y-offset of the pixmap's hotspot.
<p> <p>See also <a href="#setOffset">setOffset</a>().

<h3 class=fn>void <a name="setOffset"></a>QCanvasPixmap::setOffset ( int&nbsp;x, int&nbsp;y )
</h3>

<p> Sets the offset of the pixmap's hotspot to (<em>x</em>, <em>y</em>).
<p> <b>Warning:</b> Do not call this function if any QCanvasSprites are
currently showing this pixmap.

<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>.
Copyright &copy; 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 &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt 3.3.8</div>
</table></div></address></body>
</html>