<?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-652DA0DD-AB1D-58A4-A6D2-27B5BAA506FF" xml:lang="en"><title>Flipping
and Rotating an External Surface</title><shortdesc>This topic provides an example of flipping and rotating a surface
in order to mirror the camera viewfinder during video telephony. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
<p> <b>Variant</b>: ScreenPlay. <b>Target audience</b>: Device
creators. </p>
<p>When users use the camera at the front of their phone during video telephony,
they expect their image to be mirrored like when they look in a mirror. The
camera viewfinder renders its content to a graphics surface which is displayed
in a window by setting it as the background surface. To mirror the viewfinder
content, first flip the surface and then rotate it by 180°. </p>
<fig id="GUID-87C0B943-81DC-5AB8-BD08-254811F511B5">
<title> Mirroring </title>
<image href="GUID-7F0EC737-F5EE-5B58-B9EB-4D8A058E3A49_d0e200429_href.jpg" placement="inline"/>
</fig>
<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
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
rotate the flipped surface by 180°. Finally bind the surface to the window.
If necessary, set attributes such as extent to the surface configuration. </p>
<codeblock id="GUID-EE5C2403-E4BC-503B-B49C-1580AA32DA7A" xml:space="preserve">TSurfaceConfiguration config;
RWindow iWindow;
// Set the surface ID.
config.SetSurfaceId(iSurfaceId);
// Get the window size and set the extent.
const TRect windowSize(iWindow->Size());
config.SetExtent(windowSize);
// Set the flipping
config.SetFlip(ETrue);
// Rotate the flipped surface by 180°
config.SetOrientation(CFbsBitGc::EGraphicsOrientationRotated180);
// Bind the surface to the window using the configuration
iWindow.SetBackgroundSurface(config, ETrue);</codeblock>
</conbody><related-links>
<link href="GUID-495EA1C8-E95F-54AE-B4D1-0F463003C2D7.dita"><linktext>External
Surfaces Overview</linktext></link>
</related-links></concept>