Sophie

Sophie

distrib > Mageia > 5 > i586 > media > core-release > by-pkgid > 50facae208d4a6f280e44a513b104320 > files > 154

qt-mobility-doc-1.2.0-13.mga5.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" />
<!-- camera.qdoc -->
  <title>Qt Mobility 1.2: Camera</title>
  <link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="content"> 
    <a href="index.html" class="qtref"><span>QtMobility Reference Documentation</span></a>
  </div>
  <div class="breadcrumb toolblock">
    <ul>
      <li class="first"><a href="index.html">Home</a></li>
      <!--  Breadcrumbs go here -->
<li>Camera</li>
    </ul>
  </div>
</div>
<div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#namespace">Namespace</a></li>
<li class="level1"><a href="#overview">Overview</a></li>
<li class="level1"><a href="#still-images">Still Images</a></li>
<li class="level1"><a href="#video-clips">Video Clips</a></li>
<li class="level1"><a href="#focus">Focus</a></li>
<li class="level1"><a href="#cancelling-asynchronous-operations">Cancelling Asynchronous Operations</a></li>
<li class="level1"><a href="#camera-controls">Camera Controls</a></li>
<li class="level1"><a href="#classes">Classes</a></li>
</ul>
</div>
<h1 class="title">Camera</h1>
<span class="subtitle"></span>
<!-- $$$camera.html-description -->
<div class="descr"> <a name="details"></a>
<p>The Camera API provides control of system camera devices. Providing support for still or video image capture with sound support.</p>
<a name="namespace"></a>
<h2>Namespace</h2>
<p>The QtMobility APIs are placed into the <i>QtMobility</i> namespace. This is done to facilitate the future migration of QtMobility APIs into Qt. See the <a href="quickstart.html">Quickstart guide</a> for an example on how the namespace impacts on application development.</p>
<a name="overview"></a>
<h2>Overview</h2>
<p>The Camera API allows high level control of various aspects of still images and video. Camera is a part of the Multimedia API and this relationship is apparent when you notice that certain core classes are subclassed from some Multimedia base classes including <a href="qmediaobject.html">QMediaObject</a> and <a href="qmediacontrol.html">QMediaControl</a>.</p>
<a name="still-images"></a>
<h2>Still Images</h2>
<p>In order to capture an image we need to create a <a href="qcamera.html">QCamera</a> object and use it to initialize a <a href="qvideowidget.html">QVideoWidget</a>, so we can see where the camera is pointing - a viewfinder. The camera object is also used to initialize a new <a href="qcameraimagecapture.html">QCameraImageCapture</a> object, imageCapture. All that is then needed is to start the camera, lock it so that the settings are not changed while the image capture occurs, capture the image, and finally unlock the camera ready for the next photo.</p>
<pre class="cpp"> camera <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qcamera.html">QCamera</a></span>;
 viewFinder <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qcameraviewfinder.html">QCameraViewfinder</a></span>;
 camera<span class="operator">-</span><span class="operator">&gt;</span>setViewfinder(viewFinder);
 viewFinder<span class="operator">-</span><span class="operator">&gt;</span>show();

 imageCapture <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qcameraimagecapture.html">QCameraImageCapture</a></span>(camera);

 camera<span class="operator">-</span><span class="operator">&gt;</span>setCaptureMode(<span class="type"><a href="qcamera.html">QCamera</a></span><span class="operator">::</span>CaptureStillImage);
 camera<span class="operator">-</span><span class="operator">&gt;</span>start();

 <span class="comment">//on half pressed shutter button</span>
 camera<span class="operator">-</span><span class="operator">&gt;</span>searchAndLock();

 <span class="comment">//on shutter button pressed</span>
 imageCapture<span class="operator">-</span><span class="operator">&gt;</span>capture();

 <span class="comment">//on shutter button released</span>
 camera<span class="operator">-</span><span class="operator">&gt;</span>unlock();</pre>
<p>Alternatively, we could have used a <a href="qgraphicsvideoitem.html">QGraphicsVideoItem</a> as a viewfinder.</p>
<a name="video-clips"></a>
<h2>Video Clips</h2>
<p>Previously we saw code that allowed the capture of a still image. Recording video requires the use of a <a href="qmediarecorder.html">QMediaRecorder</a> object and a <a href="qaudiocapturesource.html">QAudioCaptureSource</a> for sound.</p>
<p>To record video we need to create a camera object as before but this time as well as creating a viewfinder, we will also initialize a media recorder object.</p>
<pre class="cpp"> camera <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qcamera.html">QCamera</a></span>;
 mediaRecorder <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qmediarecorder.html">QMediaRecorder</a></span>(camera);

 camera<span class="operator">-</span><span class="operator">&gt;</span>setCaptureMode(<span class="type"><a href="qcamera.html">QCamera</a></span><span class="operator">::</span>CaptureVideo);
 camera<span class="operator">-</span><span class="operator">&gt;</span>start();

 <span class="comment">//on shutter button pressed</span>
 mediaRecorder<span class="operator">-</span><span class="operator">&gt;</span>record();</pre>
<p>Signals from the <i>mediaRecorder</i> can be connected to slots to react to changes in the state of the recorder or error events. Recording itself starts with the <a href="qmediarecorder.html#record">record()</a> function of mediaRecorder being called, this causes the signal <a href="qmediarecorder.html#stateChanged">stateChanged()</a> to be emitted. The recording process can be changed with the <a href="qmediarecorder.html#record">record()</a>, <a href="qmediarecorder.html#pause">pause()</a>, <a href="qmediarecorder.html#stop">stop()</a> and <a href="qmediarecorder.html#muted-prop">setMuted()</a> slots in <a href="qmediarecorder.html">QMediaRecorder</a>.</p>
<p>When the camera is in video mode, as decided by the application, then as the shutter button is pressed the camera is locked as before but instead the <a href="qmediarecorder.html#record">record()</a> function in <a href="qmediarecorder.html">QMediaRecorder</a> is used.</p>
<a name="focus"></a>
<h2>Focus</h2>
<p>Focusing is managed by the classes <a href="qcamerafocus.html">QCameraFocus</a> and <a href="qcamerafocuscontrol.html">QCameraFocusControl</a>. <a href="qcamerafocus.html">QCameraFocus</a> allows the developer to set the general policy by means of the enums for the <a href="qcamerafocus.html#FocusMode-enum">FocusMode</a> and the <a href="qcamerafocus.html#FocusPointMode-enum">FocusPointMode</a>. <a href="qcamerafocus.html#FocusMode-enum">FocusMode</a> deals with settings such as <a href="qcamerafocus.html#FocusMode-enum">AutoFocus</a>, <a href="qcamerafocus.html#FocusMode-enum">ContinuousFocus</a> and <a href="qcamerafocus.html#FocusMode-enum">InfinityFocus</a>, whereas <a href="qcamerafocus.html#FocusMode-enum">FocusPointMode</a> deals with the various focus zones within the view. <a href="qcamerafocus.html#FocusMode-enum">FocusPointMode</a> has support for face recognition, center focus and a custom focus where the focus point can be specified.</p>
<a name="cancelling-asynchronous-operations"></a>
<h2>Cancelling Asynchronous Operations</h2>
<p>Various operations such as image capture and auto focusing occur asynchrously. These operations can often be cancelled by the start of a new operation as long as this is supported by the backend. For image capture, the operation can be cancelled by calling <a href="qcameraimagecapture.html#cancelCapture">cancelCapture()</a>. For AutoFocus, autoexposure or white balance cancellation can be done by calling <i>QCamera::unlock(<a href="qcamera.html#LockType-enum">QCamera::LockFocus</a>)</i>.</p>
<a name="camera-controls"></a>
<h2>Camera Controls</h2>
<table class="generic">
<thead><tr class="qt-style"><th >Control Name</th><th >Description</th></tr></thead>
<tr valign="top" class="odd"><td >camera</td><td >the interface for system camera devices</td></tr>
<tr valign="top" class="even"><td >exposure</td><td >Includes: flash mode; flash power; metering mode; aperture; shutter speed, iso setting</td></tr>
<tr valign="top" class="odd"><td >focus</td><td >Includes: optical zoom; digital zoom; focus point; focus zones</td></tr>
<tr valign="top" class="even"><td >image processing</td><td >white balance; contrast; saturation; sharpen; denoise</td></tr>
<tr valign="top" class="odd"><td >locks</td><td >handles the locking and unlocking of camera devices</td></tr>
</table>
<a name="classes"></a>
<h2>Classes</h2>
<table class="annotated">
<tr class="odd topAlign"><td class="tblName"><p><a href="qcamera.html">QCamera</a></p></td><td class="tblDescr"><p>Interface for system camera devices</p></td></tr>
<tr class="even topAlign"><td class="tblName"><p><a href="qcameraexposure.html">QCameraExposure</a></p></td><td class="tblDescr"><p>Interface for exposure related camera settings</p></td></tr>
<tr class="odd topAlign"><td class="tblName"><p><a href="qcamerafocus.html">QCameraFocus</a></p></td><td class="tblDescr"><p>Interface for focus and zoom related camera settings</p></td></tr>
<tr class="even topAlign"><td class="tblName"><p><a href="qcameraimagecapture.html">QCameraImageCapture</a></p></td><td class="tblDescr"><p>Used for the recording of media content</p></td></tr>
<tr class="odd topAlign"><td class="tblName"><p><a href="qcameraimageprocessing.html">QCameraImageProcessing</a></p></td><td class="tblDescr"><p>Interface for focus and zoom related camera settings</p></td></tr>
<tr class="even topAlign"><td class="tblName"><p><a href="qcameraviewfinder.html">QCameraViewfinder</a></p></td><td class="tblDescr"><p>Camera viewfinder widget</p></td></tr>
</table>
</div>
<!-- @@@camera.html -->
  <div class="ft">
    <span></span>
  </div>
</div> 
<div class="footer">
  <p>
     <acronym title="Copyright">&copy;</acronym> 2008-2011 Nokia Corporation and/or its
     subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation 
     in Finland and/or other countries worldwide.</p>
  <p>
     All other trademarks are property of their respective owners. <a title="Privacy Policy"
     href="http://qt.nokia.com/about/privacy-policy">Privacy Policy</a></p>
  <br />
  <p>
    Licensees holding valid Qt Commercial licenses may use this document in accordance with the    Qt Commercial License Agreement provided with the Software or, alternatively, in accordance    with the terms contained in a written agreement between you and Nokia.</p>
  <p>
    Alternatively, this document may be used 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>
</div>
</body>
</html>