Sophie

Sophie

distrib > Mageia > 7 > i586 > by-pkgid > 1dd17e0d683ef79b4bb6872bbf359d7f > files > 5571

qt4-doc-4.8.7-26.2.mga7.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qimagewriter.cpp -->
  <title>Qt 4.8: QImageWriter Class Reference</title>
  <link rel="stylesheet" type="text/css" href="style/style.css" />
  <script src="scripts/jquery.js" type="text/javascript"></script>
  <script src="scripts/functions.js" type="text/javascript"></script>
  <link rel="stylesheet" type="text/css" href="style/superfish.css" />
  <link rel="stylesheet" type="text/css" href="style/narrow.css" />
  <!--[if IE]>
<meta name="MSSmartTagsPreventParsing" content="true">
<meta http-equiv="imagetoolbar" content="no">
<![endif]-->
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie6.css">
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie7.css">
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="style/style_ie8.css">
<![endif]-->

<script src="scripts/superfish.js" type="text/javascript"></script>
<script src="scripts/narrow.js" type="text/javascript"></script>

</head>
<body class="" onload="CheckEmptyAndLoadList();">
 <div class="header" id="qtdocheader">
    <div class="content"> 
    <div id="nav-logo">
      <a href="index.html">Home</a></div>
    <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
    <div id="narrowsearch"></div>
    <div id="nav-topright">
      <ul>
        <li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li>
        <li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li>
        <li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/">
          DOC</a></li>
        <li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li>
      </ul>
    </div>
    <div id="shortCut">
      <ul>
        <li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li>
        <li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS        </a></li>
      </ul>
     </div>
 <ul class="sf-menu" id="narrowmenu"> 
             <li><a href="#">API Lookup</a> 
                 <ul> 
                     <li><a href="classes.html">Class index</a></li> 
           <li><a href="functions.html">Function index</a></li> 
           <li><a href="modules.html">Modules</a></li> 
           <li><a href="namespaces.html">Namespaces</a></li> 
           <li><a href="qtglobal.html">Global Declarations</a></li> 
           <li><a href="qdeclarativeelements.html">QML elements</a></li> 
             </ul> 
             </li> 
             <li><a href="#">Qt Topics</a> 
                 <ul> 
                        <li><a href="qt-basic-concepts.html">Programming with Qt</a></li>  
                        <li><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li>  
                        <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li>  
                        <li><a href="supported-platforms.html">Supported Platforms</a></li>  
                        <li><a href="technology-apis.html">Qt and Key Technologies</a></li>  
                        <li><a href="best-practices.html">How-To's and Best Practices</a></li>  
              </ul> 
                 </li> 
                 <li><a href="#">Examples</a> 
                     <ul> 
                       <li><a href="all-examples.html">Examples</a></li> 
                       <li><a href="tutorials.html">Tutorials</a></li> 
                       <li><a href="demos.html">Demos</a></li> 
                       <li><a href="qdeclarativeexamples.html">QML Examples</a></li> 
                </ul> 
                     </li> 
                 </ul> 
    </div>
  </div>
  <div class="wrapper">
    <div class="hd">
      <span></span>
    </div>
    <div class="bd group">
      <div class="sidebar">
        <div class="searchlabel">
          Search index:</div>
        <div class="search" id="sidebarsearch">
          <form id="qtdocsearch" action="" onsubmit="return false;">
            <fieldset>
              <input type="text" name="searchstring" id="pageType" value="" />
 <div id="resultdialog"> 
 <a href="#" id="resultclose">Close</a> 
 <p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p> 
 <p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span>&nbsp;results:</p> 
 <ul id="resultlist" class="all"> 
 </ul> 
 </div> 
            </fieldset>
          </form>
        </div>
        <div class="box first bottombar" id="lookup">
          <h2 title="API Lookup"><span></span>
            API Lookup</h2>
          <div  id="list001" class="list">
          <ul id="ul001" >
              <li class="defaultLink"><a href="classes.html">Class index</a></li>
              <li class="defaultLink"><a href="functions.html">Function index</a></li>
              <li class="defaultLink"><a href="modules.html">Modules</a></li>
              <li class="defaultLink"><a href="namespaces.html">Namespaces</a></li>
              <li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li>
              <li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li>
            </ul> 
          </div>
        </div>
        <div class="box bottombar" id="topics">
          <h2 title="Qt Topics"><span></span>
            Qt Topics</h2>
          <div id="list002" class="list">
            <ul id="ul002" >
               <li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li> 
               <li class="defaultLink"><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li> 
               <li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li> 
               <li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li>  
               <li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li> 
               <li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li> 
            </ul>  
          </div>
        </div>
        <div class="box" id="examples">
          <h2 title="Examples"><span></span>
            Examples</h2>
          <div id="list003" class="list">
        <ul id="ul003">
              <li class="defaultLink"><a href="all-examples.html">Examples</a></li>
              <li class="defaultLink"><a href="tutorials.html">Tutorials</a></li>
              <li class="defaultLink"><a href="demos.html">Demos</a></li>
              <li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li>
            </ul> 
          </div>
        </div>
      </div>
      <div class="wrap">
        <div class="toolbar">
          <div class="breadcrumb toolblock">
            <ul>
              <li class="first"><a href="index.html">Home</a></li>
              <!--  Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qtgui.html">QtGui</a></li>
<li>QImageWriter</li>
            </ul>
          </div>
          <div class="toolbuttons toolblock">
            <ul>
              <li id="smallA" class="t_button">A</li>
              <li id="medA" class="t_button active">A</li>
              <li id="bigA" class="t_button">A</li>
              <li id="print" class="t_button"><a href="javascript:this.print();">
                <span>Print</span></a></li>
            </ul>
        </div>
        </div>
        <div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#static-public-members">Static Public Members</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">QImageWriter Class Reference</h1>
<!-- $$$QImageWriter-brief -->
<p>The QImageWriter class provides a format independent interface for writing images to files or other devices. <a href="#details">More...</a></p>
<!-- @@@QImageWriter -->
<pre class="cpp"> <span class="preprocessor">#include &lt;QImageWriter&gt;</span></pre><p><b>Note:</b> All functions in this class are <a href="threads-reentrancy.html#reentrant">reentrant</a>.</p>
<ul>
<li><a href="qimagewriter-members.html">List of all members, including inherited members</a></li>
<li><a href="qimagewriter-obsolete.html">Obsolete members</a></li>
</ul>
<a name="public-types"></a>
<h2>Public Types</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qimagewriter.html#ImageWriterError-enum">ImageWriterError</a></b> { DeviceError, UnsupportedFormatError, UnknownError }</td></tr>
</table>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qimagewriter.html#QImageWriter">QImageWriter</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qimagewriter.html#QImageWriter-2">QImageWriter</a></b> ( QIODevice * <i>device</i>, const QByteArray &amp; <i>format</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qimagewriter.html#QImageWriter-3">QImageWriter</a></b> ( const QString &amp; <i>fileName</i>, const QByteArray &amp; <i>format</i> = QByteArray() )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qimagewriter.html#dtor.QImageWriter">~QImageWriter</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qimagewriter.html#canWrite">canWrite</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qimagewriter.html#compression">compression</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QIODevice * </td><td class="memItemRight bottomAlign"><b><a href="qimagewriter.html#device">device</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> ImageWriterError </td><td class="memItemRight bottomAlign"><b><a href="qimagewriter.html#error">error</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qimagewriter.html#errorString">errorString</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qimagewriter.html#fileName">fileName</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QByteArray </td><td class="memItemRight bottomAlign"><b><a href="qimagewriter.html#format">format</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> float </td><td class="memItemRight bottomAlign"><b><a href="qimagewriter.html#gamma">gamma</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qimagewriter.html#quality">quality</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qimagewriter.html#setCompression">setCompression</a></b> ( int <i>compression</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qimagewriter.html#setDevice">setDevice</a></b> ( QIODevice * <i>device</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qimagewriter.html#setFileName">setFileName</a></b> ( const QString &amp; <i>fileName</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qimagewriter.html#setFormat">setFormat</a></b> ( const QByteArray &amp; <i>format</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qimagewriter.html#setGamma">setGamma</a></b> ( float <i>gamma</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qimagewriter.html#setQuality">setQuality</a></b> ( int <i>quality</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qimagewriter.html#setText">setText</a></b> ( const QString &amp; <i>key</i>, const QString &amp; <i>text</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qimagewriter.html#supportsOption">supportsOption</a></b> ( QImageIOHandler::ImageOption <i>option</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qimagewriter.html#write">write</a></b> ( const QImage &amp; <i>image</i> )</td></tr>
</table>
<a name="static-public-members"></a>
<h2>Static Public Members</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;QByteArray&gt; </td><td class="memItemRight bottomAlign"><b><a href="qimagewriter.html#supportedImageFormats">supportedImageFormats</a></b> ()</td></tr>
</table>
<a name="details"></a>
<!-- $$$QImageWriter-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The QImageWriter class provides a format independent interface for writing images to files or other devices.</p>
<p>QImageWriter supports setting format specific options, such as the gamma level, compression level and quality, prior to storing the image. If you do not need such options, you can use <a href="qimage.html#save">QImage::save</a>() or <a href="qpixmap.html#save">QPixmap::save</a>() instead.</p>
<p>To store an image, you start by constructing a QImageWriter object. Pass either a file name or a device pointer, and the image format to QImageWriter's constructor. You can then set several options, such as the gamma level (by calling <a href="qimagewriter.html#setGamma">setGamma</a>()) and quality (by calling <a href="qimagewriter.html#setQuality">setQuality</a>()). <a href="qimagewriter.html#canWrite">canWrite</a>() returns true if QImageWriter can write the image (i.e&#x2e;, the image format is supported and the device is open for writing). Call <a href="qimagewriter.html#write">write</a>() to write the image to the device.</p>
<p>If any error occurs when writing the image, <a href="qimagewriter.html#write">write</a>() will return false. You can then call <a href="qimagewriter.html#error">error</a>() to find the type of error that occurred, or <a href="qimagewriter.html#errorString">errorString</a>() to get a human readable description of what went wrong.</p>
<p>Call <a href="qimagewriter.html#supportedImageFormats">supportedImageFormats</a>() for a list of formats that QImageWriter can write. QImageWriter supports all built-in image formats, in addition to any image format plugins that support writing.</p>
</div>
<p><b>See also </b><a href="qimagereader.html">QImageReader</a>, <a href="qimageiohandler.html">QImageIOHandler</a>, and <a href="qimageioplugin.html">QImageIOPlugin</a>.</p>
<!-- @@@QImageWriter -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$ImageWriterError$$$UnknownError$$$DeviceError$$$UnsupportedFormatError -->
<h3 class="fn"><a name="ImageWriterError-enum"></a>enum QImageWriter::<span class="name">ImageWriterError</span></h3>
<p>This enum describes errors that can occur when writing images with <a href="qimagewriter.html">QImageWriter</a>.</p>
<table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><tt>QImageWriter::DeviceError</tt></td><td class="topAlign"><tt>1</tt></td><td class="topAlign"><a href="qimagewriter.html">QImageWriter</a> encountered a device error when writing the image data. Consult your device for more details on what went wrong.</td></tr>
<tr><td class="topAlign"><tt>QImageWriter::UnsupportedFormatError</tt></td><td class="topAlign"><tt>2</tt></td><td class="topAlign">Qt does not support the requested image format.</td></tr>
<tr><td class="topAlign"><tt>QImageWriter::UnknownError</tt></td><td class="topAlign"><tt>0</tt></td><td class="topAlign">An unknown error occurred. If you get this value after calling <a href="qimagewriter.html#write">write</a>(), it is most likely caused by a bug in <a href="qimagewriter.html">QImageWriter</a>.</td></tr>
</table>
<!-- @@@ImageWriterError -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QImageWriter[overload1]$$$QImageWriter -->
<h3 class="fn"><a name="QImageWriter"></a>QImageWriter::<span class="name">QImageWriter</span> ()</h3>
<p>Constructs an empty <a href="qimagewriter.html">QImageWriter</a> object. Before writing, you must call <a href="qimagewriter.html#setFormat">setFormat</a>() to set an image format, then <a href="qimagewriter.html#setDevice">setDevice</a>() or <a href="qimagewriter.html#setFileName">setFileName</a>().</p>
<!-- @@@QImageWriter -->
<!-- $$$QImageWriter$$$QImageWriterQIODevice*constQByteArray& -->
<h3 class="fn"><a name="QImageWriter-2"></a>QImageWriter::<span class="name">QImageWriter</span> ( <span class="type"><a href="qiodevice.html">QIODevice</a></span> * <i>device</i>, const <span class="type"><a href="qbytearray.html">QByteArray</a></span> &amp; <i>format</i> )</h3>
<p>Constructs a <a href="qimagewriter.html">QImageWriter</a> object using the device <i>device</i> and image format <i>format</i>.</p>
<!-- @@@QImageWriter -->
<!-- $$$QImageWriter$$$QImageWriterconstQString&constQByteArray& -->
<h3 class="fn"><a name="QImageWriter-3"></a>QImageWriter::<span class="name">QImageWriter</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>fileName</i>, const <span class="type"><a href="qbytearray.html">QByteArray</a></span> &amp; <i>format</i> = QByteArray() )</h3>
<p>Constructs a <a href="qimagewriter.html">QImageWriter</a> objects that will write to a file with the name <i>fileName</i>, using the image format <i>format</i>. If <i>format</i> is not provided, <a href="qimagewriter.html">QImageWriter</a> will detect the image format by inspecting the extension of <i>fileName</i>.</p>
<!-- @@@QImageWriter -->
<!-- $$$~QImageWriter[overload1]$$$~QImageWriter -->
<h3 class="fn"><a name="dtor.QImageWriter"></a>QImageWriter::<span class="name">~QImageWriter</span> ()</h3>
<p>Destructs the <a href="qimagewriter.html">QImageWriter</a> object.</p>
<!-- @@@~QImageWriter -->
<!-- $$$canWrite[overload1]$$$canWrite -->
<h3 class="fn"><a name="canWrite"></a><span class="type">bool</span> QImageWriter::<span class="name">canWrite</span> () const</h3>
<p>Returns true if <a href="qimagewriter.html">QImageWriter</a> can write the image; i.e&#x2e;, the image format is supported and the assigned device is open for reading.</p>
<p><b>See also </b><a href="qimagewriter.html#write">write</a>(), <a href="qimagewriter.html#setDevice">setDevice</a>(), and <a href="qimagewriter.html#setFormat">setFormat</a>().</p>
<!-- @@@canWrite -->
<!-- $$$compression[overload1]$$$compression -->
<h3 class="fn"><a name="compression"></a><span class="type">int</span> QImageWriter::<span class="name">compression</span> () const</h3>
<p>Returns the compression of the image.</p>
<p><b>See also </b><a href="qimagewriter.html#setCompression">setCompression</a>().</p>
<!-- @@@compression -->
<!-- $$$device[overload1]$$$device -->
<h3 class="fn"><a name="device"></a><span class="type"><a href="qiodevice.html">QIODevice</a></span> * QImageWriter::<span class="name">device</span> () const</h3>
<p>Returns the device currently assigned to <a href="qimagewriter.html">QImageWriter</a>, or 0 if no device has been assigned.</p>
<p><b>See also </b><a href="qimagewriter.html#setDevice">setDevice</a>().</p>
<!-- @@@device -->
<!-- $$$error[overload1]$$$error -->
<h3 class="fn"><a name="error"></a><span class="type"><a href="qimagewriter.html#ImageWriterError-enum">ImageWriterError</a></span> QImageWriter::<span class="name">error</span> () const</h3>
<p>Returns the type of error that last occurred.</p>
<p><b>See also </b><a href="qimagewriter.html#ImageWriterError-enum">ImageWriterError</a> and <a href="qimagewriter.html#errorString">errorString</a>().</p>
<!-- @@@error -->
<!-- $$$errorString[overload1]$$$errorString -->
<h3 class="fn"><a name="errorString"></a><span class="type"><a href="qstring.html">QString</a></span> QImageWriter::<span class="name">errorString</span> () const</h3>
<p>Returns a human readable description of the last error that occurred.</p>
<p><b>See also </b><a href="qimagewriter.html#error">error</a>().</p>
<!-- @@@errorString -->
<!-- $$$fileName[overload1]$$$fileName -->
<h3 class="fn"><a name="fileName"></a><span class="type"><a href="qstring.html">QString</a></span> QImageWriter::<span class="name">fileName</span> () const</h3>
<p>If the currently assigned device is a <a href="qfile.html">QFile</a>, or if <a href="qimagewriter.html#setFileName">setFileName</a>() has been called, this function returns the name of the file <a href="qimagewriter.html">QImageWriter</a> writes to. Otherwise (i.e&#x2e;, if no device has been assigned or the device is not a <a href="qfile.html">QFile</a>), an empty <a href="qstring.html">QString</a> is returned.</p>
<p><b>See also </b><a href="qimagewriter.html#setFileName">setFileName</a>() and <a href="qimagewriter.html#setDevice">setDevice</a>().</p>
<!-- @@@fileName -->
<!-- $$$format[overload1]$$$format -->
<h3 class="fn"><a name="format"></a><span class="type"><a href="qbytearray.html">QByteArray</a></span> QImageWriter::<span class="name">format</span> () const</h3>
<p>Returns the format <a href="qimagewriter.html">QImageWriter</a> uses for writing images.</p>
<p><b>See also </b><a href="qimagewriter.html#setFormat">setFormat</a>().</p>
<!-- @@@format -->
<!-- $$$gamma[overload1]$$$gamma -->
<h3 class="fn"><a name="gamma"></a><span class="type">float</span> QImageWriter::<span class="name">gamma</span> () const</h3>
<p>Returns the gamma level of the image.</p>
<p><b>See also </b><a href="qimagewriter.html#setGamma">setGamma</a>().</p>
<!-- @@@gamma -->
<!-- $$$quality[overload1]$$$quality -->
<h3 class="fn"><a name="quality"></a><span class="type">int</span> QImageWriter::<span class="name">quality</span> () const</h3>
<p>Returns the quality level of the image.</p>
<p><b>See also </b><a href="qimagewriter.html#setQuality">setQuality</a>().</p>
<!-- @@@quality -->
<!-- $$$setCompression[overload1]$$$setCompressionint -->
<h3 class="fn"><a name="setCompression"></a><span class="type">void</span> QImageWriter::<span class="name">setCompression</span> ( <span class="type">int</span> <i>compression</i> )</h3>
<p>This is an image format specific function that set the compression of an image. For image formats that do not support setting the compression, this value is ignored.</p>
<p>The value range of <i>compression</i> depends on the image format. For example, the &quot;tiff&quot; format supports two values, 0(no compression) and 1(LZW-compression).</p>
<p><b>See also </b><a href="qimagewriter.html#compression">compression</a>().</p>
<!-- @@@setCompression -->
<!-- $$$setDevice[overload1]$$$setDeviceQIODevice* -->
<h3 class="fn"><a name="setDevice"></a><span class="type">void</span> QImageWriter::<span class="name">setDevice</span> ( <span class="type"><a href="qiodevice.html">QIODevice</a></span> * <i>device</i> )</h3>
<p>Sets <a href="qimagewriter.html">QImageWriter</a>'s device to <i>device</i>. If a device has already been set, the old device is removed from <a href="qimagewriter.html">QImageWriter</a> and is otherwise left unchanged.</p>
<p>If the device is not already open, <a href="qimagewriter.html">QImageWriter</a> will attempt to open the device in <a href="qiodevice.html#OpenModeFlag-enum">QIODevice::WriteOnly</a> mode by calling open(). Note that this does not work for certain devices, such as <a href="qprocess.html">QProcess</a>, <a href="qtcpsocket.html">QTcpSocket</a> and <a href="qudpsocket.html">QUdpSocket</a>, where more logic is required to open the device.</p>
<p><b>See also </b><a href="qimagewriter.html#device">device</a>() and <a href="qimagewriter.html#setFileName">setFileName</a>().</p>
<!-- @@@setDevice -->
<!-- $$$setFileName[overload1]$$$setFileNameconstQString& -->
<h3 class="fn"><a name="setFileName"></a><span class="type">void</span> QImageWriter::<span class="name">setFileName</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>fileName</i> )</h3>
<p>Sets the file name of <a href="qimagewriter.html">QImageWriter</a> to <i>fileName</i>. Internally, <a href="qimagewriter.html">QImageWriter</a> will create a <a href="qfile.html">QFile</a> and open it in <a href="qiodevice.html#OpenModeFlag-enum">QIODevice::WriteOnly</a> mode, and use this file when writing images.</p>
<p><b>See also </b><a href="qimagewriter.html#fileName">fileName</a>() and <a href="qimagewriter.html#setDevice">setDevice</a>().</p>
<!-- @@@setFileName -->
<!-- $$$setFormat[overload1]$$$setFormatconstQByteArray& -->
<h3 class="fn"><a name="setFormat"></a><span class="type">void</span> QImageWriter::<span class="name">setFormat</span> ( const <span class="type"><a href="qbytearray.html">QByteArray</a></span> &amp; <i>format</i> )</h3>
<p>Sets the format <a href="qimagewriter.html">QImageWriter</a> will use when writing images, to <i>format</i>. <i>format</i> is a case insensitive text string. Example:</p>
<pre class="cpp"> <span class="type"><a href="qimagewriter.html">QImageWriter</a></span> writer;
 writer<span class="operator">.</span>setFormat(<span class="string">&quot;png&quot;</span>); <span class="comment">// same as writer.setFormat(&quot;PNG&quot;);</span></pre>
<p>You can call <a href="qimagewriter.html#supportedImageFormats">supportedImageFormats</a>() for the full list of formats <a href="qimagewriter.html">QImageWriter</a> supports.</p>
<p><b>See also </b><a href="qimagewriter.html#format">format</a>().</p>
<!-- @@@setFormat -->
<!-- $$$setGamma[overload1]$$$setGammafloat -->
<h3 class="fn"><a name="setGamma"></a><span class="type">void</span> QImageWriter::<span class="name">setGamma</span> ( <span class="type">float</span> <i>gamma</i> )</h3>
<p>This is an image format specific function that sets the gamma level of the image to <i>gamma</i>. For image formats that do not support setting the gamma level, this value is ignored.</p>
<p>The value range of <i>gamma</i> depends on the image format. For example, the &quot;png&quot; format supports a gamma range from 0.0 to 1.0&#x2e;</p>
<p><b>See also </b><a href="qimagewriter.html#gamma">gamma</a>() and <a href="qimagewriter.html#quality">quality</a>().</p>
<!-- @@@setGamma -->
<!-- $$$setQuality[overload1]$$$setQualityint -->
<h3 class="fn"><a name="setQuality"></a><span class="type">void</span> QImageWriter::<span class="name">setQuality</span> ( <span class="type">int</span> <i>quality</i> )</h3>
<p>This is an image format specific function that sets the quality level of the image to <i>quality</i>. For image formats that do not support setting the quality, this value is ignored.</p>
<p>The value range of <i>quality</i> depends on the image format. For example, the &quot;jpeg&quot; format supports a quality range from 0 (low quality, high compression) to 100 (high quality, low compression).</p>
<p><b>See also </b><a href="qimagewriter.html#quality">quality</a>().</p>
<!-- @@@setQuality -->
<!-- $$$setText[overload1]$$$setTextconstQString&constQString& -->
<h3 class="fn"><a name="setText"></a><span class="type">void</span> QImageWriter::<span class="name">setText</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>key</i>, const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>text</i> )</h3>
<p>Sets the image text associated with the key <i>key</i> to <i>text</i>. This is useful for storing copyright information or other information about the image. Example:</p>
<pre class="cpp"> <span class="type"><a href="qimage.html">QImage</a></span> image(<span class="string">&quot;some/image.jpeg&quot;</span>);
 <span class="type"><a href="qimagewriter.html">QImageWriter</a></span> writer(<span class="string">&quot;images/outimage.png&quot;</span><span class="operator">,</span> <span class="string">&quot;png&quot;</span>);
 writer<span class="operator">.</span>setText(<span class="string">&quot;Author&quot;</span><span class="operator">,</span> <span class="string">&quot;John Smith&quot;</span>);
 writer<span class="operator">.</span><a href="qimagewriter.html#write">write</a>(image);</pre>
<p>If you want to store a single block of data (e.g&#x2e;, a comment), you can pass an empty key, or use a generic key like &quot;Description&quot;.</p>
<p>The key and text will be embedded into the image data after calling <a href="qimagewriter.html#write">write</a>().</p>
<p>Support for this option is implemented through <a href="qimageiohandler.html#ImageOption-enum">QImageIOHandler::Description</a>.</p>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also </b><a href="qimage.html#setText">QImage::setText</a>() and <a href="qimagereader.html#text">QImageReader::text</a>().</p>
<!-- @@@setText -->
<!-- $$$supportedImageFormats[overload1]$$$supportedImageFormats -->
<h3 class="fn"><a name="supportedImageFormats"></a><span class="type"><a href="qlist.html">QList</a></span>&lt;<span class="type"><a href="qbytearray.html">QByteArray</a></span>&gt; QImageWriter::<span class="name">supportedImageFormats</span> ()<tt> [static]</tt></h3>
<p>Returns the list of image formats supported by <a href="qimagewriter.html">QImageWriter</a>.</p>
<p>By default, Qt can write the following formats:</p>
<table class="generic">
<thead><tr class="qt-style"><th >Format</th><th >Description</th></tr></thead>
<tr valign="top" class="odd"><td >BMP</td><td >Windows Bitmap</td></tr>
<tr valign="top" class="even"><td >JPG</td><td >Joint Photographic Experts Group</td></tr>
<tr valign="top" class="odd"><td >JPEG</td><td >Joint Photographic Experts Group</td></tr>
<tr valign="top" class="even"><td >PNG</td><td >Portable Network Graphics</td></tr>
<tr valign="top" class="odd"><td >PPM</td><td >Portable Pixmap</td></tr>
<tr valign="top" class="even"><td >TIFF</td><td >Tagged Image File Format</td></tr>
<tr valign="top" class="odd"><td >XBM</td><td >X11 Bitmap</td></tr>
<tr valign="top" class="even"><td >XPM</td><td >X11 Pixmap</td></tr>
</table>
<p>Reading and writing SVG files is supported through Qt's <a href="qtsvg.html">SVG Module</a>.</p>
<p>Note that the <a href="qapplication.html">QApplication</a> instance must be created before this function is called.</p>
<p><b>See also </b><a href="qimagewriter.html#setFormat">setFormat</a>(), <a href="qimagereader.html#supportedImageFormats">QImageReader::supportedImageFormats</a>(), and <a href="qimageioplugin.html">QImageIOPlugin</a>.</p>
<!-- @@@supportedImageFormats -->
<!-- $$$supportsOption[overload1]$$$supportsOptionQImageIOHandler::ImageOption -->
<h3 class="fn"><a name="supportsOption"></a><span class="type">bool</span> QImageWriter::<span class="name">supportsOption</span> ( <span class="type"><a href="qimageiohandler.html#ImageOption-enum">QImageIOHandler::ImageOption</a></span> <i>option</i> ) const</h3>
<p>Returns true if the writer supports <i>option</i>; otherwise returns false.</p>
<p>Different image formats support different options. Call this function to determine whether a certain option is supported by the current format. For example, the PNG format allows you to embed text into the image's metadata (see text()).</p>
<pre class="cpp"> <span class="type"><a href="qimagewriter.html">QImageWriter</a></span> writer(fileName);
 <span class="keyword">if</span> (writer<span class="operator">.</span>supportsOption(<span class="type"><a href="qimageiohandler.html">QImageIOHandler</a></span><span class="operator">::</span>Description))
     writer<span class="operator">.</span><a href="qimagewriter.html#setText">setText</a>(<span class="string">&quot;Author&quot;</span><span class="operator">,</span> <span class="string">&quot;John Smith&quot;</span>);</pre>
<p>Options can be tested after the writer has been associated with a format.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qimagereader.html#supportsOption">QImageReader::supportsOption</a>() and <a href="qimagewriter.html#setFormat">setFormat</a>().</p>
<!-- @@@supportsOption -->
<!-- $$$write[overload1]$$$writeconstQImage& -->
<h3 class="fn"><a name="write"></a><span class="type">bool</span> QImageWriter::<span class="name">write</span> ( const <span class="type"><a href="qimage.html">QImage</a></span> &amp; <i>image</i> )</h3>
<p>Writes the image <i>image</i> to the assigned device or file name. Returns true on success; otherwise returns false. If the operation fails, you can call <a href="qimagewriter.html#error">error</a>() to find the type of error that occurred, or <a href="qimagewriter.html#errorString">errorString</a>() to get a human readable description of the error.</p>
<p><b>See also </b><a href="qimagewriter.html#canWrite">canWrite</a>(), <a href="qimagewriter.html#error">error</a>(), and <a href="qimagewriter.html#errorString">errorString</a>().</p>
<!-- @@@write -->
</div>
      </div>
    </div>
    </div> 
    <div class="ft">
      <span></span>
    </div>
  </div> 
  <div class="footer">
    <p>
      <acronym title="Copyright">&copy;</acronym> 2015 The Qt Company Ltd.
      Documentation contributions included herein are the copyrights of
      their respective owners.</p>
    <br />
    <p>
      The documentation provided herein is licensed under the terms of the
      <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
      License version 1.3</a> as published by the Free Software Foundation.</p>
    <p>
      Documentation sources may be obtained from <a href="http://www.qt-project.org">
      www.qt-project.org</a>.</p>
    <br />
    <p>
      Qt and respective logos are trademarks of The Qt Company Ltd 
      in Finland and/or other countries worldwide. All other trademarks are property
      of their respective owners. <a title="Privacy Policy"
      href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
  </div>

  <script src="scripts/functions.js" type="text/javascript"></script>
</body>
</html>