[190] | 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:3715 -->
|
---|
| 3 | <html>
|
---|
| 4 | <head>
|
---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
| 6 | <title>QImageIO Class</title>
|
---|
| 7 | <style type="text/css"><!--
|
---|
| 8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
| 9 | a:link { color: #004faf; text-decoration: none }
|
---|
| 10 | a:visited { color: #672967; text-decoration: none }
|
---|
| 11 | body { 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 Classes</font></a>
|
---|
| 23 | | <a href="mainclasses.html">
|
---|
| 24 | <font color="#004faf">Main 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 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>QImageIO Class Reference</h1>
|
---|
| 33 |
|
---|
| 34 | <p>The QImageIO class contains parameters for loading and
|
---|
| 35 | saving images.
|
---|
| 36 | <a href="#details">More...</a>
|
---|
| 37 | <p><tt>#include <<a href="qimage-h.html">qimage.h</a>></tt>
|
---|
| 38 | <p><a href="qimageio-members.html">List of all member functions.</a>
|
---|
| 39 | <h2>Public Members</h2>
|
---|
| 40 | <ul>
|
---|
| 41 | <li class=fn><a href="#QImageIO"><b>QImageIO</b></a> ()</li>
|
---|
| 42 | <li class=fn><a href="#QImageIO-2"><b>QImageIO</b></a> ( QIODevice * ioDevice, const char * format )</li>
|
---|
| 43 | <li class=fn><a href="#QImageIO-3"><b>QImageIO</b></a> ( const QString & fileName, const char * format )</li>
|
---|
| 44 | <li class=fn><a href="#~QImageIO"><b>~QImageIO</b></a> ()</li>
|
---|
| 45 | <li class=fn>const QImage & <a href="#image"><b>image</b></a> () const</li>
|
---|
| 46 | <li class=fn>int <a href="#status"><b>status</b></a> () const</li>
|
---|
| 47 | <li class=fn>const char * <a href="#format"><b>format</b></a> () const</li>
|
---|
| 48 | <li class=fn>QIODevice * <a href="#ioDevice"><b>ioDevice</b></a> () const</li>
|
---|
| 49 | <li class=fn>QString <a href="#fileName"><b>fileName</b></a> () const</li>
|
---|
| 50 | <li class=fn>int <a href="#quality"><b>quality</b></a> () const</li>
|
---|
| 51 | <li class=fn>QString <a href="#description"><b>description</b></a> () const</li>
|
---|
| 52 | <li class=fn>const char * <a href="#parameters"><b>parameters</b></a> () const</li>
|
---|
| 53 | <li class=fn>float <a href="#gamma"><b>gamma</b></a> () const</li>
|
---|
| 54 | <li class=fn>void <a href="#setImage"><b>setImage</b></a> ( const QImage & image )</li>
|
---|
| 55 | <li class=fn>void <a href="#setStatus"><b>setStatus</b></a> ( int status )</li>
|
---|
| 56 | <li class=fn>void <a href="#setFormat"><b>setFormat</b></a> ( const char * format )</li>
|
---|
| 57 | <li class=fn>void <a href="#setIODevice"><b>setIODevice</b></a> ( QIODevice * ioDevice )</li>
|
---|
| 58 | <li class=fn>void <a href="#setFileName"><b>setFileName</b></a> ( const QString & fileName )</li>
|
---|
| 59 | <li class=fn>void <a href="#setQuality"><b>setQuality</b></a> ( int q )</li>
|
---|
| 60 | <li class=fn>void <a href="#setDescription"><b>setDescription</b></a> ( const QString & description )</li>
|
---|
| 61 | <li class=fn>void <a href="#setParameters"><b>setParameters</b></a> ( const char * parameters )</li>
|
---|
| 62 | <li class=fn>void <a href="#setGamma"><b>setGamma</b></a> ( float gamma )</li>
|
---|
| 63 | <li class=fn>bool <a href="#read"><b>read</b></a> ()</li>
|
---|
| 64 | <li class=fn>bool <a href="#write"><b>write</b></a> ()</li>
|
---|
| 65 | </ul>
|
---|
| 66 | <h2>Static Public Members</h2>
|
---|
| 67 | <ul>
|
---|
| 68 | <li class=fn>const char * <a href="#imageFormat"><b>imageFormat</b></a> ( const QString & fileName )</li>
|
---|
| 69 | <li class=fn>const char * <a href="#imageFormat-2"><b>imageFormat</b></a> ( QIODevice * d )</li>
|
---|
| 70 | <li class=fn>QStrList <a href="#inputFormats"><b>inputFormats</b></a> ()</li>
|
---|
| 71 | <li class=fn>QStrList <a href="#outputFormats"><b>outputFormats</b></a> ()</li>
|
---|
| 72 | <li class=fn>void <a href="#defineIOHandler"><b>defineIOHandler</b></a> ( const char * format, const char * header, const char * flags, image_io_handler readImage, image_io_handler writeImage )</li>
|
---|
| 73 | </ul>
|
---|
| 74 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
| 75 |
|
---|
| 76 |
|
---|
| 77 | <p> The QImageIO class contains parameters for loading and
|
---|
| 78 | saving images.
|
---|
| 79 | <p>
|
---|
| 80 |
|
---|
| 81 |
|
---|
| 82 | <p> QImageIO contains a <a href="qiodevice.html">QIODevice</a> object that is used for image data
|
---|
| 83 | I/O. The programmer can install new image file formats in addition
|
---|
| 84 | to those that Qt provides.
|
---|
| 85 | <p> Qt currently supports the following image file formats: PNG, BMP,
|
---|
| 86 | XBM, XPM and PNM. It may also support JPEG, MNG and GIF, if
|
---|
| 87 | specially configured during compilation. The different PNM formats
|
---|
| 88 | are: PBM (P1 or P4), PGM (P2 or P5), and PPM (P3 or P6).
|
---|
| 89 | <p> You don't normally need to use this class; <a href="qpixmap.html#load">QPixmap::load</a>(),
|
---|
| 90 | <a href="qpixmap.html#save">QPixmap::save</a>(), and <a href="qimage.html">QImage</a> contain sufficient functionality.
|
---|
| 91 | <p> For image files that contain sequences of images, only the first
|
---|
| 92 | is read. See <a href="qmovie.html">QMovie</a> for loading multiple images.
|
---|
| 93 | <p> PBM, PGM, and PPM format <em>output</em> is always in the more condensed
|
---|
| 94 | raw format. PPM and PGM files with more than 256 levels of
|
---|
| 95 | intensity are scaled down when reading.
|
---|
| 96 | <p> <b>Warning:</b> If you are in a country which recognizes software patents
|
---|
| 97 | and in which Unisys holds a patent on LZW compression and/or
|
---|
| 98 | decompression and you want to use GIF, Unisys may require you to
|
---|
| 99 | license the technology. Such countries include Canada, Japan, the
|
---|
| 100 | USA, France, Germany, Italy and the UK.
|
---|
| 101 | <p> GIF support may be removed completely in a future version of Qt.
|
---|
| 102 | We recommend using the PNG format.
|
---|
| 103 | <p> <p>See also <a href="qimage.html">QImage</a>, <a href="qpixmap.html">QPixmap</a>, <a href="qfile.html">QFile</a>, <a href="qmovie.html">QMovie</a>, <a href="graphics.html">Graphics Classes</a>, <a href="images.html">Image Processing Classes</a>, and <a href="io.html">Input/Output and Networking</a>.
|
---|
| 104 |
|
---|
| 105 | <hr><h2>Member Function Documentation</h2>
|
---|
| 106 | <h3 class=fn><a name="QImageIO"></a>QImageIO::QImageIO ()
|
---|
| 107 | </h3>
|
---|
| 108 | Constructs a QImageIO object with all parameters set to zero.
|
---|
| 109 |
|
---|
| 110 | <h3 class=fn><a name="QImageIO-2"></a>QImageIO::QImageIO ( <a href="qiodevice.html">QIODevice</a> * ioDevice, const char * format )
|
---|
| 111 | </h3>
|
---|
| 112 | Constructs a QImageIO object with the I/O device <em>ioDevice</em> and a
|
---|
| 113 | <em>format</em> tag.
|
---|
| 114 |
|
---|
| 115 | <h3 class=fn><a name="QImageIO-3"></a>QImageIO::QImageIO ( const <a href="qstring.html">QString</a> & fileName, const char * format )
|
---|
| 116 | </h3>
|
---|
| 117 | Constructs a QImageIO object with the file name <em>fileName</em> and a
|
---|
| 118 | <em>format</em> tag.
|
---|
| 119 |
|
---|
| 120 | <h3 class=fn><a name="~QImageIO"></a>QImageIO::~QImageIO ()
|
---|
| 121 | </h3>
|
---|
| 122 | Destroys the object and all related data.
|
---|
| 123 |
|
---|
| 124 | <h3 class=fn>void <a name="defineIOHandler"></a>QImageIO::defineIOHandler ( const char * format, const char * header, const char * flags, image_io_handler readImage, image_io_handler writeImage )<tt> [static]</tt>
|
---|
| 125 | </h3>
|
---|
| 126 | Defines an image I/O handler for the image format called <em>format</em>, which is recognized using the <a href="qregexp.html#details">regular expression</a> <em>header</em>, read using <em>readImage</em> and
|
---|
| 127 | written using <em>writeImage</em>.
|
---|
| 128 | <p> <em>flags</em> is a string of single-character flags for this format.
|
---|
| 129 | The only flag defined currently is T (upper case), so the only
|
---|
| 130 | legal value for <em>flags</em> are "T" and the empty string. The "T"
|
---|
| 131 | flag means that the image file is a text file, and Qt should treat
|
---|
| 132 | all newline conventions as equivalent. (XPM files and some PPM
|
---|
| 133 | files are text files for example.)
|
---|
| 134 | <p> <em>format</em> is used to select a handler to write a <a href="qimage.html">QImage</a>; <em>header</em>
|
---|
| 135 | is used to select a handler to read an image file.
|
---|
| 136 | <p> If <em>readImage</em> is a null pointer, the QImageIO will not be able
|
---|
| 137 | to read images in <em>format</em>. If <em>writeImage</em> is a null pointer,
|
---|
| 138 | the QImageIO will not be able to write images in <em>format</em>. If
|
---|
| 139 | both are null, the QImageIO object is valid but useless.
|
---|
| 140 | <p> Example:
|
---|
| 141 | <pre>
|
---|
| 142 | void readGIF( QImageIO *image )
|
---|
| 143 | {
|
---|
| 144 | // read the image using the image-><a href="#ioDevice">ioDevice</a>()
|
---|
| 145 | }
|
---|
| 146 |
|
---|
| 147 | void writeGIF( QImageIO *image )
|
---|
| 148 | {
|
---|
| 149 | // write the image using the image-><a href="#ioDevice">ioDevice</a>()
|
---|
| 150 | }
|
---|
| 151 |
|
---|
| 152 | // add the GIF image handler
|
---|
| 153 |
|
---|
| 154 | QImageIO::<a href="#defineIOHandler">defineIOHandler</a>( "GIF",
|
---|
| 155 | "^GIF[0-9][0-9][a-z]",
|
---|
| 156 | 0,
|
---|
| 157 | readGIF,
|
---|
| 158 | writeGIF );
|
---|
| 159 | </pre>
|
---|
| 160 |
|
---|
| 161 | <p> Before the regex test, all the 0 bytes in the file header are
|
---|
| 162 | converted to 1 bytes. This is done because when Qt was
|
---|
| 163 | ASCII-based, <a href="qregexp.html">QRegExp</a> could not handle 0 bytes in strings.
|
---|
| 164 | <p> The regexp is only applied on the first 14 bytes of the file.
|
---|
| 165 | <p> Note that Qt assumes that there is only one handler per format; if
|
---|
| 166 | two handlers support the same format, Qt will choose one
|
---|
| 167 | arbitrarily. It is not possible to have one handler support
|
---|
| 168 | reading, and another support writing.
|
---|
| 169 |
|
---|
| 170 | <h3 class=fn><a href="qstring.html">QString</a> <a name="description"></a>QImageIO::description () const
|
---|
| 171 | </h3>
|
---|
| 172 |
|
---|
| 173 | <p> Returns the image description string.
|
---|
| 174 | <p> <p>See also <a href="#setDescription">setDescription</a>().
|
---|
| 175 |
|
---|
| 176 | <h3 class=fn><a href="qstring.html">QString</a> <a name="fileName"></a>QImageIO::fileName () const
|
---|
| 177 | </h3>
|
---|
| 178 |
|
---|
| 179 | <p> Returns the file name currently set.
|
---|
| 180 | <p> <p>See also <a href="#setFileName">setFileName</a>().
|
---|
| 181 |
|
---|
| 182 | <h3 class=fn>const char * <a name="format"></a>QImageIO::format () const
|
---|
| 183 | </h3>
|
---|
| 184 |
|
---|
| 185 | <p> Returns the image format string or 0 if no format has been
|
---|
| 186 | explicitly set.
|
---|
| 187 |
|
---|
| 188 | <h3 class=fn>float <a name="gamma"></a>QImageIO::gamma () const
|
---|
| 189 | </h3>
|
---|
| 190 | Returns the gamma value at which the image will be viewed.
|
---|
| 191 | <p> <p>See also <a href="#setGamma">setGamma</a>().
|
---|
| 192 |
|
---|
| 193 | <h3 class=fn>const <a href="qimage.html">QImage</a> & <a name="image"></a>QImageIO::image () const
|
---|
| 194 | </h3>
|
---|
| 195 |
|
---|
| 196 | <p> Returns the image currently set.
|
---|
| 197 | <p> <p>See also <a href="#setImage">setImage</a>().
|
---|
| 198 |
|
---|
| 199 | <h3 class=fn>const char * <a name="imageFormat"></a>QImageIO::imageFormat ( const <a href="qstring.html">QString</a> & fileName )<tt> [static]</tt>
|
---|
| 200 | </h3>
|
---|
| 201 | Returns a string that specifies the image format of the file <em>fileName</em>, or null if the file cannot be read or if the format is
|
---|
| 202 | not recognized.
|
---|
| 203 |
|
---|
| 204 | <h3 class=fn>const char * <a name="imageFormat-2"></a>QImageIO::imageFormat ( <a href="qiodevice.html">QIODevice</a> * d )<tt> [static]</tt>
|
---|
| 205 | </h3>
|
---|
| 206 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
| 207 | <p> Returns a string that specifies the image format of the image read
|
---|
| 208 | from IO device <em>d</em>, or 0 if the device cannot be read or if the
|
---|
| 209 | format is not recognized.
|
---|
| 210 | <p> Make sure that <em>d</em> is at the right position in the device (for
|
---|
| 211 | example, at the beginning of the file).
|
---|
| 212 | <p> <p>See also <a href="qiodevice.html#at">QIODevice::at</a>().
|
---|
| 213 |
|
---|
| 214 | <h3 class=fn><a href="qstrlist.html">QStrList</a> <a name="inputFormats"></a>QImageIO::inputFormats ()<tt> [static]</tt>
|
---|
| 215 | </h3>
|
---|
| 216 | Returns a sorted list of image formats that are supported for
|
---|
| 217 | image input.
|
---|
| 218 |
|
---|
| 219 | <h3 class=fn><a href="qiodevice.html">QIODevice</a> * <a name="ioDevice"></a>QImageIO::ioDevice () const
|
---|
| 220 | </h3>
|
---|
| 221 |
|
---|
| 222 | <p> Returns the IO device currently set.
|
---|
| 223 | <p> <p>See also <a href="#setIODevice">setIODevice</a>().
|
---|
| 224 |
|
---|
| 225 | <h3 class=fn><a href="qstrlist.html">QStrList</a> <a name="outputFormats"></a>QImageIO::outputFormats ()<tt> [static]</tt>
|
---|
| 226 | </h3>
|
---|
| 227 | Returns a sorted list of image formats that are supported for
|
---|
| 228 | image output.
|
---|
| 229 |
|
---|
| 230 | <p>Example: <a href="scribble-example.html#x911">scribble/scribble.cpp</a>.
|
---|
| 231 | <h3 class=fn>const char * <a name="parameters"></a>QImageIO::parameters () const
|
---|
| 232 | </h3>
|
---|
| 233 | Returns the image's parameters string.
|
---|
| 234 | <p> <p>See also <a href="#setParameters">setParameters</a>().
|
---|
| 235 |
|
---|
| 236 | <h3 class=fn>int <a name="quality"></a>QImageIO::quality () const
|
---|
| 237 | </h3>
|
---|
| 238 | Returns the quality of the written image, related to the
|
---|
| 239 | compression ratio.
|
---|
| 240 | <p> <p>See also <a href="#setQuality">setQuality</a>() and <a href="qimage.html#save">QImage::save</a>().
|
---|
| 241 |
|
---|
| 242 | <h3 class=fn>bool <a name="read"></a>QImageIO::read ()
|
---|
| 243 | </h3>
|
---|
| 244 | Reads an image into memory and returns TRUE if the image was
|
---|
| 245 | successfully read; otherwise returns FALSE.
|
---|
| 246 | <p> Before reading an image you must set an IO device or a file name.
|
---|
| 247 | If both an IO device and a file name have been set, the IO device
|
---|
| 248 | will be used.
|
---|
| 249 | <p> Setting the image file format string is optional.
|
---|
| 250 | <p> Note that this function does <em>not</em> set the <a href="#format">format</a> used to read the image. If you need that
|
---|
| 251 | information, use the <a href="#imageFormat">imageFormat</a>() static functions.
|
---|
| 252 | <p> Example:
|
---|
| 253 | <p> <pre>
|
---|
| 254 | QImageIO iio;
|
---|
| 255 | <a href="qpixmap.html">QPixmap</a> pixmap;
|
---|
| 256 | iio.<a href="#setFileName">setFileName</a>( "vegeburger.bmp" );
|
---|
| 257 | if ( image.read() ) // ok
|
---|
| 258 | pixmap = iio.<a href="#image">image</a>(); // convert to pixmap
|
---|
| 259 | </pre>
|
---|
| 260 |
|
---|
| 261 | <p> <p>See also <a href="#setIODevice">setIODevice</a>(), <a href="#setFileName">setFileName</a>(), <a href="#setFormat">setFormat</a>(), <a href="#write">write</a>(), and <a href="qpixmap.html#load">QPixmap::load</a>().
|
---|
| 262 |
|
---|
| 263 | <h3 class=fn>void <a name="setDescription"></a>QImageIO::setDescription ( const <a href="qstring.html">QString</a> & description )
|
---|
| 264 | </h3>
|
---|
| 265 | Sets the image description string for image handlers that support
|
---|
| 266 | image descriptions to <em>description</em>.
|
---|
| 267 | <p> Currently, no image format supported by Qt uses the description
|
---|
| 268 | string.
|
---|
| 269 |
|
---|
| 270 | <h3 class=fn>void <a name="setFileName"></a>QImageIO::setFileName ( const <a href="qstring.html">QString</a> & fileName )
|
---|
| 271 | </h3>
|
---|
| 272 | Sets the name of the file to read or write an image from to <em>fileName</em>.
|
---|
| 273 | <p> <p>See also <a href="#setIODevice">setIODevice</a>().
|
---|
| 274 |
|
---|
| 275 | <h3 class=fn>void <a name="setFormat"></a>QImageIO::setFormat ( const char * format )
|
---|
| 276 | </h3>
|
---|
| 277 | Sets the image format to <em>format</em> for the image to be read or
|
---|
| 278 | written.
|
---|
| 279 | <p> It is necessary to specify a format before writing an image, but
|
---|
| 280 | it is not necessary to specify a format before reading an image.
|
---|
| 281 | <p> If no format has been set, Qt guesses the image format before
|
---|
| 282 | reading it. If a format is set the image will only be read if it
|
---|
| 283 | has that format.
|
---|
| 284 | <p> <p>See also <a href="#read">read</a>(), <a href="#write">write</a>(), and <a href="#format">format</a>().
|
---|
| 285 |
|
---|
| 286 | <h3 class=fn>void <a name="setGamma"></a>QImageIO::setGamma ( float gamma )
|
---|
| 287 | </h3>
|
---|
| 288 | Sets the gamma value at which the image will be viewed to <em>gamma</em>. If the image format stores a gamma value for which the
|
---|
| 289 | image is intended to be used, then this setting will be used to
|
---|
| 290 | modify the image. Setting to 0.0 will disable gamma correction
|
---|
| 291 | (i.e. any specification in the file will be ignored).
|
---|
| 292 | <p> The default value is 0.0.
|
---|
| 293 | <p> <p>See also <a href="#gamma">gamma</a>().
|
---|
| 294 |
|
---|
| 295 | <h3 class=fn>void <a name="setIODevice"></a>QImageIO::setIODevice ( <a href="qiodevice.html">QIODevice</a> * ioDevice )
|
---|
| 296 | </h3>
|
---|
| 297 | Sets the IO device to be used for reading or writing an image.
|
---|
| 298 | <p> Setting the IO device allows images to be read/written to any
|
---|
| 299 | block-oriented <a href="qiodevice.html">QIODevice</a>.
|
---|
| 300 | <p> If <em>ioDevice</em> is not null, this IO device will override file name
|
---|
| 301 | settings.
|
---|
| 302 | <p> <p>See also <a href="#setFileName">setFileName</a>().
|
---|
| 303 |
|
---|
| 304 | <h3 class=fn>void <a name="setImage"></a>QImageIO::setImage ( const <a href="qimage.html">QImage</a> & image )
|
---|
| 305 | </h3>
|
---|
| 306 | Sets the image to <em>image</em>.
|
---|
| 307 | <p> <p>See also <a href="#image">image</a>().
|
---|
| 308 |
|
---|
| 309 | <h3 class=fn>void <a name="setParameters"></a>QImageIO::setParameters ( const char * parameters )
|
---|
| 310 | </h3>
|
---|
| 311 | Sets the image's parameter string to <em>parameters</em>. This is for
|
---|
| 312 | image handlers that require special parameters.
|
---|
| 313 | <p> Although the current image formats supported by Qt ignore the
|
---|
| 314 | parameters string, it may be used in future extensions or by
|
---|
| 315 | contributions (for example, JPEG).
|
---|
| 316 | <p> <p>See also <a href="#parameters">parameters</a>().
|
---|
| 317 |
|
---|
| 318 | <h3 class=fn>void <a name="setQuality"></a>QImageIO::setQuality ( int q )
|
---|
| 319 | </h3>
|
---|
| 320 | Sets the quality of the written image to <em>q</em>, related to the
|
---|
| 321 | compression ratio.
|
---|
| 322 | <p> <em>q</em> must be in the range -1..100. Specify 0 to obtain small
|
---|
| 323 | compressed files, 100 for large uncompressed files. (-1 signifies
|
---|
| 324 | the default compression.)
|
---|
| 325 | <p> <p>See also <a href="#quality">quality</a>() and <a href="qimage.html#save">QImage::save</a>().
|
---|
| 326 |
|
---|
| 327 | <h3 class=fn>void <a name="setStatus"></a>QImageIO::setStatus ( int status )
|
---|
| 328 | </h3>
|
---|
| 329 | Sets the image IO status to <em>status</em>. A non-zero value indicates
|
---|
| 330 | an error, whereas 0 means that the IO operation was successful.
|
---|
| 331 | <p> <p>See also <a href="#status">status</a>().
|
---|
| 332 |
|
---|
| 333 | <h3 class=fn>int <a name="status"></a>QImageIO::status () const
|
---|
| 334 | </h3>
|
---|
| 335 |
|
---|
| 336 | <p> Returns the image's IO status. A non-zero value indicates an
|
---|
| 337 | error, whereas 0 means that the IO operation was successful.
|
---|
| 338 | <p> <p>See also <a href="#setStatus">setStatus</a>().
|
---|
| 339 |
|
---|
| 340 | <h3 class=fn>bool <a name="write"></a>QImageIO::write ()
|
---|
| 341 | </h3>
|
---|
| 342 | Writes an image to an IO device and returns TRUE if the image was
|
---|
| 343 | successfully written; otherwise returns FALSE.
|
---|
| 344 | <p> Before writing an image you must set an IO device or a file name.
|
---|
| 345 | If both an IO device and a file name have been set, the IO device
|
---|
| 346 | will be used.
|
---|
| 347 | <p> The image will be written using the specified image format.
|
---|
| 348 | <p> Example:
|
---|
| 349 | <pre>
|
---|
| 350 | QImageIO iio;
|
---|
| 351 | <a href="qimage.html">QImage</a> im;
|
---|
| 352 | im = pixmap; // convert to image
|
---|
| 353 | iio.<a href="#setImage">setImage</a>( im );
|
---|
| 354 | iio.<a href="#setFileName">setFileName</a>( "vegeburger.bmp" );
|
---|
| 355 | iio.<a href="#setFormat">setFormat</a>( "BMP" );
|
---|
| 356 | if ( iio.<a href="#write">write</a>() )
|
---|
| 357 | // returned TRUE if written successfully
|
---|
| 358 | </pre>
|
---|
| 359 |
|
---|
| 360 | <p> <p>See also <a href="#setIODevice">setIODevice</a>(), <a href="#setFileName">setFileName</a>(), <a href="#setFormat">setFormat</a>(), <a href="#read">read</a>(), and <a href="qpixmap.html#save">QPixmap::save</a>().
|
---|
| 361 |
|
---|
| 362 | <!-- eof -->
|
---|
| 363 | <hr><p>
|
---|
| 364 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
| 365 | Copyright © 1995-2007
|
---|
| 366 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
| 367 | <table width=100% cellspacing=0 border=0><tr>
|
---|
| 368 | <td>Copyright © 2007
|
---|
| 369 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
| 370 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
| 371 | </table></div></address></body>
|
---|
| 372 | </html>
|
---|