Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > contrib > by-pkgid > 112b0974ad288f6cd55bf971ee6026a9 > files > 1418

libqt3-devel-3.0.2-2mdk.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /tmp/qt-3.0-reggie-28534/qt-x11-free-3.0.2/src/kernel/qimage.cpp:3506 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QImageIO Class</title>
<style type="text/css"><!--
h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
 <a href="index.html">
<font color="#004faf">Home</font></a>
 | <a href="classes.html">
<font color="#004faf">All&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;Classes</font></a>
 | <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QImageIO Class Reference</h1>

<p>The QImageIO class contains parameters for loading
and saving images.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qimage-h.html">qimage.h</a>&gt;</tt>
<p><a href="qimageio-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class=fn><a href="#QImageIO"><b>QImageIO</b></a> ()</div></li>
<li><div class=fn><a href="#QImageIO-2"><b>QImageIO</b></a> ( QIODevice&nbsp;*&nbsp;ioDevice, const&nbsp;char&nbsp;*&nbsp;format )</div></li>
<li><div class=fn><a href="#QImageIO-3"><b>QImageIO</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;fileName, const&nbsp;char&nbsp;*&nbsp;format )</div></li>
<li><div class=fn><a href="#~QImageIO"><b>~QImageIO</b></a> ()</div></li>
<li><div class=fn>const QImage &amp; <a href="#image"><b>image</b></a> () const</div></li>
<li><div class=fn>int <a href="#status"><b>status</b></a> () const</div></li>
<li><div class=fn>const char * <a href="#format"><b>format</b></a> () const</div></li>
<li><div class=fn>QIODevice * <a href="#ioDevice"><b>ioDevice</b></a> () const</div></li>
<li><div class=fn>QString <a href="#fileName"><b>fileName</b></a> () const</div></li>
<li><div class=fn>int <a href="#quality"><b>quality</b></a> () const</div></li>
<li><div class=fn>QString <a href="#description"><b>description</b></a> () const</div></li>
<li><div class=fn>const char * <a href="#parameters"><b>parameters</b></a> () const</div></li>
<li><div class=fn>float <a href="#gamma"><b>gamma</b></a> () const</div></li>
<li><div class=fn>void <a href="#setImage"><b>setImage</b></a> ( const&nbsp;QImage&nbsp;&amp;&nbsp;image )</div></li>
<li><div class=fn>void <a href="#setStatus"><b>setStatus</b></a> ( int&nbsp;status )</div></li>
<li><div class=fn>void <a href="#setFormat"><b>setFormat</b></a> ( const&nbsp;char&nbsp;*&nbsp;format )</div></li>
<li><div class=fn>void <a href="#setIODevice"><b>setIODevice</b></a> ( QIODevice&nbsp;*&nbsp;ioDevice )</div></li>
<li><div class=fn>void <a href="#setFileName"><b>setFileName</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;fileName )</div></li>
<li><div class=fn>void <a href="#setQuality"><b>setQuality</b></a> ( int&nbsp;q )</div></li>
<li><div class=fn>void <a href="#setDescription"><b>setDescription</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;description )</div></li>
<li><div class=fn>void <a href="#setParameters"><b>setParameters</b></a> ( const&nbsp;char&nbsp;*&nbsp;parameters )</div></li>
<li><div class=fn>void <a href="#setGamma"><b>setGamma</b></a> ( float&nbsp;gamma )</div></li>
<li><div class=fn>bool <a href="#read"><b>read</b></a> ()</div></li>
<li><div class=fn>bool <a href="#write"><b>write</b></a> ()</div></li>
</ul>
<h2>Static Public Members</h2>
<ul>
<li><div class=fn>const char * <a href="#imageFormat"><b>imageFormat</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;fileName )</div></li>
<li><div class=fn>const char * <a href="#imageFormat-2"><b>imageFormat</b></a> ( QIODevice&nbsp;*&nbsp;d )</div></li>
<li><div class=fn>QStrList <a href="#inputFormats"><b>inputFormats</b></a> ()</div></li>
<li><div class=fn>QStrList <a href="#outputFormats"><b>outputFormats</b></a> ()</div></li>
<li><div class=fn>void <a href="#defineIOHandler"><b>defineIOHandler</b></a> ( const&nbsp;char&nbsp;*&nbsp;format, const&nbsp;char&nbsp;*&nbsp;header, const&nbsp;char&nbsp;*&nbsp;flags, image_io_handler&nbsp;readImage, image_io_handler&nbsp;writeImage )</div></li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>


<p> The QImageIO class contains parameters for loading
and saving images.
<p> 


<p> QImageIO contains a <a href="qiodevice.html">QIODevice</a> object that is used for image data I/O.
The programmer can install new image file formats in addition to those
that Qt implements.
<p> Qt currently supports the following image file formats: PNG, BMP,
XBM, XPM and PNM.  It may also support JPEG, MNG and GIF, if specially
configured during compilation.  The different PNM formats are: PBM
(P1 or P4), PGM (P2 or P5), and PPM (P3 or P6).
<p> You don't normally need to use this class; <a href="qpixmap.html#load">QPixmap::load</a>(),
<a href="qpixmap.html#save">QPixmap::save</a>(), and <a href="qimage.html">QImage</a> contain sufficient functionality.
<p> For image files that contain sequences of images, only the first is
read.  See the <a href="qmovie.html">QMovie</a> for loading multiple images.
<p> PBM, PGM, and PPM format <em>output</em> is always in the more condensed
raw format. PPM and PGM files with more than 256 levels of intensity
are scaled down when reading.
<p> <b>Warning:</b> If you are in a country which recognizes software patents
and in which Unisys holds a patent on LZW compression and/or
decompression and you want to use GIF, Unisys may require you to
license the technology.  Such countries include Canada, Japan, the
USA, France, Germany, Italy and the UK.
<p> GIF support may be removed completely in a future version of Qt.  We
recommend using the PNG format.
<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>.

<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QImageIO"></a>QImageIO::QImageIO ()
</h3>
Constructs a QImageIO object with all parameters set to zero.

<h3 class=fn><a name="QImageIO-2"></a>QImageIO::QImageIO ( <a href="qiodevice.html">QIODevice</a>&nbsp;*&nbsp;ioDevice, const&nbsp;char&nbsp;*&nbsp;format )
</h3>
Constructs a QImageIO object with the I/O device <em>ioDevice</em> and a <em>format</em> tag.

<h3 class=fn><a name="QImageIO-3"></a>QImageIO::QImageIO ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;fileName, const&nbsp;char&nbsp;*&nbsp;format )
</h3>
Constructs a QImageIO object with the file name <em>fileName</em> and a <em>format</em> tag.

<h3 class=fn><a name="~QImageIO"></a>QImageIO::~QImageIO ()
</h3>
Destroys the object and all related data.

<h3 class=fn>void <a name="defineIOHandler"></a>QImageIO::defineIOHandler ( const&nbsp;char&nbsp;*&nbsp;format, const&nbsp;char&nbsp;*&nbsp;header, const&nbsp;char&nbsp;*&nbsp;flags, image_io_handler&nbsp;readImage, image_io_handler&nbsp;writeImage )<tt> [static]</tt>
</h3> 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 written
using <em>writeImage</em>.
<p> <em>flags</em> is a string of single-character flags for this format. The
only flag defined currently is T (upper case), so the only legal
value for <em>flags</em> are "T" and the empty string.  The "T" flag means
that the image file is a text file, and Qt should treat all newline
conventions as equivalent.  (XPM files and some PPM files are text
files for example.)
<p> <em>format</em> is used to select a handler to write a <a href="qimage.html">QImage</a>; <em>header</em>
is used to select a handler to read an image file.
<p> If <em>readImage</em> is a null pointer, the QImageIO will not be able to
read images in <em>format</em>.  If <em>writeImage</em> is a null pointer, the
QImageIO will not be able to write images in <em>format</em>. If both are
null, the QImageIO object is valid but useless.
<p> Example:
<pre>
    void readGIF( QImageIO *image )
    {
      // read the image using the image-&gt;<a href="#ioDevice">ioDevice</a>()
    }

    void writeGIF( QImageIO *image )
    {
      // write the image using the image-&gt;<a href="#ioDevice">ioDevice</a>()
    }

    // add the GIF image handler

    QImageIO::<a href="#defineIOHandler">defineIOHandler</a>( "GIF",
                               "^GIF[0-9][0-9][a-z]",
                               0,
                               readGIF,
                               writeGIF );
  </pre>
 
<p> Before the regexp test, all the 0 bytes in the file header are
converted to 1 bytes. This is done because when Qt was
ASCII-based, <a href="qregexp.html">QRegExp</a> could not handle 0 bytes in strings.
<p> (Note that if one handlerIO supports writing a format and another
supports reading it, Qt supports both reading and writing. If two
handlers support the same operation, Qt chooses one arbitrarily.)

<h3 class=fn><a href="qstring.html">QString</a> <a name="description"></a>QImageIO::description () const
</h3>

Returns the image description string.
<p>See also <a href="#setDescription">setDescription</a>().

<h3 class=fn><a href="qstring.html">QString</a> <a name="fileName"></a>QImageIO::fileName () const
</h3>

Returns the file name currently set.
<p>See also <a href="#setFileName">setFileName</a>().

<h3 class=fn>const char * <a name="format"></a>QImageIO::format () const
</h3>

Returns the image format string or 0 if no format has been explicitly set.

<h3 class=fn>float <a name="gamma"></a>QImageIO::gamma () const
</h3>
Returns the gamma value at which the image will be viewed.
<p> <p>See also <a href="#setGamma">setGamma</a>().

<h3 class=fn>const&nbsp;<a href="qimage.html">QImage</a>&nbsp;&amp; <a name="image"></a>QImageIO::image () const
</h3>

Returns the image currently set.
<p>See also <a href="#setImage">setImage</a>().

<h3 class=fn>const char * <a name="imageFormat"></a>QImageIO::imageFormat ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;fileName )<tt> [static]</tt>
</h3>
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 not recognized.

<h3 class=fn>const char * <a name="imageFormat-2"></a>QImageIO::imageFormat ( <a href="qiodevice.html">QIODevice</a>&nbsp;*&nbsp;d )<tt> [static]</tt>
</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns a string that specifies the image format of the image read
from IO device <em>d</em>, or a null pointer if the device cannot be read or
if the format is not recognized.
<p> Make sure that <em>d</em> is at the right position in the device (for
example, at the beginning of the file).
<p> <p>See also <a href="qiodevice.html#at">QIODevice::at</a>().

<h3 class=fn><a href="qstrlist.html">QStrList</a> <a name="inputFormats"></a>QImageIO::inputFormats ()<tt> [static]</tt>
</h3>
Returns a sorted list of image formats that are supported for image input.

<h3 class=fn><a href="qiodevice.html">QIODevice</a>&nbsp;* <a name="ioDevice"></a>QImageIO::ioDevice () const
</h3>

Returns the IO device currently set.
<p>See also <a href="#setIODevice">setIODevice</a>().

<h3 class=fn><a href="qstrlist.html">QStrList</a> <a name="outputFormats"></a>QImageIO::outputFormats ()<tt> [static]</tt>
</h3>
Returns a sorted list of image formats that are supported for image output.

<p>Example: <a href="scribble-example.html#x526">scribble/scribble.cpp</a>.
<h3 class=fn>const char * <a name="parameters"></a>QImageIO::parameters () const
</h3>
Returns the image's parameters string.
<p> <p>See also <a href="#setParameters">setParameters</a>().

<h3 class=fn>int <a name="quality"></a>QImageIO::quality () const
</h3>
Returns the quality of the written image, related to the compression ratio.
<p> <p>See also <a href="#setQuality">setQuality</a>() and <a href="qimage.html#save">QImage::save</a>().

<h3 class=fn>bool <a name="read"></a>QImageIO::read ()
</h3>
Reads an image into memory and returns TRUE if the image was successfully
read; otherwise returns FALSE.
<p> Before reading an image you must set an IO device or a file name.
If both an IO device and a file name have been set, the IO device will
be used.
<p> Setting the image file format string is optional.
<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 information, use the <a href="#imageFormat">imageFormat</a>()
static functions.
<p> Example:
<p> <pre>
    QImageIO iio;
    <a href="qpixmap.html">QPixmap</a>  pixmap;
    iio.<a href="#setFileName">setFileName</a>( "vegeburger.bmp" );
    if ( image.read() )        // ok
        pixmap = iio.<a href="#image">image</a>();  // convert to pixmap
  </pre>
 
<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>().

<h3 class=fn>void <a name="setDescription"></a>QImageIO::setDescription ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;description )
</h3>
Sets the image description string for image handlers that support image
descriptions to <em>description</em>.
<p> Currently, no image format supported by Qt uses the description string.

<h3 class=fn>void <a name="setFileName"></a>QImageIO::setFileName ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;fileName )
</h3>
Sets the name of the file to read or write an image from to <em>fileName</em>.
<p> <p>See also <a href="#setIODevice">setIODevice</a>().

<h3 class=fn>void <a name="setFormat"></a>QImageIO::setFormat ( const&nbsp;char&nbsp;*&nbsp;format )
</h3>
Sets the image format <em>format</em> for the image to be read or written.
<p> It is necessary to specify a format before writing an image.
<p> It is not necessary to specify a format before reading an image.
If no format has been set, Qt guesses the image format before reading
it.  If a format is set the image will only be read if it has that
format.
<p> <p>See also <a href="#read">read</a>(), <a href="#write">write</a>() and <a href="#format">format</a>().

<h3 class=fn>void <a name="setGamma"></a>QImageIO::setGamma ( float&nbsp;gamma )
</h3>
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 image is intended to be used,
then this setting will be used to modify the image. Setting to 0.0 will disable
gamma correction (ie. any specification in the file will be ignored).
<p> The default value is 0.0.
<p> <p>See also <a href="#gamma">gamma</a>().

<h3 class=fn>void <a name="setIODevice"></a>QImageIO::setIODevice ( <a href="qiodevice.html">QIODevice</a>&nbsp;*&nbsp;ioDevice )
</h3>
Sets the IO device to be used for reading or writing an image.
<p> Setting the IO device allows images to be read/written to any
block-oriented <a href="qiodevice.html">QIODevice</a>.
<p> If <em>ioDevice</em> is not null, this IO device will override file name
settings.
<p> <p>See also <a href="#setFileName">setFileName</a>().

<h3 class=fn>void <a name="setImage"></a>QImageIO::setImage ( const&nbsp;<a href="qimage.html">QImage</a>&nbsp;&amp;&nbsp;image )
</h3>
Sets the image to <em>image</em>.
<p>See also <a href="#image">image</a>().

<h3 class=fn>void <a name="setParameters"></a>QImageIO::setParameters ( const&nbsp;char&nbsp;*&nbsp;parameters )
</h3>
Sets the image's parameter string to <em>parameters</em>. This is for
image handlers that require special parameters.
<p> Although the current image formats supported by Qt ignore the
parameters string, it may be used in future extensions or
contributions (for example, JPEG).
<p> <p>See also <a href="#parameters">parameters</a>().

<h3 class=fn>void <a name="setQuality"></a>QImageIO::setQuality ( int&nbsp;q )
</h3>
Sets the quality of the written image to <em>q</em>, related to the
compression ratio.
<p> <em>q</em> must be in the range 0..100.  Specify 0 to obtain small
compressed files, 100 for large uncompressed files
<p> <p>See also <a href="#quality">quality</a>() and <a href="qimage.html#save">QImage::save</a>().

<h3 class=fn>void <a name="setStatus"></a>QImageIO::setStatus ( int&nbsp;status )
</h3>
Sets the image IO status to <em>status</em>.  A non-zero value indicates
an error, whereas 0 means that the IO operation was successful.
<p> <p>See also <a href="#status">status</a>().

<h3 class=fn>int <a name="status"></a>QImageIO::status () const
</h3>

Returns the image's IO status. A non-zero value indicates an error, whereas 0
means that the IO operation was successful.
<p>See also <a href="#setStatus">setStatus</a>().

<h3 class=fn>bool <a name="write"></a>QImageIO::write ()
</h3>
Writes an image to an IO device and returns TRUE if the image was
successfully written; otherwise returns FALSE.
<p> Before writing an image you must set an IO device or a file name.
If both an IO device and a file name have been set, the IO
device will be used.
<p> The image will be written using the specified image format.
<p> Example:
<pre>
    QImageIO iio;
    <a href="qimage.html">QImage</a>   im;
    im = pixmap; // convert to image
    iio.<a href="#setImage">setImage</a>( im );
    iio.<a href="#setFileName">setFileName</a>( "vegeburger.bmp" );
    iio.<a href="#setFormat">setFormat</a>( "BMP" );
    if ( iio.<a href="#write">write</a>() )
        // returned TRUE if written successfully
  </pre>
 
<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>().

<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>.
Copyright &copy; 1995-2001
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2001 
<a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt version 3.0.2</div>
</table></div></address></body>
</html>