Symbian3/SDK/Source/GUID-55BF8452-F9FF-5CF3-9D74-3BC7F5447551-GENID-1-6-1-17-1-1-5-1-5-1-4-1-3-1.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Thu, 21 Jan 2010 18:18:20 +0000
changeset 0 89d6a7a84779
permissions -rw-r--r--
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="GUID-55BF8452-F9FF-5CF3-9D74-3BC7F5447551-GENID-1-6-1-17-1-1-5-1-5-1-4-1-3-1" xml:lang="en"><title>CameraExample:
Capturing and controlling the images using Camera</title><prolog><metadata><keywords/></metadata></prolog><conbody>
<section id="GUID-737B3B28-3FB0-5A2B-B451-C6B0001F24DE-GENID-1-6-1-17-1-1-5-1-5-1-4-1-3-1-2-1"><title>Description</title> <p>This
example is a GUI application and has the standard classes required by any
application using UI controls such as an application, a document, an application
UI and a view. It provides UI controls such as power on, power off, viewfinder
required to capture and control the images. </p> <p> <b>Note:</b> To run the
example, you must have a plug-in that supports the Camera implementation.
Symbian does not provide any such implementation. </p> <p>The example demonstrates
the following key features: </p> <ul>
<li id="GUID-091D17C6-4C79-5F4B-ABE1-830F5619EA09-GENID-1-6-1-17-1-1-5-1-5-1-4-1-3-1-2-1-5-1"><p><xref href="GUID-55BF8452-F9FF-5CF3-9D74-3BC7F5447551-GENID-1-6-1-17-1-1-5-1-5-1-4-1-3-1.dita#GUID-55BF8452-F9FF-5CF3-9D74-3BC7F5447551-GENID-1-6-1-17-1-1-5-1-5-1-4-1-3-1/GUID-A324BFE2-B946-54A1-A09E-AC5C8E1DDFE1-GENID-1-6-1-17-1-1-5-1-5-1-4-1-3-1-2-1-6">Control settings</xref>  </p> </li>
<li id="GUID-2FB651D5-8749-5DD8-8BAF-1A9FFC8F5DB4-GENID-1-6-1-17-1-1-5-1-5-1-4-1-3-1-2-1-5-2"><p><xref href="GUID-55BF8452-F9FF-5CF3-9D74-3BC7F5447551-GENID-1-6-1-17-1-1-5-1-5-1-4-1-3-1.dita#GUID-55BF8452-F9FF-5CF3-9D74-3BC7F5447551-GENID-1-6-1-17-1-1-5-1-5-1-4-1-3-1/GUID-7F7A8058-D3AC-5FEA-B82F-81BEF89DB54B-GENID-1-6-1-17-1-1-5-1-5-1-4-1-3-1-2-1-9">Basic settings</xref>  </p> </li>
<li id="GUID-14204727-4F8A-5CA0-AC77-4A0504E0256E-GENID-1-6-1-17-1-1-5-1-5-1-4-1-3-1-2-1-5-3"><p><xref href="GUID-55BF8452-F9FF-5CF3-9D74-3BC7F5447551-GENID-1-6-1-17-1-1-5-1-5-1-4-1-3-1.dita#GUID-55BF8452-F9FF-5CF3-9D74-3BC7F5447551-GENID-1-6-1-17-1-1-5-1-5-1-4-1-3-1/GUID-D1C48642-0624-57F0-9AE4-D2A409F63870-GENID-1-6-1-17-1-1-5-1-5-1-4-1-3-1-2-1-11">Advanced settings</xref>  </p> </li>
</ul> <p id="GUID-A324BFE2-B946-54A1-A09E-AC5C8E1DDFE1-GENID-1-6-1-17-1-1-5-1-5-1-4-1-3-1-2-1-6"><b>Control settings</b> </p> <p>This
example demonstrates the following Camera control settings: </p> <ul>
<li id="GUID-CD56ECE4-35DA-5637-A24D-7AC62AE44593-GENID-1-6-1-17-1-1-5-1-5-1-4-1-3-1-2-1-8-1"><p> <b>Reserve:</b> Calls
the asynchronous <xref href="GUID-021C509B-C821-3401-B2F4-DE7F52BB16D4.dita#GUID-021C509B-C821-3401-B2F4-DE7F52BB16D4/GUID-3AA43050-7660-32AE-80B5-64A332A45A9E"><apiname>CCamera::Reserve()</apiname></xref> function to initialise
and reserve the camera for exclusive use. Calls the <xref href="GUID-F2DC0AB8-A896-3F7A-BBED-848A3F463853.dita#GUID-F2DC0AB8-A896-3F7A-BBED-848A3F463853/GUID-A663DE12-C63B-31C5-9B54-E4DE9C8C538F"><apiname>MCameraObserver::ReserveComplete()</apiname></xref> when
initialisation is complete. </p> </li>
<li id="GUID-0B9EECF7-A7E4-52B0-AA28-9711508D89F0-GENID-1-6-1-17-1-1-5-1-5-1-4-1-3-1-2-1-8-2"><p> <b>Power on:</b> Calls
asynchronous the <xref href="GUID-52DF368F-96BC-3552-9C9E-FB0A291F9AE2.dita#GUID-52DF368F-96BC-3552-9C9E-FB0A291F9AE2/GUID-646B4F4B-7A2F-371B-A05A-2B69B9CE9409"><apiname>CCameraAppUi::PowerOn()</apiname></xref> function to switch
on the power of the camera. You must have successfully called the <xref href="GUID-021C509B-C821-3401-B2F4-DE7F52BB16D4.dita#GUID-021C509B-C821-3401-B2F4-DE7F52BB16D4/GUID-3AA43050-7660-32AE-80B5-64A332A45A9E"><apiname>CCamera::Reserve()</apiname></xref> prior
to calling this function. Calls the <xref href="GUID-F2DC0AB8-A896-3F7A-BBED-848A3F463853.dita#GUID-F2DC0AB8-A896-3F7A-BBED-848A3F463853/GUID-F6F56654-FA74-3B2B-8098-954E7BF56DBB"><apiname>MCameraObserver::PowerOnComplete()</apiname></xref> when
power on is complete. </p> </li>
<li id="GUID-19A1B274-D971-53B7-88A4-5B49190F70F0-GENID-1-6-1-17-1-1-5-1-5-1-4-1-3-1-2-1-8-3"><p> <b>Viewfinder:</b> Calls
the <xref href="GUID-52DF368F-96BC-3552-9C9E-FB0A291F9AE2.dita#GUID-52DF368F-96BC-3552-9C9E-FB0A291F9AE2/GUID-07462599-A4DC-3F19-88BA-90C2273FC1C2"><apiname>CCameraAppUi::StartViewFinderL()</apiname></xref> function to transfer
the viewfinder data to the given portion of the screen using Direct Screen
Access. To stop the transfer of the data, the <xref href="GUID-52DF368F-96BC-3552-9C9E-FB0A291F9AE2.dita#GUID-52DF368F-96BC-3552-9C9E-FB0A291F9AE2/GUID-F56E8370-541C-3D53-AD18-D74C915ACC30"><apiname>CCameraAppUi::StopViewFinder()</apiname></xref> function
is called. </p> </li>
<li id="GUID-C239097A-218E-50EC-B8C9-01D6568F5577-GENID-1-6-1-17-1-1-5-1-5-1-4-1-3-1-2-1-8-4"><p> <b>Capture image:</b> Gets
the image size for the index passed by calling the <xref href="GUID-021C509B-C821-3401-B2F4-DE7F52BB16D4.dita#GUID-021C509B-C821-3401-B2F4-DE7F52BB16D4/GUID-4248DD3D-17D9-3EBE-92F9-4FD365AE027E"><apiname>CCamera::EnumerateCaptureSizes()</apiname></xref> function.
The image details such as image format and the size index are passed to the <xref href="GUID-021C509B-C821-3401-B2F4-DE7F52BB16D4.dita#GUID-021C509B-C821-3401-B2F4-DE7F52BB16D4/GUID-7BACBBAA-88D8-3DF1-8ED2-3A389A3B223C"><apiname>CCamera::PrepareImageCaptureL()</apiname></xref> function
to allocate the memory for the image to be captured. Then, a call to the <xref href="GUID-021C509B-C821-3401-B2F4-DE7F52BB16D4.dita#GUID-021C509B-C821-3401-B2F4-DE7F52BB16D4/GUID-0536FECC-1BD8-3726-8BBE-B1231739F23E"><apiname>CCamera::CaptureImage()</apiname></xref> captures
the image. </p> </li>
<li id="GUID-4EE3265C-AADA-5D5F-9937-519F87532051-GENID-1-6-1-17-1-1-5-1-5-1-4-1-3-1-2-1-8-5"><p> <b>Capture Video:</b> Gets
the video frame size and video frame rate for the index passed by calling
the <xref href="GUID-021C509B-C821-3401-B2F4-DE7F52BB16D4.dita#GUID-021C509B-C821-3401-B2F4-DE7F52BB16D4/GUID-C52FB21D-60EE-3202-BB50-ABDF4CDF3DB4"><apiname>CCamera::EnumerateVideoFrameSizes()</apiname></xref> function and the <xref href="GUID-021C509B-C821-3401-B2F4-DE7F52BB16D4.dita#GUID-021C509B-C821-3401-B2F4-DE7F52BB16D4/GUID-F3C6E294-1EF2-3BB4-B1FC-87194DA1D6CA"><apiname>CCamera::EnumerateVideoFrameRates()</apiname></xref> functions
respectively. The video details such as frame sizes and frame rate index are
passed to the <xref href="GUID-021C509B-C821-3401-B2F4-DE7F52BB16D4.dita#GUID-021C509B-C821-3401-B2F4-DE7F52BB16D4/GUID-12494A9A-D9DE-30F3-B59D-266772507BF2"><apiname>CCamera::PrepareVideoCaptureL ()</apiname></xref> function
to allocate the memory for the video to be captured. Then, a call to the <xref href="GUID-021C509B-C821-3401-B2F4-DE7F52BB16D4.dita#GUID-021C509B-C821-3401-B2F4-DE7F52BB16D4/GUID-8743EF65-BE30-3B98-8B35-8BE1A64E93F3"><apiname>CCamera::StartVideoCapture()</apiname></xref> starts
capturing the video and a call to the <xref href="GUID-021C509B-C821-3401-B2F4-DE7F52BB16D4.dita#GUID-021C509B-C821-3401-B2F4-DE7F52BB16D4/GUID-E1CC7187-B07C-3584-A10C-24366FB4B203"><apiname>CCamera::StopVideoCapture()</apiname></xref> stops
capturing the video. </p> </li>
<li id="GUID-35D08B01-12D1-54AE-90EA-447BC072E66E-GENID-1-6-1-17-1-1-5-1-5-1-4-1-3-1-2-1-8-6"><p> <b>Power off:</b> Calls
the <xref href="GUID-52DF368F-96BC-3552-9C9E-FB0A291F9AE2.dita#GUID-52DF368F-96BC-3552-9C9E-FB0A291F9AE2/GUID-2C391669-BBD5-3BB4-B487-C437FE012ED3"><apiname>CCameraAppUi::PowerOff()</apiname></xref> function to synchronously
switch off the camera power. </p> </li>
</ul> <p id="GUID-7F7A8058-D3AC-5FEA-B82F-81BEF89DB54B-GENID-1-6-1-17-1-1-5-1-5-1-4-1-3-1-2-1-9"><b> Basic settings</b> </p> <p>For
controlling the brightness and the contrast of the device, calls to the <xref href="GUID-021C509B-C821-3401-B2F4-DE7F52BB16D4.dita#GUID-021C509B-C821-3401-B2F4-DE7F52BB16D4/GUID-F8C3D786-2452-3702-A55D-170EAB5CA27E"><apiname>CCamera::Brightness()</apiname></xref> and
the <xref href="GUID-021C509B-C821-3401-B2F4-DE7F52BB16D4.dita#GUID-021C509B-C821-3401-B2F4-DE7F52BB16D4/GUID-119A8C75-FDB7-3DA0-859E-2DE49D8C0CB2"><apiname>CCamera::Contrast()</apiname></xref> functions are made. Increment and
decrement factors are separately passed to the <xref href="GUID-021C509B-C821-3401-B2F4-DE7F52BB16D4.dita#GUID-021C509B-C821-3401-B2F4-DE7F52BB16D4/GUID-22722C7A-229A-3BD5-8639-D4A6450B26E1"><apiname>CCamera::SetBrightnessL()</apiname></xref> and
the <xref href="GUID-021C509B-C821-3401-B2F4-DE7F52BB16D4.dita#GUID-021C509B-C821-3401-B2F4-DE7F52BB16D4/GUID-8F8DE11C-4350-3010-8B28-A635C82E4214"><apiname>CCamera::SetContrastL()</apiname></xref> functions to increase and decrease
the brightness and contrast respectively. Similarly, you can control other
features like flash and exposure time of the device. </p> <p id="GUID-D1C48642-0624-57F0-9AE4-D2A409F63870-GENID-1-6-1-17-1-1-5-1-5-1-4-1-3-1-2-1-11"><b>Advanced
settings</b> </p> <p>Advanced settings, such as, capturing a snapshot and
presets need to have the corresponding settings object created. This can be
done by calling the corresponding advanced setting class's <codeph>NewL()</codeph> function
passing in the <xref href="GUID-021C509B-C821-3401-B2F4-DE7F52BB16D4.dita"><apiname>CCamera</apiname></xref> object to it. For example, to create
a snapshot object, call the <xref href="GUID-7DB06650-199E-3B00-A19A-1B48D671E46E.dita#GUID-7DB06650-199E-3B00-A19A-1B48D671E46E/GUID-F2BC20F6-4E09-3556-8C3D-E7F60329FFB5"><apiname>CCamera::CCameraSnapshot::NewL(*camera)</apiname></xref> function.
Use this <xref href="GUID-021C509B-C821-3401-B2F4-DE7F52BB16D4.dita"><apiname>CCamera</apiname></xref> object to call any of the functions such
as the <xref href="GUID-67DF1203-B840-3C25-8EB5-3F0C8F28A4FF.dita#GUID-67DF1203-B840-3C25-8EB5-3F0C8F28A4FF/GUID-2D0B1BCD-DB21-33F7-A223-9C581E746023"><apiname>CCameraAdvancedSettings::SupportedBracketModes()</apiname></xref>,
the <xref href="GUID-9749B0DF-B887-3798-9185-481DF8E2F7C2.dita#GUID-9749B0DF-B887-3798-9185-481DF8E2F7C2/GUID-DB5EF834-999A-3726-AAB8-AC3925D6B7F2"><apiname>CCameraSnapshot::StartSnapshot()</apiname></xref>, the <xref href="GUID-02976C21-8B30-3E1C-ADA5-5205AF46408E.dita#GUID-02976C21-8B30-3E1C-ADA5-5205AF46408E/GUID-EB64375C-FB2D-3078-8115-85386BA8B4C5"><apiname>CCameraDirectViewFinder::ResumeViewFinderDirectL()</apiname></xref> and
the <xref href="GUID-BC0F4399-4DA7-3977-AD17-8415AEBA7317.dita#GUID-BC0F4399-4DA7-3977-AD17-8415AEBA7317/GUID-DB4C212F-FDFE-318F-A740-87FCE427BE09"><apiname>CCameraHistogram::PrepareHistogramL()</apiname></xref> to set the advanced
features. </p> </section>
<section><title>Download</title> <p>Click on the following link to download
the example: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/zips/guid-b491ac90-54d1-4183-8004-70ae0725468d.zip" scope="external">CameraExample.zip file</xref></p><p>Click: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/guid-b491ac90-54d1-4183-8004-70ae0725468d.html" scope="peer">browse </xref> to view the example code. </p> </section>
<section><title>Class summary</title><p> <xref href="GUID-021C509B-C821-3401-B2F4-DE7F52BB16D4.dita"><apiname>CCamera </apiname></xref> <xref href="GUID-67DF1203-B840-3C25-8EB5-3F0C8F28A4FF.dita"><apiname>CCameraAdvancedSettings </apiname></xref>  <xref href="GUID-02976C21-8B30-3E1C-ADA5-5205AF46408E.dita"><apiname>CCameraDirectViewFinder </apiname></xref>  <xref href="GUID-9749B0DF-B887-3798-9185-481DF8E2F7C2.dita"><apiname>CCameraSnapshot </apiname></xref> <xref href="GUID-BC0F4399-4DA7-3977-AD17-8415AEBA7317.dita"><apiname>CCameraHistogram </apiname></xref>  <xref href="GUID-75F14618-727C-340C-B34A-ECEEA5F612F9.dita"><apiname>CCameraOverlay </apiname></xref><xref href="GUID-2D94F0AD-10D4-3C3E-B445-3728718C8765.dita"><apiname>CCameraImageProcessing </apiname></xref>  <xref href="GUID-196072A3-9152-3E61-A09D-1BD071D1E908.dita"><apiname>CCameraPresets </apiname></xref><xref href="GUID-09C6DDB6-A208-3C81-9F54-697D4865D99F.dita"><apiname>MCameraObserver2 </apiname></xref>  </p></section>
<section id="GUID-4B0B8B67-DCF1-5551-9EFF-7D021D0FD9CE-GENID-1-6-1-17-1-1-5-1-5-1-4-1-3-1-2-4"><title>Build</title> <p>The <xref href="GUID-3100800B-B2F7-50EF-BD4C-3C345ECCB2A5.dita">Symbian build process</xref> describes
how to build an application. </p> <p>The CameraExample builds an executable
called <filepath>cameraexample.exe</filepath> in the standard location (<filepath>\epoc32\release\winscw\</filepath> <i>&lt;build_variant&gt;</i> for
CodeWarrior). Either launch the executable itself, or launch the emulator
and then select the icon CameraExample from the Emulator's extras bar. </p> </section>
</conbody></concept>