source: trunk/doc/html/qimage.html@ 208

Last change on this file since 208 was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 69.0 KB
Line 
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/qimage.cpp:69 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>QImage Class</title>
7<style type="text/css"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { 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&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;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&nbsp;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>QImage Class Reference</h1>
33
34<p>The QImage class provides a hardware-independent pixmap
35representation with direct access to the pixel data.
36<a href="#details">More...</a>
37<p><tt>#include &lt;<a href="qimage-h.html">qimage.h</a>&gt;</tt>
38<p><a href="qimage-members.html">List of all member functions.</a>
39<h2>Public Members</h2>
40<ul>
41<li class=fn>enum <a href="#Endian-enum"><b>Endian</b></a> { IgnoreEndian, BigEndian, LittleEndian }</li>
42<li class=fn><a href="#QImage"><b>QImage</b></a> ()</li>
43<li class=fn><a href="#QImage-2"><b>QImage</b></a> ( int&nbsp;w, int&nbsp;h, int&nbsp;depth, int&nbsp;numColors = 0, Endian&nbsp;bitOrder = IgnoreEndian )</li>
44<li class=fn><a href="#QImage-3"><b>QImage</b></a> ( const&nbsp;QSize&nbsp;&amp;&nbsp;size, int&nbsp;depth, int&nbsp;numColors = 0, Endian&nbsp;bitOrder = IgnoreEndian )</li>
45<li class=fn><a href="#QImage-4"><b>QImage</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;fileName, const&nbsp;char&nbsp;*&nbsp;format = 0 )</li>
46<li class=fn><a href="#QImage-5"><b>QImage</b></a> ( const&nbsp;char&nbsp;*&nbsp;const&nbsp;xpm[] )</li>
47<li class=fn><a href="#QImage-6"><b>QImage</b></a> ( const&nbsp;QByteArray&nbsp;&amp;&nbsp;array )</li>
48<li class=fn><a href="#QImage-7"><b>QImage</b></a> ( uchar&nbsp;*&nbsp;yourdata, int&nbsp;w, int&nbsp;h, int&nbsp;depth, QRgb&nbsp;*&nbsp;colortable, int&nbsp;numColors, Endian&nbsp;bitOrder )</li>
49<li class=fn><a href="#QImage-8"><b>QImage</b></a> ( uchar&nbsp;*&nbsp;yourdata, int&nbsp;w, int&nbsp;h, int&nbsp;depth, int&nbsp;bpl, QRgb&nbsp;*&nbsp;colortable, int&nbsp;numColors, Endian&nbsp;bitOrder )</li>
50<li class=fn><a href="#QImage-9"><b>QImage</b></a> ( const&nbsp;QImage&nbsp;&amp;&nbsp;image )</li>
51<li class=fn><a href="#~QImage"><b>~QImage</b></a> ()</li>
52<li class=fn>QImage &amp; <a href="#operator-eq"><b>operator=</b></a> ( const&nbsp;QImage&nbsp;&amp;&nbsp;image )</li>
53<li class=fn>QImage &amp; <a href="#operator-eq-2"><b>operator=</b></a> ( const&nbsp;QPixmap&nbsp;&amp;&nbsp;pixmap )</li>
54<li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const&nbsp;QImage&nbsp;&amp;&nbsp;i ) const</li>
55<li class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const&nbsp;QImage&nbsp;&amp;&nbsp;i ) const</li>
56<li class=fn>void <a href="#detach"><b>detach</b></a> ()</li>
57<li class=fn>QImage <a href="#copy"><b>copy</b></a> () const</li>
58<li class=fn>QImage <a href="#copy-2"><b>copy</b></a> ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h, int&nbsp;conversion_flags = 0 ) const</li>
59<li class=fn>QImage <a href="#copy-3"><b>copy</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r ) const</li>
60<li class=fn>bool <a href="#isNull"><b>isNull</b></a> () const</li>
61<li class=fn>int <a href="#width"><b>width</b></a> () const</li>
62<li class=fn>int <a href="#height"><b>height</b></a> () const</li>
63<li class=fn>QSize <a href="#size"><b>size</b></a> () const</li>
64<li class=fn>QRect <a href="#rect"><b>rect</b></a> () const</li>
65<li class=fn>int <a href="#depth"><b>depth</b></a> () const</li>
66<li class=fn>int <a href="#numColors"><b>numColors</b></a> () const</li>
67<li class=fn>Endian <a href="#bitOrder"><b>bitOrder</b></a> () const</li>
68<li class=fn>QRgb <a href="#color"><b>color</b></a> ( int&nbsp;i ) const</li>
69<li class=fn>void <a href="#setColor"><b>setColor</b></a> ( int&nbsp;i, QRgb&nbsp;c )</li>
70<li class=fn>void <a href="#setNumColors"><b>setNumColors</b></a> ( int&nbsp;numColors )</li>
71<li class=fn>bool <a href="#hasAlphaBuffer"><b>hasAlphaBuffer</b></a> () const</li>
72<li class=fn>void <a href="#setAlphaBuffer"><b>setAlphaBuffer</b></a> ( bool&nbsp;enable )</li>
73<li class=fn>bool <a href="#allGray"><b>allGray</b></a> () const</li>
74<li class=fn>bool <a href="#isGrayscale"><b>isGrayscale</b></a> () const</li>
75<li class=fn>uchar * <a href="#bits"><b>bits</b></a> () const</li>
76<li class=fn>uchar * <a href="#scanLine"><b>scanLine</b></a> ( int&nbsp;i ) const</li>
77<li class=fn>uchar ** <a href="#jumpTable"><b>jumpTable</b></a> () const</li>
78<li class=fn>QRgb * <a href="#colorTable"><b>colorTable</b></a> () const</li>
79<li class=fn>int <a href="#numBytes"><b>numBytes</b></a> () const</li>
80<li class=fn>int <a href="#bytesPerLine"><b>bytesPerLine</b></a> () const</li>
81<li class=fn>bool <a href="#create"><b>create</b></a> ( int&nbsp;width, int&nbsp;height, int&nbsp;depth, int&nbsp;numColors = 0, Endian&nbsp;bitOrder = IgnoreEndian )</li>
82<li class=fn>bool <a href="#create-2"><b>create</b></a> ( const QSize &amp;, int&nbsp;depth, int&nbsp;numColors = 0, Endian&nbsp;bitOrder = IgnoreEndian )</li>
83<li class=fn>void <a href="#reset"><b>reset</b></a> ()</li>
84<li class=fn>void <a href="#fill"><b>fill</b></a> ( uint&nbsp;pixel )</li>
85<li class=fn>void <a href="#invertPixels"><b>invertPixels</b></a> ( bool&nbsp;invertAlpha = TRUE )</li>
86<li class=fn>QImage <a href="#convertDepth-2"><b>convertDepth</b></a> ( int&nbsp;depth ) const</li>
87<li class=fn>QImage <a href="#convertDepthWithPalette"><b>convertDepthWithPalette</b></a> ( int&nbsp;d, QRgb&nbsp;*&nbsp;palette, int&nbsp;palette_count, int&nbsp;conversion_flags = 0 ) const</li>
88<li class=fn>QImage <a href="#convertDepth"><b>convertDepth</b></a> ( int&nbsp;depth, int&nbsp;conversion_flags ) const</li>
89<li class=fn>QImage <a href="#convertBitOrder"><b>convertBitOrder</b></a> ( Endian&nbsp;bitOrder ) const</li>
90<li class=fn>enum <a href="#ScaleMode-enum"><b>ScaleMode</b></a> { ScaleFree, ScaleMin, ScaleMax }</li>
91<li class=fn>QImage <a href="#smoothScale"><b>smoothScale</b></a> ( int&nbsp;w, int&nbsp;h, ScaleMode&nbsp;mode = ScaleFree ) const</li>
92<li class=fn>QImage <a href="#smoothScale-2"><b>smoothScale</b></a> ( const&nbsp;QSize&nbsp;&amp;&nbsp;s, ScaleMode&nbsp;mode = ScaleFree ) const</li>
93<li class=fn>QImage <a href="#scale"><b>scale</b></a> ( int&nbsp;w, int&nbsp;h, ScaleMode&nbsp;mode = ScaleFree ) const</li>
94<li class=fn>QImage <a href="#scale-2"><b>scale</b></a> ( const&nbsp;QSize&nbsp;&amp;&nbsp;s, ScaleMode&nbsp;mode = ScaleFree ) const</li>
95<li class=fn>QImage <a href="#scaleWidth"><b>scaleWidth</b></a> ( int&nbsp;w ) const</li>
96<li class=fn>QImage <a href="#scaleHeight"><b>scaleHeight</b></a> ( int&nbsp;h ) const</li>
97<li class=fn>QImage <a href="#xForm"><b>xForm</b></a> ( const&nbsp;QWMatrix&nbsp;&amp;&nbsp;matrix ) const</li>
98<li class=fn>QImage <a href="#createAlphaMask"><b>createAlphaMask</b></a> ( int&nbsp;conversion_flags = 0 ) const</li>
99<li class=fn>QImage <a href="#createHeuristicMask"><b>createHeuristicMask</b></a> ( bool&nbsp;clipTight = TRUE ) const</li>
100<li class=fn>QImage <a href="#mirror"><b>mirror</b></a> () const</li>
101<li class=fn>QImage <a href="#mirror-2"><b>mirror</b></a> ( bool&nbsp;horizontal, bool&nbsp;vertical ) const</li>
102<li class=fn>QImage <a href="#swapRGB"><b>swapRGB</b></a> () const</li>
103<li class=fn>bool <a href="#load"><b>load</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;fileName, const&nbsp;char&nbsp;*&nbsp;format = 0 )</li>
104<li class=fn>bool <a href="#loadFromData"><b>loadFromData</b></a> ( const&nbsp;uchar&nbsp;*&nbsp;buf, uint&nbsp;len, const&nbsp;char&nbsp;*&nbsp;format = 0 )</li>
105<li class=fn>bool <a href="#loadFromData-2"><b>loadFromData</b></a> ( QByteArray&nbsp;buf, const&nbsp;char&nbsp;*&nbsp;format = 0 )</li>
106<li class=fn>bool <a href="#save"><b>save</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;fileName, const&nbsp;char&nbsp;*&nbsp;format, int&nbsp;quality = -1 ) const</li>
107<li class=fn>bool <a href="#save-2"><b>save</b></a> ( QIODevice&nbsp;*&nbsp;device, const&nbsp;char&nbsp;*&nbsp;format, int&nbsp;quality = -1 ) const</li>
108<li class=fn>bool <a href="#valid"><b>valid</b></a> ( int&nbsp;x, int&nbsp;y ) const</li>
109<li class=fn>int <a href="#pixelIndex"><b>pixelIndex</b></a> ( int&nbsp;x, int&nbsp;y ) const</li>
110<li class=fn>QRgb <a href="#pixel"><b>pixel</b></a> ( int&nbsp;x, int&nbsp;y ) const</li>
111<li class=fn>void <a href="#setPixel"><b>setPixel</b></a> ( int&nbsp;x, int&nbsp;y, uint&nbsp;index_or_rgb )</li>
112<li class=fn>int <a href="#dotsPerMeterX"><b>dotsPerMeterX</b></a> () const</li>
113<li class=fn>int <a href="#dotsPerMeterY"><b>dotsPerMeterY</b></a> () const</li>
114<li class=fn>void <a href="#setDotsPerMeterX"><b>setDotsPerMeterX</b></a> ( int&nbsp;x )</li>
115<li class=fn>void <a href="#setDotsPerMeterY"><b>setDotsPerMeterY</b></a> ( int&nbsp;y )</li>
116<li class=fn>QPoint <a href="#offset"><b>offset</b></a> () const</li>
117<li class=fn>void <a href="#setOffset"><b>setOffset</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;p )</li>
118<li class=fn>QValueList&lt;QImageTextKeyLang&gt; <a href="#textList"><b>textList</b></a> () const</li>
119<li class=fn>QStringList <a href="#textLanguages"><b>textLanguages</b></a> () const</li>
120<li class=fn>QStringList <a href="#textKeys"><b>textKeys</b></a> () const</li>
121<li class=fn>QString <a href="#text"><b>text</b></a> ( const&nbsp;char&nbsp;*&nbsp;key, const&nbsp;char&nbsp;*&nbsp;lang = 0 ) const</li>
122<li class=fn>QString <a href="#text-2"><b>text</b></a> ( const&nbsp;QImageTextKeyLang&nbsp;&amp;&nbsp;kl ) const</li>
123<li class=fn>void <a href="#setText"><b>setText</b></a> ( const&nbsp;char&nbsp;*&nbsp;key, const&nbsp;char&nbsp;*&nbsp;lang, const&nbsp;QString&nbsp;&amp;&nbsp;s )</li>
124</ul>
125<h2>Static Public Members</h2>
126<ul>
127<li class=fn>QImage <a href="#fromMimeSource"><b>fromMimeSource</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;abs_name )</li>
128<li class=fn>Endian <a href="#systemBitOrder"><b>systemBitOrder</b></a> ()</li>
129<li class=fn>Endian <a href="#systemByteOrder"><b>systemByteOrder</b></a> ()</li>
130<li class=fn>const char * <a href="#imageFormat"><b>imageFormat</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;fileName )</li>
131<li class=fn>QStrList <a href="#inputFormats"><b>inputFormats</b></a> ()</li>
132<li class=fn>QStrList <a href="#outputFormats"><b>outputFormats</b></a> ()</li>
133<li class=fn>QStringList <a href="#inputFormatList"><b>inputFormatList</b></a> ()</li>
134<li class=fn>QStringList <a href="#outputFormatList"><b>outputFormatList</b></a> ()</li>
135</ul>
136<h2>Related Functions</h2>
137<ul>
138<li class=fn>QDataStream &amp; <a href="#operator-lt-lt"><b>operator&lt;&lt;</b></a> ( QDataStream&nbsp;&amp;&nbsp;s, const&nbsp;QImage&nbsp;&amp;&nbsp;image )</li>
139<li class=fn>QDataStream &amp; <a href="#operator-gt-gt"><b>operator&gt;&gt;</b></a> ( QDataStream&nbsp;&amp;&nbsp;s, QImage&nbsp;&amp;&nbsp;image )</li>
140<li class=fn>void <a href="#bitBlt"><b>bitBlt</b></a> ( QImage&nbsp;*&nbsp;dst, int&nbsp;dx, int&nbsp;dy, const&nbsp;QImage&nbsp;*&nbsp;src, int&nbsp;sx, int&nbsp;sy, int&nbsp;sw, int&nbsp;sh, int&nbsp;conversion_flags )</li>
141</ul>
142<hr><a name="details"></a><h2>Detailed Description</h2>
143
144
145The QImage class provides a hardware-independent pixmap
146representation with direct access to the pixel data.
147<p>
148
149
150
151<p> It is one of the two classes Qt provides for dealing with images,
152the other being <a href="qpixmap.html">QPixmap</a>. QImage is designed and optimized for I/O
153and for direct pixel access/manipulation. QPixmap is designed and
154optimized for drawing. There are (slow) functions to convert
155between QImage and QPixmap: <a href="qpixmap.html#convertToImage">QPixmap::convertToImage</a>() and
156<a href="qpixmap.html#convertFromImage">QPixmap::convertFromImage</a>().
157<p> An image has the parameters <a href="#width">width</a>, <a href="#height">height</a> and <a href="#depth">depth</a> (bits per
158pixel, bpp), a color table and the actual <a href="#bits">pixels</a>. QImage supports 1-bpp, 8-bpp and 32-bpp image
159data. 1-bpp and 8-bpp images use a color lookup table; the pixel
160value is a color table index.
161<p> 32-bpp images encode an RGB value in 24 bits and ignore the color
162table. The most significant byte is used for the <a href="#setAlphaBuffer">alpha buffer</a>.
163<p> An entry in the color table is an RGB triplet encoded as a <tt>uint</tt>. Use the <a href="qcolor.html#qRed">qRed()</a>, <a href="qcolor.html#qGreen">qGreen()</a> and <a href="qcolor.html#qBlue">qBlue()</a> functions (<a href="qcolor-h.html">qcolor.h</a>) to access the components, and <a href="qcolor.html#qRgb">qRgb</a> to make an RGB triplet (see the <a href="qcolor.html">QColor</a> class
164documentation).
165<p> 1-bpp (monochrome) images have a color table with a most two
166colors. There are two different formats: big endian (MSB first) or
167little endian (LSB first) bit order. To access a single bit you
168will must do some bit shifts:
169<p> <pre>
170 QImage image;
171 // sets bit at (x,y) to 1
172 if ( image.<a href="#bitOrder">bitOrder</a>() == QImage::<a href="#Endian-enum">LittleEndian</a> )
173 *(image.<a href="#scanLine">scanLine</a>(y) + (x &gt;&gt; 3)) |= 1 &lt;&lt; (x &amp; 7);
174 else
175 *(image.<a href="#scanLine">scanLine</a>(y) + (x &gt;&gt; 3)) |= 1 &lt;&lt; (7 - (x &amp; 7));
176 </pre>
177
178<p> If this looks complicated, it might be a good idea to convert the
1791-bpp image to an 8-bpp image using <a href="#convertDepth">convertDepth</a>().
180<p> 8-bpp images are much easier to work with than 1-bpp images
181because they have a single byte per pixel:
182<p> <pre>
183 QImage image;
184 // set entry 19 in the color table to yellow
185 image.<a href="#setColor">setColor</a>( 19, qRgb(255,255,0) );
186 // set 8 bit pixel at (x,y) to value yellow (in color table)
187 *(image.<a href="#scanLine">scanLine</a>(y) + x) = 19;
188 </pre>
189
190<p> 32-bpp images ignore the color table; instead, each pixel contains
191the RGB triplet. 24 bits contain the RGB value; the most
192significant byte is reserved for the alpha buffer.
193<p> <pre>
194 QImage image;
195 // sets 32 bit pixel at (x,y) to yellow.
196 uint *p = (uint *)image.<a href="#scanLine">scanLine</a>(y) + x;
197 *p = <a href="qcolor.html#qRgb">qRgb</a>(255,255,0);
198 </pre>
199
200<p> On Qt/Embedded, scanlines are aligned to the pixel depth and may
201be padded to any degree, while on all other platforms, the
202scanlines are 32-bit aligned for all depths. The constructor
203taking a <tt>uchar*</tt> argument always expects 32-bit aligned data.
204On Qt/Embedded, an additional constructor allows the number of
205bytes-per-line to be specified.
206<p> QImage supports a variety of methods for getting information about
207the image, for example, <a href="#colorTable">colorTable</a>(), <a href="#allGray">allGray</a>(), <a href="#isGrayscale">isGrayscale</a>(),
208<a href="#bitOrder">bitOrder</a>(), <a href="#bytesPerLine">bytesPerLine</a>(), <a href="#depth">depth</a>(), <a href="#dotsPerMeterX">dotsPerMeterX</a>() and
209<a href="#dotsPerMeterY">dotsPerMeterY</a>(), <a href="#hasAlphaBuffer">hasAlphaBuffer</a>(), <a href="#numBytes">numBytes</a>(), <a href="#numColors">numColors</a>(), and
210<a href="#width">width</a>() and <a href="#height">height</a>().
211<p> Pixel colors are retrieved with <a href="#pixel">pixel</a>() and set with <a href="#setPixel">setPixel</a>().
212<p> QImage also supports a number of functions for creating a new
213image that is a transformed version of the original. For example,
214<a href="#copy">copy</a>(), <a href="#convertBitOrder">convertBitOrder</a>(), <a href="#convertDepth">convertDepth</a>(), <a href="#createAlphaMask">createAlphaMask</a>(),
215<a href="#createHeuristicMask">createHeuristicMask</a>(), <a href="#mirror">mirror</a>(), <a href="#scale">scale</a>(), <a href="#smoothScale">smoothScale</a>(), <a href="#swapRGB">swapRGB</a>()
216and <a href="#xForm">xForm</a>(). There are also functions for changing attributes of
217an image in-place, for example, <a href="#setAlphaBuffer">setAlphaBuffer</a>(), <a href="#setColor">setColor</a>(),
218<a href="#setDotsPerMeterX">setDotsPerMeterX</a>() and <a href="#setDotsPerMeterY">setDotsPerMeterY</a>() and <a href="#setNumColors">setNumColors</a>().
219<p> Images can be loaded and saved in the supported formats. Images
220are saved to a file with <a href="#save">save</a>(). Images are loaded from a file
221with <a href="#load">load</a>() (or in the constructor) or from an array of data with
222<a href="#loadFromData">loadFromData</a>(). The lists of supported formats are available from
223<a href="#inputFormatList">inputFormatList</a>() and <a href="#outputFormatList">outputFormatList</a>().
224<p> Strings of text may be added to images using <a href="#setText">setText</a>().
225<p> The QImage class uses explicit <a href="shclass.html">sharing</a>,
226similar to that used by <a href="qmemarray.html">QMemArray</a>.
227<p> New image formats can be added as <a href="plugins-howto.html">plugins</a>.
228<p> <p>See also <a href="qimageio.html">QImageIO</a>, <a href="qpixmap.html">QPixmap</a>, <a href="shclass.html">Shared Classes</a>, <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>.
229
230<hr><h2>Member Type Documentation</h2>
231<h3 class=fn><a name="Endian-enum"></a>QImage::Endian</h3>
232
233<p> This enum type is used to describe the endianness of the CPU and
234graphics hardware.
235<ul>
236<li><tt>QImage::IgnoreEndian</tt> - Endianness does not matter. Useful for some
237operations that are independent of endianness.
238<li><tt>QImage::BigEndian</tt> - Network byte order, as on SPARC and Motorola CPUs.
239<li><tt>QImage::LittleEndian</tt> - PC/Alpha byte order.
240</ul>
241<h3 class=fn><a name="ScaleMode-enum"></a>QImage::ScaleMode</h3>
242
243<p> The functions <a href="#scale">scale</a>() and <a href="#smoothScale">smoothScale</a>() use different modes for
244scaling the image. The purpose of these modes is to retain the
245ratio of the image if this is required.
246<p> <center><img src="scaling.png"></center>
247<ul>
248<li><tt>QImage::ScaleFree</tt> - The image is scaled freely: the resulting image
249fits exactly into the specified size; the ratio will not
250necessarily be preserved.
251<li><tt>QImage::ScaleMin</tt> - The ratio of the image is preserved and the
252resulting image is guaranteed to fit into the specified size
253(it is as large as possible within these constraints) - the
254image might be smaller than the requested size.
255<li><tt>QImage::ScaleMax</tt> - The ratio of the image is preserved and the
256resulting image fills the whole specified rectangle (it is as
257small as possible within these constraints) - the image might
258be larger than the requested size.
259</ul>
260<hr><h2>Member Function Documentation</h2>
261<h3 class=fn><a name="QImage"></a>QImage::QImage ()
262</h3>
263Constructs a null image.
264<p> <p>See also <a href="#isNull">isNull</a>().
265
266<h3 class=fn><a name="QImage-2"></a>QImage::QImage ( int&nbsp;w, int&nbsp;h, int&nbsp;depth, int&nbsp;numColors = 0, <a href="qimage.html#Endian-enum">Endian</a>&nbsp;bitOrder = IgnoreEndian )
267</h3>
268Constructs an image with <em>w</em> width, <em>h</em> height, <em>depth</em> bits
269per pixel, <em>numColors</em> colors and bit order <em>bitOrder</em>.
270<p> Using this constructor is the same as first constructing a null
271image and then calling the <a href="#create">create</a>() function.
272<p> <p>See also <a href="#create">create</a>().
273
274<h3 class=fn><a name="QImage-3"></a>QImage::QImage ( const&nbsp;<a href="qsize.html">QSize</a>&nbsp;&amp;&nbsp;size, int&nbsp;depth, int&nbsp;numColors = 0, <a href="qimage.html#Endian-enum">Endian</a>&nbsp;bitOrder = IgnoreEndian )
275</h3>
276Constructs an image with size <em>size</em> pixels, depth <em>depth</em> bits,
277<em>numColors</em> and <em>bitOrder</em> endianness.
278<p> Using this constructor is the same as first constructing a null
279image and then calling the <a href="#create">create</a>() function.
280<p> <p>See also <a href="#create">create</a>().
281
282<h3 class=fn><a name="QImage-4"></a>QImage::QImage ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;fileName, const&nbsp;char&nbsp;*&nbsp;format = 0 )
283</h3>
284Constructs an image and tries to load the image from the file <em>fileName</em>.
285<p> If <em>format</em> is specified, the loader attempts to read the image
286using the specified format. If <em>format</em> is not specified (which
287is the default), the loader reads a few bytes from the header to
288guess the file format.
289<p> If the loading of the image failed, this object is a <a href="#isNull">null</a> image.
290<p> The <a href="qimageio.html">QImageIO</a> documentation lists the supported image formats and
291explains how to add extra formats.
292<p> <p>See also <a href="#load">load</a>(), <a href="#isNull">isNull</a>(), and <a href="qimageio.html">QImageIO</a>.
293
294<h3 class=fn><a name="QImage-5"></a>QImage::QImage ( const&nbsp;char&nbsp;*&nbsp;const&nbsp;xpm[] )
295</h3>
296Constructs an image from <em>xpm</em>, which must be a valid XPM image.
297<p> Errors are silently ignored.
298<p> Note that it's possible to squeeze the XPM variable a little bit
299by using an unusual declaration:
300<p> <pre>
301 static const char * const start_xpm[]={
302 "16 15 8 1",
303 "a c #cec6bd",
304 ....
305 </pre>
306
307<p> The extra <tt>const</tt> makes the entire definition read-only, which is
308slightly more efficient (e.g. when the code is in a shared
309library) and ROMable when the application is to be stored in ROM.
310
311<h3 class=fn><a name="QImage-6"></a>QImage::QImage ( const&nbsp;<a href="qbytearray.html">QByteArray</a>&nbsp;&amp;&nbsp;array )
312</h3>
313Constructs an image from the binary data <em>array</em>. It tries to
314guess the file format.
315<p> If the loading of the image failed, this object is a <a href="#isNull">null</a> image.
316<p> <p>See also <a href="#loadFromData">loadFromData</a>(), <a href="#isNull">isNull</a>(), and <a href="#imageFormat">imageFormat</a>().
317
318<h3 class=fn><a name="QImage-7"></a>QImage::QImage ( uchar&nbsp;*&nbsp;yourdata, int&nbsp;w, int&nbsp;h, int&nbsp;depth, QRgb&nbsp;*&nbsp;colortable, int&nbsp;numColors, <a href="qimage.html#Endian-enum">Endian</a>&nbsp;bitOrder )
319</h3>
320Constructs an image <em>w</em> pixels wide, <em>h</em> pixels high with a
321color depth of <em>depth</em>, that uses an existing memory buffer, <em>yourdata</em>. The buffer must remain valid throughout the life of the
322QImage. The image does not delete the buffer at destruction.
323<p> If <em>colortable</em> is 0, a color table sufficient for <em>numColors</em>
324will be allocated (and destructed later).
325<p> Note that <em>yourdata</em> must be 32-bit aligned.
326<p> The endianness is given in <em>bitOrder</em>.
327
328<h3 class=fn><a name="QImage-8"></a>QImage::QImage ( uchar&nbsp;*&nbsp;yourdata, int&nbsp;w, int&nbsp;h, int&nbsp;depth, int&nbsp;bpl, QRgb&nbsp;*&nbsp;colortable, int&nbsp;numColors, <a href="qimage.html#Endian-enum">Endian</a>&nbsp;bitOrder )
329</h3>
330Constructs an image that uses an existing memory buffer. The
331buffer must remain valid for the life of the QImage. The image
332does not delete the buffer at destruction. The buffer is passed as
333<em>yourdata</em>. The image's width is <em>w</em> and its height is <em>h</em>. The
334color depth is <em>depth</em>. <em>bpl</em> specifies the number of bytes per
335line.
336<p> If <em>colortable</em> is 0, a color table sufficient for <em>numColors</em>
337will be allocated (and destructed later).
338<p> The endianness is specified by <em>bitOrder</em>.
339<p> <b>Warning:</b> This constructor is only available on Qt/Embedded.
340
341<h3 class=fn><a name="QImage-9"></a>QImage::QImage ( const&nbsp;<a href="qimage.html">QImage</a>&nbsp;&amp;&nbsp;image )
342</h3>
343Constructs a <a href="shclass.html">shallow copy</a> of <em>image</em>.
344
345<h3 class=fn><a name="~QImage"></a>QImage::~QImage ()
346</h3>
347Destroys the image and cleans up.
348
349<h3 class=fn>bool <a name="allGray"></a>QImage::allGray () const
350</h3>
351Returns TRUE if all the colors in the image are shades of gray
352(i.e. their red, green and blue components are equal); otherwise
353returns FALSE.
354<p> This function is slow for large 16-bit (Qt/Embedded only) and 32-bit images.
355<p> <p>See also <a href="#isGrayscale">isGrayscale</a>().
356
357<h3 class=fn><a href="qimage.html#Endian-enum">Endian</a> <a name="bitOrder"></a>QImage::bitOrder () const
358</h3>
359
360<p> Returns the bit order for the image.
361<p> If it is a 1-bpp image, this function returns either
362QImage::BigEndian or QImage::LittleEndian.
363<p> If it is not a 1-bpp image, this function returns
364QImage::IgnoreEndian.
365<p> <p>See also <a href="#depth">depth</a>().
366
367<h3 class=fn>uchar * <a name="bits"></a>QImage::bits () const
368</h3>
369
370<p> Returns a pointer to the first pixel data. This is equivalent to
371<a href="#scanLine">scanLine</a>(0).
372<p> <p>See also <a href="#numBytes">numBytes</a>(), <a href="#scanLine">scanLine</a>(), and <a href="#jumpTable">jumpTable</a>().
373
374<p>Example: <a href="qglwidget.html#x2119">opengl/texture/gltexobj.cpp</a>.
375<h3 class=fn>int <a name="bytesPerLine"></a>QImage::bytesPerLine () const
376</h3>
377
378<p> Returns the number of bytes per image scanline. This is equivalent
379to <a href="#numBytes">numBytes</a>()/height().
380<p> <p>See also <a href="#numBytes">numBytes</a>() and <a href="#scanLine">scanLine</a>().
381
382<h3 class=fn>QRgb <a name="color"></a>QImage::color ( int&nbsp;i ) const
383</h3>
384
385<p> Returns the color in the color table at index <em>i</em>. The first
386color is at index 0.
387<p> A color value is an RGB triplet. Use the <a href="qcolor.html#qRed">qRed()</a>, <a href="qcolor.html#qGreen">qGreen()</a> and <a href="qcolor.html#qBlue">qBlue()</a> functions (defined in <a href="qcolor-h.html">qcolor.h</a>) to
388get the color value components.
389<p> <p>See also <a href="#setColor">setColor</a>(), <a href="#numColors">numColors</a>(), and <a href="qcolor.html">QColor</a>.
390
391<p>Example: <a href="themes-example.html#x207">themes/wood.cpp</a>.
392<h3 class=fn>QRgb * <a name="colorTable"></a>QImage::colorTable () const
393</h3>
394
395<p> Returns a pointer to the color table.
396<p> <p>See also <a href="#numColors">numColors</a>().
397
398<h3 class=fn><a href="qimage.html">QImage</a> <a name="convertBitOrder"></a>QImage::convertBitOrder ( <a href="qimage.html#Endian-enum">Endian</a>&nbsp;bitOrder ) const
399</h3>
400Converts the bit order of the image to <em>bitOrder</em> and returns the
401converted image. The original image is not changed.
402<p> Returns <tt>*this</tt> if the <em>bitOrder</em> is equal to the image bit
403order, or a <a href="#isNull">null</a> image if this image cannot
404be converted.
405<p> <p>See also <a href="#bitOrder">bitOrder</a>(), <a href="#systemBitOrder">systemBitOrder</a>(), and <a href="#isNull">isNull</a>().
406
407<h3 class=fn><a href="qimage.html">QImage</a> <a name="convertDepth"></a>QImage::convertDepth ( int&nbsp;depth, int&nbsp;conversion_flags ) const
408</h3>
409Converts the depth (bpp) of the image to <em>depth</em> and returns the
410converted image. The original image is not changed.
411<p> The <em>depth</em> argument must be 1, 8, 16 (Qt/Embedded only) or 32.
412<p> Returns <tt>*this</tt> if <em>depth</em> is equal to the image depth, or a
413<a href="#isNull">null</a> image if this image cannot be
414converted.
415<p> If the image needs to be modified to fit in a lower-resolution
416result (e.g. converting from 32-bit to 8-bit), use the <em>conversion_flags</em> to specify how you'd prefer this to happen.
417<p> <p>See also <a href="qt.html#ImageConversionFlags-enum">Qt::ImageConversionFlags</a>, <a href="#depth">depth</a>(), and <a href="#isNull">isNull</a>().
418
419<h3 class=fn><a href="qimage.html">QImage</a> <a name="convertDepth-2"></a>QImage::convertDepth ( int&nbsp;depth ) const
420</h3>
421This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
422<p>
423<h3 class=fn><a href="qimage.html">QImage</a> <a name="convertDepthWithPalette"></a>QImage::convertDepthWithPalette ( int&nbsp;d, QRgb&nbsp;*&nbsp;palette, int&nbsp;palette_count, int&nbsp;conversion_flags = 0 ) const
424</h3>
425Returns an image with depth <em>d</em>, using the <em>palette_count</em>
426colors pointed to by <em>palette</em>. If <em>d</em> is 1 or 8, the returned
427image will have its color table ordered the same as <em>palette</em>.
428<p> If the image needs to be modified to fit in a lower-resolution
429result (e.g. converting from 32-bit to 8-bit), use the <em>conversion_flags</em> to specify how you'd prefer this to happen.
430<p> Note: currently no closest-color search is made. If colors are
431found that are not in the palette, the palette may not be used at
432all. This result should not be considered valid because it may
433change in future implementations.
434<p> Currently inefficient for non-32-bit images.
435<p> <p>See also <a href="qt.html#ImageConversionFlags-enum">Qt::ImageConversionFlags</a>.
436
437<h3 class=fn><a href="qimage.html">QImage</a> <a name="copy"></a>QImage::copy () const
438</h3>
439Returns a <a href="shclass.html">deep copy</a> of the image.
440<p> <p>See also <a href="#detach">detach</a>().
441
442<h3 class=fn><a href="qimage.html">QImage</a> <a name="copy-2"></a>QImage::copy ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h, int&nbsp;conversion_flags = 0 ) const
443</h3>
444This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
445<p> Returns a <a href="shclass.html">deep copy</a> of a sub-area of
446the image.
447<p> The returned image is always <em>w</em> by <em>h</em> pixels in size, and is
448copied from position <em>x</em>, <em>y</em> in this image. In areas beyond
449this image pixels are filled with pixel 0.
450<p> If the image needs to be modified to fit in a lower-resolution
451result (e.g. converting from 32-bit to 8-bit), use the <em>conversion_flags</em> to specify how you'd prefer this to happen.
452<p> <p>See also <a href="#bitBlt">bitBlt</a>() and <a href="qt.html#ImageConversionFlags-enum">Qt::ImageConversionFlags</a>.
453
454<h3 class=fn><a href="qimage.html">QImage</a> <a name="copy-3"></a>QImage::copy ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r ) const
455</h3>
456This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
457<p> Returns a <a href="shclass.html">deep copy</a> of a sub-area of
458the image.
459<p> The returned image always has the size of the rectangle <em>r</em>. In
460areas beyond this image pixels are filled with pixel 0.
461
462<h3 class=fn>bool <a name="create"></a>QImage::create ( int&nbsp;width, int&nbsp;height, int&nbsp;depth, int&nbsp;numColors = 0, <a href="qimage.html#Endian-enum">Endian</a>&nbsp;bitOrder = IgnoreEndian )
463</h3>
464Sets the image <em>width</em>, <em>height</em>, <em>depth</em>, its number of colors
465(in <em>numColors</em>), and bit order. Returns TRUE if successful, or
466FALSE if the parameters are incorrect or if memory cannot be
467allocated.
468<p> The <em>width</em> and <em>height</em> is limited to 32767. <em>depth</em> must be
4691, 8, or 32. If <em>depth</em> is 1, <em>bitOrder</em> must be set to
470either QImage::LittleEndian or QImage::BigEndian. For other depths
471<em>bitOrder</em> must be QImage::IgnoreEndian.
472<p> This function allocates a color table and a buffer for the image
473data. The image data is not initialized.
474<p> The image buffer is allocated as a single block that consists of a
475table of <a href="#scanLine">scanline</a> pointers (<a href="#jumpTable">jumpTable</a>())
476and the image data (<a href="#bits">bits</a>()).
477<p> <p>See also <a href="#fill">fill</a>(), <a href="#width">width</a>(), <a href="#height">height</a>(), <a href="#depth">depth</a>(), <a href="#numColors">numColors</a>(), <a href="#bitOrder">bitOrder</a>(), <a href="#jumpTable">jumpTable</a>(), <a href="#scanLine">scanLine</a>(), <a href="#bits">bits</a>(), <a href="#bytesPerLine">bytesPerLine</a>(), and <a href="#numBytes">numBytes</a>().
478
479<h3 class=fn>bool <a name="create-2"></a>QImage::create ( const&nbsp;<a href="qsize.html">QSize</a>&nbsp;&amp;, int&nbsp;depth, int&nbsp;numColors = 0, <a href="qimage.html#Endian-enum">Endian</a>&nbsp;bitOrder = IgnoreEndian )
480</h3>
481This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
482<p>
483<h3 class=fn><a href="qimage.html">QImage</a> <a name="createAlphaMask"></a>QImage::createAlphaMask ( int&nbsp;conversion_flags = 0 ) const
484</h3>
485Builds and returns a 1-bpp mask from the alpha buffer in this
486image. Returns a <a href="#isNull">null</a> image if <a href="#setAlphaBuffer">alpha buffer mode</a> is disabled.
487<p> See <a href="qpixmap.html#convertFromImage">QPixmap::convertFromImage</a>() for a description of the <em>conversion_flags</em> argument.
488<p> The returned image has little-endian bit order, which you can
489convert to big-endianness using <a href="#convertBitOrder">convertBitOrder</a>().
490<p> <p>See also <a href="#createHeuristicMask">createHeuristicMask</a>(), <a href="#hasAlphaBuffer">hasAlphaBuffer</a>(), and <a href="#setAlphaBuffer">setAlphaBuffer</a>().
491
492<h3 class=fn><a href="qimage.html">QImage</a> <a name="createHeuristicMask"></a>QImage::createHeuristicMask ( bool&nbsp;clipTight = TRUE ) const
493</h3>
494Creates and returns a 1-bpp heuristic mask for this image. It
495works by selecting a color from one of the corners, then chipping
496away pixels of that color starting at all the edges.
497<p> The four corners vote for which color is to be masked away. In
498case of a draw (this generally means that this function is not
499applicable to the image), the result is arbitrary.
500<p> The returned image has little-endian bit order, which you can
501convert to big-endianness using <a href="#convertBitOrder">convertBitOrder</a>().
502<p> If <em>clipTight</em> is TRUE the mask is just large enough to cover the
503pixels; otherwise, the mask is larger than the data pixels.
504<p> This function disregards the <a href="#hasAlphaBuffer">alpha buffer</a>.
505<p> <p>See also <a href="#createAlphaMask">createAlphaMask</a>().
506
507<h3 class=fn>int <a name="depth"></a>QImage::depth () const
508</h3>
509
510<p> Returns the depth of the image.
511<p> The image depth is the number of bits used to encode a single
512pixel, also called bits per pixel (bpp) or bit planes of an image.
513<p> The supported depths are 1, 8, 16 (Qt/Embedded only) and 32.
514<p> <p>See also <a href="#convertDepth">convertDepth</a>().
515
516<h3 class=fn>void <a name="detach"></a>QImage::detach ()
517</h3>
518Detaches from shared image data and makes sure that this image is
519the only one referring to the data.
520<p> If multiple images share common data, this image makes a copy of
521the data and detaches itself from the sharing mechanism.
522Nothing is done if there is just a single reference.
523<p> <p>See also <a href="#copy">copy</a>().
524
525<p>Example: <a href="themes-example.html#x208">themes/wood.cpp</a>.
526<h3 class=fn>int <a name="dotsPerMeterX"></a>QImage::dotsPerMeterX () const
527</h3>
528
529<p> Returns the number of pixels that fit horizontally in a physical
530meter. This and <a href="#dotsPerMeterY">dotsPerMeterY</a>() define the intended scale and
531aspect ratio of the image.
532<p> <p>See also <a href="#setDotsPerMeterX">setDotsPerMeterX</a>().
533
534<h3 class=fn>int <a name="dotsPerMeterY"></a>QImage::dotsPerMeterY () const
535</h3>
536
537<p> Returns the number of pixels that fit vertically in a physical
538meter. This and <a href="#dotsPerMeterX">dotsPerMeterX</a>() define the intended scale and
539aspect ratio of the image.
540<p> <p>See also <a href="#setDotsPerMeterY">setDotsPerMeterY</a>().
541
542<h3 class=fn>void <a name="fill"></a>QImage::fill ( uint&nbsp;pixel )
543</h3>
544Fills the entire image with the pixel value <em>pixel</em>.
545<p> If the <a href="#depth">depth</a> of this image is 1, only the
546lowest bit is used. If you say <a href="#fill">fill</a>(0), fill(2), etc., the image
547is filled with 0s. If you say fill(1), fill(3), etc., the image is
548filled with 1s. If the depth is 8, the lowest 8 bits are used.
549<p> If the depth is 32 and the image has no alpha buffer, the <em>pixel</em>
550value is written to each pixel in the image. If the image has an
551alpha buffer, only the 24 RGB bits are set and the upper 8 bits
552(alpha value) are left unchanged.
553<p> Note: <a href="#pixel">QImage::pixel</a>() returns the color of the pixel at the given
554coordinates; <a href="qcolor.html#pixel">QColor::pixel</a>() returns the pixel value of the
555underlying window system (essentially an index value), so normally
556you will want to use QImage::pixel() to use a color from an
557existing image or <a href="qcolor.html#rgb">QColor::rgb</a>() to use a specific color.
558<p> <p>See also <a href="#invertPixels">invertPixels</a>(), <a href="#depth">depth</a>(), <a href="#hasAlphaBuffer">hasAlphaBuffer</a>(), and <a href="#create">create</a>().
559
560<h3 class=fn><a href="qimage.html">QImage</a> <a name="fromMimeSource"></a>QImage::fromMimeSource ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;abs_name )<tt> [static]</tt>
561</h3> Convenience function. Gets the data associated with the absolute
562name <em>abs_name</em> from the default mime source factory and decodes it
563to an image.
564<p> <p>See also <a href="qmimesourcefactory.html">QMimeSourceFactory</a>, <a href="#fromMimeSource">QImage::fromMimeSource</a>(), and <a href="qimagedrag.html#decode">QImageDrag::decode</a>().
565
566<h3 class=fn>bool <a name="hasAlphaBuffer"></a>QImage::hasAlphaBuffer () const
567</h3>
568
569<p> Returns TRUE if alpha buffer mode is enabled; otherwise returns
570FALSE.
571<p> <p>See also <a href="#setAlphaBuffer">setAlphaBuffer</a>().
572
573<h3 class=fn>int <a name="height"></a>QImage::height () const
574</h3>
575
576<p> Returns the height of the image.
577<p> <p>See also <a href="#width">width</a>(), <a href="#size">size</a>(), and <a href="#rect">rect</a>().
578
579<p>Examples: <a href="canvas-example.html#x2932">canvas/canvas.cpp</a> and <a href="qglwidget.html#x2120">opengl/texture/gltexobj.cpp</a>.
580<h3 class=fn>const char * <a name="imageFormat"></a>QImage::imageFormat ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;fileName )<tt> [static]</tt>
581</h3>
582Returns a string that specifies the image format of the file <em>fileName</em>, or 0 if the file cannot be read or if the format is not
583recognized.
584<p> The <a href="qimageio.html">QImageIO</a> documentation lists the guaranteed supported image
585formats, or use <a href="#inputFormats">QImage::inputFormats</a>() and <a href="#outputFormats">QImage::outputFormats</a>()
586to get lists that include the installed formats.
587<p> <p>See also <a href="#load">load</a>() and <a href="#save">save</a>().
588
589<h3 class=fn><a href="qstringlist.html">QStringList</a> <a name="inputFormatList"></a>QImage::inputFormatList ()<tt> [static]</tt>
590</h3>
591Returns a list of image formats that are supported for image
592input.
593<p> Note that if you want to iterate over the list, you should iterate
594over a copy, e.g.
595<pre>
596 <a href="qstringlist.html">QStringList</a> list = myImage.inputFormatList();
597 QStringList::Iterator it = list.<a href="qvaluelist.html#begin">begin</a>();
598 while( it != list.<a href="qvaluelist.html#end">end</a>() ) {
599 myProcessing( *it );
600 ++it;
601 }
602 </pre>
603
604<p> <p>See also <a href="#outputFormatList">outputFormatList</a>(), <a href="#inputFormats">inputFormats</a>(), and <a href="qimageio.html">QImageIO</a>.
605
606<p>Example: <a href="showimg-example.html#x1321">showimg/showimg.cpp</a>.
607<h3 class=fn><a href="qstrlist.html">QStrList</a> <a name="inputFormats"></a>QImage::inputFormats ()<tt> [static]</tt>
608</h3>
609Returns a list of image formats that are supported for image
610input.
611<p> <p>See also <a href="#outputFormats">outputFormats</a>(), <a href="#inputFormatList">inputFormatList</a>(), and <a href="qimageio.html">QImageIO</a>.
612
613<h3 class=fn>void <a name="invertPixels"></a>QImage::invertPixels ( bool&nbsp;invertAlpha = TRUE )
614</h3>
615Inverts all pixel values in the image.
616<p> If the depth is 32: if <em>invertAlpha</em> is TRUE, the alpha bits are
617also inverted, otherwise they are left unchanged.
618<p> If the depth is not 32, the argument <em>invertAlpha</em> has no
619meaning.
620<p> Note that inverting an 8-bit image means to replace all pixels
621using color index <em>i</em> with a pixel using color index 255 minus <em>i</em>. Similarly for a 1-bit image. The color table is not changed.
622<p> <p>See also <a href="#fill">fill</a>(), <a href="#depth">depth</a>(), and <a href="#hasAlphaBuffer">hasAlphaBuffer</a>().
623
624<h3 class=fn>bool <a name="isGrayscale"></a>QImage::isGrayscale () const
625</h3>
626For 16-bit (Qt/Embedded only) and 32-bit images, this function is
627equivalent to <a href="#allGray">allGray</a>().
628<p> For 8-bpp images, this function returns TRUE if <a href="#color">color</a>(i) is
629QRgb(i,i,i) for all indices of the color table; otherwise returns
630FALSE.
631<p> <p>See also <a href="#allGray">allGray</a>() and <a href="#depth">depth</a>().
632
633<h3 class=fn>bool <a name="isNull"></a>QImage::isNull () const
634</h3>
635
636<p> Returns TRUE if it is a null image; otherwise returns FALSE.
637<p> A null image has all parameters set to zero and no allocated data.
638
639<p>Example: <a href="showimg-example.html#x1322">showimg/showimg.cpp</a>.
640<h3 class=fn>uchar ** <a name="jumpTable"></a>QImage::jumpTable () const
641</h3>
642
643<p> Returns a pointer to the scanline pointer table.
644<p> This is the beginning of the data block for the image.
645<p> <p>See also <a href="#bits">bits</a>() and <a href="#scanLine">scanLine</a>().
646
647<h3 class=fn>bool <a name="load"></a>QImage::load ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;fileName, const&nbsp;char&nbsp;*&nbsp;format = 0 )
648</h3>
649Loads an image from the file <em>fileName</em>. Returns TRUE if the
650image was successfully loaded; otherwise returns FALSE.
651<p> If <em>format</em> is specified, the loader attempts to read the image
652using the specified format. If <em>format</em> is not specified (which
653is the default), the loader reads a few bytes from the header to
654guess the file format.
655<p> The <a href="qimageio.html">QImageIO</a> documentation lists the supported image formats and
656explains how to add extra formats.
657<p> <p>See also <a href="#loadFromData">loadFromData</a>(), <a href="#save">save</a>(), <a href="#imageFormat">imageFormat</a>(), <a href="qpixmap.html#load">QPixmap::load</a>(), and <a href="qimageio.html">QImageIO</a>.
658
659<h3 class=fn>bool <a name="loadFromData"></a>QImage::loadFromData ( const&nbsp;uchar&nbsp;*&nbsp;buf, uint&nbsp;len, const&nbsp;char&nbsp;*&nbsp;format = 0 )
660</h3>
661Loads an image from the first <em>len</em> bytes of binary data in <em>buf</em>. Returns TRUE if the image was successfully loaded; otherwise
662returns FALSE.
663<p> If <em>format</em> is specified, the loader attempts to read the image
664using the specified format. If <em>format</em> is not specified (which
665is the default), the loader reads a few bytes from the header to
666guess the file format.
667<p> The <a href="qimageio.html">QImageIO</a> documentation lists the supported image formats and
668explains how to add extra formats.
669<p> <p>See also <a href="#load">load</a>(), <a href="#save">save</a>(), <a href="#imageFormat">imageFormat</a>(), <a href="qpixmap.html#loadFromData">QPixmap::loadFromData</a>(), and <a href="qimageio.html">QImageIO</a>.
670
671<h3 class=fn>bool <a name="loadFromData-2"></a>QImage::loadFromData ( <a href="qbytearray.html">QByteArray</a>&nbsp;buf, const&nbsp;char&nbsp;*&nbsp;format = 0 )
672</h3>
673This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
674<p> Loads an image from the <a href="qbytearray.html">QByteArray</a> <em>buf</em>.
675
676<h3 class=fn><a href="qimage.html">QImage</a> <a name="mirror"></a>QImage::mirror () const
677</h3>
678Returns a QImage which is a vertically mirrored copy of this
679image. The original QImage is not changed.
680
681<h3 class=fn><a href="qimage.html">QImage</a> <a name="mirror-2"></a>QImage::mirror ( bool&nbsp;horizontal, bool&nbsp;vertical ) const
682</h3>
683This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
684<p> Returns a mirror of the image, mirrored in the horizontal and/or
685the vertical direction depending on whether <em>horizontal</em> and <em>vertical</em> are set to TRUE or FALSE. The original image is not
686changed.
687<p> <p>See also <a href="#smoothScale">smoothScale</a>().
688
689<h3 class=fn>int <a name="numBytes"></a>QImage::numBytes () const
690</h3>
691
692<p> Returns the number of bytes occupied by the image data.
693<p> <p>See also <a href="#bytesPerLine">bytesPerLine</a>() and <a href="#bits">bits</a>().
694
695<h3 class=fn>int <a name="numColors"></a>QImage::numColors () const
696</h3>
697
698<p> Returns the size of the color table for the image.
699<p> Notice that <a href="#numColors">numColors</a>() returns 0 for 16-bpp (Qt/Embedded only)
700and 32-bpp images because these images do not use color tables,
701but instead encode pixel values as RGB triplets.
702<p> <p>See also <a href="#setNumColors">setNumColors</a>() and <a href="#colorTable">colorTable</a>().
703
704<p>Example: <a href="themes-example.html#x209">themes/wood.cpp</a>.
705<h3 class=fn><a href="qpoint.html">QPoint</a> <a name="offset"></a>QImage::offset () const
706</h3>
707
708<p> Returns the number of pixels by which the image is intended to be
709offset by when positioning relative to other images.
710
711<h3 class=fn>bool <a name="operator!-eq"></a>QImage::operator!= ( const&nbsp;<a href="qimage.html">QImage</a>&nbsp;&amp;&nbsp;i ) const
712</h3>
713Returns TRUE if this image and image <em>i</em> have different contents;
714otherwise returns FALSE. The comparison can be slow, unless there
715is some obvious difference, such as different widths, in which
716case the function will return quickly.
717<p> <p>See also <a href="#operator-eq">operator=</a>().
718
719<h3 class=fn><a href="qimage.html">QImage</a>&nbsp;&amp; <a name="operator-eq"></a>QImage::operator= ( const&nbsp;<a href="qimage.html">QImage</a>&nbsp;&amp;&nbsp;image )
720</h3>
721Assigns a <a href="shclass.html">shallow copy</a> of <em>image</em> to
722this image and returns a reference to this image.
723<p> <p>See also <a href="#copy">copy</a>().
724
725<h3 class=fn><a href="qimage.html">QImage</a>&nbsp;&amp; <a name="operator-eq-2"></a>QImage::operator= ( const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp;&nbsp;pixmap )
726</h3>
727This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
728<p> Sets the image bits to the <em>pixmap</em> contents and returns a
729reference to the image.
730<p> If the image shares data with other images, it will first
731dereference the shared data.
732<p> Makes a call to <a href="qpixmap.html#convertToImage">QPixmap::convertToImage</a>().
733
734<h3 class=fn>bool <a name="operator-eq-eq"></a>QImage::operator== ( const&nbsp;<a href="qimage.html">QImage</a>&nbsp;&amp;&nbsp;i ) const
735</h3>
736Returns TRUE if this image and image <em>i</em> have the same contents;
737otherwise returns FALSE. The comparison can be slow, unless there
738is some obvious difference, such as different widths, in which
739case the function will return quickly.
740<p> <p>See also <a href="#operator-eq">operator=</a>().
741
742<h3 class=fn><a href="qstringlist.html">QStringList</a> <a name="outputFormatList"></a>QImage::outputFormatList ()<tt> [static]</tt>
743</h3>
744Returns a list of image formats that are supported for image
745output.
746<p> Note that if you want to iterate over the list, you should iterate
747over a copy, e.g.
748<pre>
749 <a href="qstringlist.html">QStringList</a> list = myImage.outputFormatList();
750 QStringList::Iterator it = list.<a href="qvaluelist.html#begin">begin</a>();
751 while( it != list.<a href="qvaluelist.html#end">end</a>() ) {
752 myProcessing( *it );
753 ++it;
754 }
755 </pre>
756
757<p> <p>See also <a href="#inputFormatList">inputFormatList</a>(), <a href="#outputFormats">outputFormats</a>(), and <a href="qimageio.html">QImageIO</a>.
758
759<h3 class=fn><a href="qstrlist.html">QStrList</a> <a name="outputFormats"></a>QImage::outputFormats ()<tt> [static]</tt>
760</h3>
761Returns a list of image formats that are supported for image
762output.
763<p> <p>See also <a href="#inputFormats">inputFormats</a>(), <a href="#outputFormatList">outputFormatList</a>(), and <a href="qimageio.html">QImageIO</a>.
764
765<p>Example: <a href="showimg-example.html#x1323">showimg/showimg.cpp</a>.
766<h3 class=fn>QRgb <a name="pixel"></a>QImage::pixel ( int&nbsp;x, int&nbsp;y ) const
767</h3>
768Returns the color of the pixel at the coordinates (<em>x</em>, <em>y</em>).
769<p> If (<em>x</em>, <em>y</em>) is not <a href="#valid">on the image</a>, the
770results are undefined.
771<p> <p>See also <a href="#setPixel">setPixel</a>(), <a href="qcolor.html#qRed">qRed</a>(), <a href="qcolor.html#qGreen">qGreen</a>(), <a href="qcolor.html#qBlue">qBlue</a>(), and <a href="#valid">valid</a>().
772
773<p>Examples: <a href="canvas-example.html#x2933">canvas/canvas.cpp</a> and <a href="qmag-example.html#x1776">qmag/qmag.cpp</a>.
774<h3 class=fn>int <a name="pixelIndex"></a>QImage::pixelIndex ( int&nbsp;x, int&nbsp;y ) const
775</h3>
776Returns the pixel index at the given coordinates.
777<p> If (<em>x</em>, <em>y</em>) is not <a href="#valid">valid</a>, or if the
778image is not a paletted image (<a href="#depth">depth</a>() &gt; 8), the results are
779undefined.
780<p> <p>See also <a href="#valid">valid</a>() and <a href="#depth">depth</a>().
781
782<h3 class=fn><a href="qrect.html">QRect</a> <a name="rect"></a>QImage::rect () const
783</h3>
784
785<p> Returns the enclosing rectangle (0, 0, <a href="#width">width</a>(), <a href="#height">height</a>()) of the
786image.
787<p> <p>See also <a href="#width">width</a>(), <a href="#height">height</a>(), and <a href="#size">size</a>().
788
789<h3 class=fn>void <a name="reset"></a>QImage::reset ()
790</h3>
791Resets all image parameters and deallocates the image data.
792
793<h3 class=fn>bool <a name="save"></a>QImage::save ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;fileName, const&nbsp;char&nbsp;*&nbsp;format, int&nbsp;quality = -1 ) const
794</h3>
795Saves the image to the file <em>fileName</em>, using the image file
796format <em>format</em> and a quality factor of <em>quality</em>. <em>quality</em>
797must be in the range 0..100 or -1. Specify 0 to obtain small
798compressed files, 100 for large uncompressed files, and -1 (the
799default) to use the default settings.
800<p> Returns TRUE if the image was successfully saved; otherwise
801returns FALSE.
802<p> <p>See also <a href="#load">load</a>(), <a href="#loadFromData">loadFromData</a>(), <a href="#imageFormat">imageFormat</a>(), <a href="qpixmap.html#save">QPixmap::save</a>(), and <a href="qimageio.html">QImageIO</a>.
803
804<h3 class=fn>bool <a name="save-2"></a>QImage::save ( <a href="qiodevice.html">QIODevice</a>&nbsp;*&nbsp;device, const&nbsp;char&nbsp;*&nbsp;format, int&nbsp;quality = -1 ) const
805</h3>
806This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
807<p> This function writes a QImage to the <a href="qiodevice.html">QIODevice</a>, <em>device</em>. This
808can be used, for example, to save an image directly into a
809QByteArray:
810<pre>
811 QImage image;
812 <a href="qbytearray.html">QByteArray</a> ba;
813 <a href="qbuffer.html">QBuffer</a> buffer( ba );
814 buffer.<a href="qiodevice.html#open">open</a>( <a href="qfile.html#open">IO_WriteOnly</a> );
815 image.<a href="#save">save</a>( &amp;buffer, "PNG" ); // writes image into ba in PNG format
816 </pre>
817
818
819<h3 class=fn><a href="qimage.html">QImage</a> <a name="scale"></a>QImage::scale ( int&nbsp;w, int&nbsp;h, <a href="qimage.html#ScaleMode-enum">ScaleMode</a>&nbsp;mode = ScaleFree ) const
820</h3>
821Returns a copy of the image scaled to a rectangle of width <em>w</em>
822and height <em>h</em> according to the ScaleMode <em>mode</em>.
823<p> <ul>
824<li> If <em>mode</em> is <a href="#ScaleMode-enum">ScaleFree</a>, the image is scaled to (<em>w</em>,
825<em>h</em>).
826<li> If <em>mode</em> is <a href="#ScaleMode-enum">ScaleMin</a>, the image is scaled to a rectangle
827as large as possible inside (<em>w</em>, <em>h</em>), preserving the aspect
828ratio.
829<li> If <em>mode</em> is <a href="#ScaleMode-enum">ScaleMax</a>, the image is scaled to a rectangle
830as small as possible outside (<em>w</em>, <em>h</em>), preserving the aspect
831ratio.
832</ul>
833<p> If either the width <em>w</em> or the height <em>h</em> is 0 or negative, this
834function returns a <a href="#isNull">null</a> image.
835<p> This function uses a simple, fast algorithm. If you need better
836quality, use <a href="#smoothScale">smoothScale</a>() instead.
837<p> <p>See also <a href="#scaleWidth">scaleWidth</a>(), <a href="#scaleHeight">scaleHeight</a>(), <a href="#smoothScale">smoothScale</a>(), and <a href="#xForm">xForm</a>().
838
839<h3 class=fn><a href="qimage.html">QImage</a> <a name="scale-2"></a>QImage::scale ( const&nbsp;<a href="qsize.html">QSize</a>&nbsp;&amp;&nbsp;s, <a href="qimage.html#ScaleMode-enum">ScaleMode</a>&nbsp;mode = ScaleFree ) const
840</h3>
841This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
842<p> The requested size of the image is <em>s</em>.
843
844<h3 class=fn><a href="qimage.html">QImage</a> <a name="scaleHeight"></a>QImage::scaleHeight ( int&nbsp;h ) const
845</h3>
846Returns a scaled copy of the image. The returned image has a
847height of <em>h</em> pixels. This function automatically calculates the
848width of the image so that the ratio of the image is preserved.
849<p> If <em>h</em> is 0 or negative a <a href="#isNull">null</a> image is
850returned.
851<p> <p>See also <a href="#scale">scale</a>(), <a href="#scaleWidth">scaleWidth</a>(), <a href="#smoothScale">smoothScale</a>(), and <a href="#xForm">xForm</a>().
852
853<p>Example: <a href="small-table-example-example.html#x2799">table/small-table-demo/main.cpp</a>.
854<h3 class=fn><a href="qimage.html">QImage</a> <a name="scaleWidth"></a>QImage::scaleWidth ( int&nbsp;w ) const
855</h3>
856Returns a scaled copy of the image. The returned image has a width
857of <em>w</em> pixels. This function automatically calculates the height
858of the image so that the ratio of the image is preserved.
859<p> If <em>w</em> is 0 or negative a <a href="#isNull">null</a> image is
860returned.
861<p> <p>See also <a href="#scale">scale</a>(), <a href="#scaleHeight">scaleHeight</a>(), <a href="#smoothScale">smoothScale</a>(), and <a href="#xForm">xForm</a>().
862
863<h3 class=fn>uchar * <a name="scanLine"></a>QImage::scanLine ( int&nbsp;i ) const
864</h3>
865
866<p> Returns a pointer to the pixel data at the scanline with index <em>i</em>. The first scanline is at index 0.
867<p> The scanline data is aligned on a 32-bit boundary.
868<p> <b>Warning:</b> If you are accessing 32-bpp image data, cast the returned
869pointer to <tt>QRgb*</tt> (QRgb has a 32-bit size) and use it to
870read/write the pixel value. You cannot use the <tt>uchar*</tt> pointer
871directly, because the pixel format depends on the byte order on
872the underlying platform. Hint: use <a href="qcolor.html#qRed">qRed()</a>,
873<a href="qcolor.html#qGreen">qGreen()</a> and <a href="qcolor.html#qBlue">qBlue()</a>, etc. (qcolor.h) to access the pixels.
874<p> <b>Warning:</b> If you are accessing 16-bpp image data, you must handle
875endianness yourself. (Qt/Embedded only)
876<p> <p>See also <a href="#bytesPerLine">bytesPerLine</a>(), <a href="#bits">bits</a>(), and <a href="#jumpTable">jumpTable</a>().
877
878<p>Example: <a href="desktop-example.html#x1729">desktop/desktop.cpp</a>.
879<h3 class=fn>void <a name="setAlphaBuffer"></a>QImage::setAlphaBuffer ( bool&nbsp;enable )
880</h3>
881Enables alpha buffer mode if <em>enable</em> is TRUE, otherwise disables
882it. The default setting is disabled.
883<p> An 8-bpp image has 8-bit pixels. A pixel is an index into the
884<a href="#color">color table</a>, which contains 32-bit color
885values. In a 32-bpp image, the 32-bit pixels are the color values.
886<p> This 32-bit value is encoded as follows: The lower 24 bits are
887used for the red, green, and blue components. The upper 8 bits
888contain the alpha component.
889<p> The alpha component specifies the transparency of a pixel. 0 means
890completely transparent and 255 means opaque. The alpha component
891is ignored if you do not enable alpha buffer mode.
892<p> The alpha buffer is used to set a mask when a QImage is translated
893to a <a href="qpixmap.html">QPixmap</a>.
894<p> <p>See also <a href="#hasAlphaBuffer">hasAlphaBuffer</a>() and <a href="#createAlphaMask">createAlphaMask</a>().
895
896<h3 class=fn>void <a name="setColor"></a>QImage::setColor ( int&nbsp;i, QRgb&nbsp;c )
897</h3>
898
899<p> Sets a color in the color table at index <em>i</em> to <em>c</em>.
900<p> A color value is an RGB triplet. Use the <a href="qcolor.html#qRgb">qRgb()</a> function (defined in <a href="qcolor-h.html">qcolor.h</a>) to make RGB
901triplets.
902<p> <p>See also <a href="#color">color</a>(), <a href="#setNumColors">setNumColors</a>(), and <a href="#numColors">numColors</a>().
903
904<p>Examples: <a href="desktop-example.html#x1730">desktop/desktop.cpp</a> and <a href="themes-example.html#x210">themes/wood.cpp</a>.
905<h3 class=fn>void <a name="setDotsPerMeterX"></a>QImage::setDotsPerMeterX ( int&nbsp;x )
906</h3>
907Sets the value returned by <a href="#dotsPerMeterX">dotsPerMeterX</a>() to <em>x</em>.
908
909<h3 class=fn>void <a name="setDotsPerMeterY"></a>QImage::setDotsPerMeterY ( int&nbsp;y )
910</h3>
911Sets the value returned by <a href="#dotsPerMeterY">dotsPerMeterY</a>() to <em>y</em>.
912
913<h3 class=fn>void <a name="setNumColors"></a>QImage::setNumColors ( int&nbsp;numColors )
914</h3>
915Resizes the color table to <em>numColors</em> colors.
916<p> If the color table is expanded all the extra colors will be set to
917black (RGB 0,0,0).
918<p> <p>See also <a href="#numColors">numColors</a>(), <a href="#color">color</a>(), <a href="#setColor">setColor</a>(), and <a href="#colorTable">colorTable</a>().
919
920<h3 class=fn>void <a name="setOffset"></a>QImage::setOffset ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p )
921</h3>
922Sets the value returned by <a href="#offset">offset</a>() to <em>p</em>.
923
924<h3 class=fn>void <a name="setPixel"></a>QImage::setPixel ( int&nbsp;x, int&nbsp;y, uint&nbsp;index_or_rgb )
925</h3>
926Sets the pixel index or color at the coordinates (<em>x</em>, <em>y</em>) to
927<em>index_or_rgb</em>.
928<p> If (<em>x</em>, <em>y</em>) is not <a href="#valid">valid</a>, the result is
929undefined.
930<p> If the image is a paletted image (<a href="#depth">depth</a>() &lt;= 8) and <em>index_or_rgb</em> &gt;= <a href="#numColors">numColors</a>(), the result is undefined.
931<p> <p>See also <a href="#pixelIndex">pixelIndex</a>(), <a href="#pixel">pixel</a>(), <a href="qcolor.html#qRgb">qRgb</a>(), <a href="qcolor.html#qRgba">qRgba</a>(), and <a href="#valid">valid</a>().
932
933<h3 class=fn>void <a name="setText"></a>QImage::setText ( const&nbsp;char&nbsp;*&nbsp;key, const&nbsp;char&nbsp;*&nbsp;lang, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s )
934</h3>
935Records string <em>s</em> for the keyword <em>key</em>. The <em>key</em> should be a
936portable keyword recognizable by other software - some suggested
937values can be found in <a href="http://www.libpng.org/pub/png/spec/1.2/png-1.2-pdg.html#C.Anc-text">the PNG specification</a>. <em>s</em> can be any text. <em>lang</em>
938should specify the language code (see
939<a href="http://www.rfc-editor.org/rfc/rfc1766.txt">RFC 1766</a>) or 0.
940
941<h3 class=fn><a href="qsize.html">QSize</a> <a name="size"></a>QImage::size () const
942</h3>
943
944<p> Returns the size of the image, i.e. its width and height.
945<p> <p>See also <a href="#width">width</a>(), <a href="#height">height</a>(), and <a href="#rect">rect</a>().
946
947<h3 class=fn><a href="qimage.html">QImage</a> <a name="smoothScale"></a>QImage::smoothScale ( int&nbsp;w, int&nbsp;h, <a href="qimage.html#ScaleMode-enum">ScaleMode</a>&nbsp;mode = ScaleFree ) const
948</h3>
949Returns a smoothly scaled copy of the image. The returned image
950has a size of width <em>w</em> by height <em>h</em> pixels if <em>mode</em> is <a href="#ScaleMode-enum">ScaleFree</a>. The modes <a href="#ScaleMode-enum">ScaleMin</a> and <a href="#ScaleMode-enum">ScaleMax</a> may be used to
951preserve the ratio of the image: if <em>mode</em> is <a href="#ScaleMode-enum">ScaleMin</a>, the
952returned image is guaranteed to fit into the rectangle specified
953by <em>w</em> and <em>h</em> (it is as large as possible within the
954constraints); if <em>mode</em> is <a href="#ScaleMode-enum">ScaleMax</a>, the returned image fits
955at least into the specified rectangle (it is a small as possible
956within the constraints).
957<p> For 32-bpp images and 1-bpp/8-bpp color images the result will be
95832-bpp, whereas <a href="#allGray">all-gray</a> images
959(including black-and-white 1-bpp) will produce 8-bit <a href="#isGrayscale">grayscale</a> images with the palette spanning
960256 grays from black to white.
961<p> This function uses code based on pnmscale.c by Jef Poskanzer.
962<p> pnmscale.c - read a portable anymap and scale it
963<p>
964<p> Copyright (C) 1989, 1991 by Jef Poskanzer.
965<p> Permission to use, copy, modify, and distribute this software and
966its documentation for any purpose and without fee is hereby
967granted, provided that the above copyright notice appear in all
968copies and that both that copyright notice and this permission
969notice appear in supporting documentation. This software is
970provided "as is" without express or implied warranty.
971<p> <p>See also <a href="#scale">scale</a>() and <a href="#mirror">mirror</a>().
972
973<h3 class=fn><a href="qimage.html">QImage</a> <a name="smoothScale-2"></a>QImage::smoothScale ( const&nbsp;<a href="qsize.html">QSize</a>&nbsp;&amp;&nbsp;s, <a href="qimage.html#ScaleMode-enum">ScaleMode</a>&nbsp;mode = ScaleFree ) const
974</h3>
975This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
976<p> The requested size of the image is <em>s</em>.
977
978<h3 class=fn><a href="qimage.html">QImage</a> <a name="swapRGB"></a>QImage::swapRGB () const
979</h3>
980Returns a QImage in which the values of the red and blue
981components of all pixels have been swapped, effectively converting
982an RGB image to a BGR image. The original QImage is not changed.
983
984<h3 class=fn><a href="qimage.html#Endian-enum">Endian</a> <a name="systemBitOrder"></a>QImage::systemBitOrder ()<tt> [static]</tt>
985</h3>
986Determines the bit order of the display hardware. Returns
987QImage::LittleEndian (LSB first) or QImage::BigEndian (MSB first).
988<p> <p>See also <a href="#systemByteOrder">systemByteOrder</a>().
989
990<h3 class=fn><a href="qimage.html#Endian-enum">Endian</a> <a name="systemByteOrder"></a>QImage::systemByteOrder ()<tt> [static]</tt>
991</h3>
992Determines the host computer byte order. Returns
993QImage::LittleEndian (LSB first) or QImage::BigEndian (MSB first).
994<p> <p>See also <a href="#systemBitOrder">systemBitOrder</a>().
995
996<h3 class=fn><a href="qstring.html">QString</a> <a name="text"></a>QImage::text ( const&nbsp;char&nbsp;*&nbsp;key, const&nbsp;char&nbsp;*&nbsp;lang = 0 ) const
997</h3>
998Returns the string recorded for the keyword <em>key</em> in language <em>lang</em>, or in a default language if <em>lang</em> is 0.
999
1000<h3 class=fn><a href="qstring.html">QString</a> <a name="text-2"></a>QImage::text ( const&nbsp;QImageTextKeyLang&nbsp;&amp;&nbsp;kl ) const
1001</h3>
1002This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1003<p> Returns the string recorded for the keyword and language <em>kl</em>.
1004
1005<h3 class=fn><a href="qstringlist.html">QStringList</a> <a name="textKeys"></a>QImage::textKeys () const
1006</h3>
1007Returns the keywords for which some texts are recorded.
1008<p> Note that if you want to iterate over the list, you should iterate
1009over a copy, e.g.
1010<pre>
1011 <a href="qstringlist.html">QStringList</a> list = myImage.textKeys();
1012 QStringList::Iterator it = list.<a href="qvaluelist.html#begin">begin</a>();
1013 while( it != list.<a href="qvaluelist.html#end">end</a>() ) {
1014 myProcessing( *it );
1015 ++it;
1016 }
1017 </pre>
1018
1019<p> <p>See also <a href="#textList">textList</a>(), <a href="#text">text</a>(), <a href="#setText">setText</a>(), and <a href="#textLanguages">textLanguages</a>().
1020
1021<h3 class=fn><a href="qstringlist.html">QStringList</a> <a name="textLanguages"></a>QImage::textLanguages () const
1022</h3>
1023Returns the language identifiers for which some texts are
1024recorded.
1025<p> Note that if you want to iterate over the list, you should iterate
1026over a copy, e.g.
1027<pre>
1028 <a href="qstringlist.html">QStringList</a> list = myImage.textLanguages();
1029 QStringList::Iterator it = list.<a href="qvaluelist.html#begin">begin</a>();
1030 while( it != list.<a href="qvaluelist.html#end">end</a>() ) {
1031 myProcessing( *it );
1032 ++it;
1033 }
1034 </pre>
1035
1036<p> <p>See also <a href="#textList">textList</a>(), <a href="#text">text</a>(), <a href="#setText">setText</a>(), and <a href="#textKeys">textKeys</a>().
1037
1038<h3 class=fn><a href="qvaluelist.html">QValueList</a>&lt;QImageTextKeyLang&gt; <a name="textList"></a>QImage::textList () const
1039</h3>
1040Returns a list of QImageTextKeyLang objects that enumerate all the
1041texts key/language pairs set by <a href="#setText">setText</a>() for this image.
1042<p> Note that if you want to iterate over the list, you should iterate
1043over a copy, e.g.
1044<pre>
1045 <a href="qvaluelist.html">QValueList</a>&lt;QImageTextKeyLang&gt; list = myImage.textList();
1046 QValueList&lt;QImageTextKeyLang&gt;::Iterator it = list.<a href="qvaluelist.html#begin">begin</a>();
1047 while( it != list.<a href="qvaluelist.html#end">end</a>() ) {
1048 myProcessing( *it );
1049 ++it;
1050 }
1051 </pre>
1052
1053
1054<h3 class=fn>bool <a name="valid"></a>QImage::valid ( int&nbsp;x, int&nbsp;y ) const
1055</h3>
1056Returns TRUE if ( <em>x</em>, <em>y</em> ) is a valid coordinate in the image;
1057otherwise returns FALSE.
1058<p> <p>See also <a href="#width">width</a>(), <a href="#height">height</a>(), and <a href="#pixelIndex">pixelIndex</a>().
1059
1060<p>Examples: <a href="canvas-example.html#x2934">canvas/canvas.cpp</a> and <a href="qmag-example.html#x1777">qmag/qmag.cpp</a>.
1061<h3 class=fn>int <a name="width"></a>QImage::width () const
1062</h3>
1063
1064<p> Returns the width of the image.
1065<p> <p>See also <a href="#height">height</a>(), <a href="#size">size</a>(), and <a href="#rect">rect</a>().
1066
1067<p>Examples: <a href="canvas-example.html#x2935">canvas/canvas.cpp</a> and <a href="qglwidget.html#x2121">opengl/texture/gltexobj.cpp</a>.
1068<h3 class=fn><a href="qimage.html">QImage</a> <a name="xForm"></a>QImage::xForm ( const&nbsp;<a href="qwmatrix.html">QWMatrix</a>&nbsp;&amp;&nbsp;matrix ) const
1069</h3>
1070Returns a copy of the image that is transformed using the
1071<a href="qwmatrix.html#TransformationMode">transformation matrix</a>, <em>matrix</em>.
1072<p> The transformation <em>matrix</em> is internally adjusted to compensate
1073for unwanted translation, i.e. <a href="#xForm">xForm</a>() returns the smallest image
1074that contains all the transformed points of the original image.
1075<p> <p>See also <a href="#scale">scale</a>(), <a href="qpixmap.html#xForm">QPixmap::xForm</a>(), <a href="qpixmap.html#trueMatrix">QPixmap::trueMatrix</a>(), and <a href="qwmatrix.html">QWMatrix</a>.
1076
1077<hr><h2>Related Functions</h2>
1078<h3 class=fn>void <a name="bitBlt"></a>bitBlt ( <a href="qimage.html">QImage</a>&nbsp;*&nbsp;dst, int&nbsp;dx, int&nbsp;dy, const&nbsp;<a href="qimage.html">QImage</a>&nbsp;*&nbsp;src, int&nbsp;sx, int&nbsp;sy, int&nbsp;sw, int&nbsp;sh, int&nbsp;conversion_flags )
1079</h3>
1080
1081<p> Copies a block of pixels from <em>src</em> to <em>dst</em>. The pixels
1082copied from source (src) are converted according to
1083<em>conversion_flags</em> if it is incompatible with the destination
1084(<em>dst</em>).
1085<p> <em>sx</em>, <em>sy</em> is the top-left pixel in <em>src</em>, <em>dx</em>, <em>dy</em>
1086is the top-left position in <em>dst</em> and <em>sw</em>, \sh is the
1087size of the copied block.
1088<p> The copying is clipped if areas outside <em>src</em> or <em>dst</em> are
1089specified.
1090<p> If <em>sw</em> is -1, it is adjusted to src->width(). Similarly, if <em>sh</em> is -1, it is adjusted to src->height().
1091<p> Currently inefficient for non 32-bit images.
1092
1093<h3 class=fn><a href="qdatastream.html">QDataStream</a>&nbsp;&amp; <a name="operator-lt-lt"></a>operator&lt;&lt; ( <a href="qdatastream.html">QDataStream</a>&nbsp;&amp;&nbsp;s, const&nbsp;<a href="qimage.html">QImage</a>&nbsp;&amp;&nbsp;image )
1094</h3>
1095
1096<p> Writes the image <em>image</em> to the stream <em>s</em> as a PNG image, or as a
1097BMP image if the stream's version is 1.
1098<p> Note that writing the stream to a file will not produce a valid image file.
1099<p> <p>See also <a href="#save">QImage::save</a>() and <a href="datastreamformat.html">Format of the QDataStream operators</a>.
1100
1101<h3 class=fn><a href="qdatastream.html">QDataStream</a>&nbsp;&amp; <a name="operator-gt-gt"></a>operator&gt;&gt; ( <a href="qdatastream.html">QDataStream</a>&nbsp;&amp;&nbsp;s, <a href="qimage.html">QImage</a>&nbsp;&amp;&nbsp;image )
1102</h3>
1103
1104<p> Reads an image from the stream <em>s</em> and stores it in <em>image</em>.
1105<p> <p>See also <a href="#load">QImage::load</a>() and <a href="datastreamformat.html">Format of the QDataStream operators</a>.
1106
1107<!-- eof -->
1108<hr><p>
1109This file is part of the <a href="index.html">Qt toolkit</a>.
1110Copyright &copy; 1995-2007
1111<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
1112<table width=100% cellspacing=0 border=0><tr>
1113<td>Copyright &copy; 2007
1114<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
1115<td align=right><div align=right>Qt 3.3.8</div>
1116</table></div></address></body>
1117</html>
Note: See TracBrowser for help on using the repository browser.