|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE concept |
|
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
|
12 <concept id="GUID-652DA0DD-AB1D-58A4-A6D2-27B5BAA506FF" xml:lang="en"><title>Flipping |
|
13 and Rotating an External Surface</title><shortdesc>This topic provides an example of flipping and rotating a surface |
|
14 in order to mirror the camera viewfinder during video telephony. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
15 <p> <b>Variant</b>: ScreenPlay. <b>Target audience</b>: Device |
|
16 creators. </p> |
|
17 <p>When users use the camera at the front of their phone during video telephony, |
|
18 they expect their image to be mirrored like when they look in a mirror. The |
|
19 camera viewfinder renders its content to a graphics surface which is displayed |
|
20 in a window by setting it as the background surface. To mirror the viewfinder |
|
21 content, first flip the surface and then rotate it by 180°. </p> |
|
22 <fig id="GUID-87C0B943-81DC-5AB8-BD08-254811F511B5"> |
|
23 <title> Mirroring </title> |
|
24 <image href="GUID-7F0EC737-F5EE-5B58-B9EB-4D8A058E3A49_d0e200429_href.jpg" placement="inline"/> |
|
25 </fig> |
|
26 <p>The following example code assumes that the surface already exists. Call <xref href="GUID-59A10068-E37A-37CF-85C9-36D8DA6619FA.dita#GUID-59A10068-E37A-37CF-85C9-36D8DA6619FA/GUID-F42D5405-2144-34AB-B3FE-C1D76C2A3B31"><apiname>TSurfaceConfiguration::SetFlip()</apiname></xref> to |
|
27 flip the surface, then call <xref href="GUID-59A10068-E37A-37CF-85C9-36D8DA6619FA.dita#GUID-59A10068-E37A-37CF-85C9-36D8DA6619FA/GUID-A7CC9BAA-301D-3006-AAA8-6549B163A448"><apiname>TSurfaceConfiguration::SetOrientation()</apiname></xref> to |
|
28 rotate the flipped surface by 180°. Finally bind the surface to the window. |
|
29 If necessary, set attributes such as extent to the surface configuration. </p> |
|
30 <codeblock id="GUID-EE5C2403-E4BC-503B-B49C-1580AA32DA7A" xml:space="preserve">TSurfaceConfiguration config; |
|
31 RWindow iWindow; |
|
32 |
|
33 // Set the surface ID. |
|
34 config.SetSurfaceId(iSurfaceId); |
|
35 |
|
36 // Get the window size and set the extent. |
|
37 const TRect windowSize(iWindow->Size()); |
|
38 config.SetExtent(windowSize); |
|
39 |
|
40 // Set the flipping |
|
41 config.SetFlip(ETrue); |
|
42 |
|
43 // Rotate the flipped surface by 180° |
|
44 config.SetOrientation(CFbsBitGc::EGraphicsOrientationRotated180); |
|
45 |
|
46 // Bind the surface to the window using the configuration |
|
47 iWindow.SetBackgroundSurface(config, ETrue);</codeblock> |
|
48 </conbody><related-links> |
|
49 <link href="GUID-495EA1C8-E95F-54AE-B4D1-0F463003C2D7.dita"><linktext>External |
|
50 Surfaces Overview</linktext></link> |
|
51 |
|
52 </related-links></concept> |