Symbian3/SDK/Source/GUID-02BD38E7-A579-5BD5-9444-4E7C14C7809A.dita
changeset 7 51a74ef9ed63
child 8 ae94777fff8f
equal deleted inserted replaced
6:43e37759235e 7:51a74ef9ed63
       
     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-02BD38E7-A579-5BD5-9444-4E7C14C7809A" xml:lang="en"><title>Transparent
       
    13 Windows</title><shortdesc>This topic introduces the window transparency feature, which you
       
    14 can use to create semi-transparent UI content over other UI content. In ScreenPlay
       
    15 you can also use transparent windows to create semi-transparent UI content
       
    16 over external content, such as video and OpenGL ES. For example, in ScreenPlay
       
    17 you can display a semi-transparent dialog box over an OpenGL ES game. Transparent
       
    18 windows are implemented using alpha compositing, which means that the transparency
       
    19 information is embedded within the drawing commands. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    20 <p> <i>Note</i>: Semi-transparent UI content over content provided by Direct
       
    21 Screen Access (DSA) has never been supported and ScreenPlay does not change
       
    22 this. </p>
       
    23 <p> <b>Variant</b>: ScreenPlay and non-ScreenPlay. <b>Target audience</b>:
       
    24 Application developers. </p>
       
    25 <section id="GUID-7208D287-D0D9-4E19-89F0-87DB9BCE4736"><title>Alpha compositing</title> <p>In alpha compositing, an alpha
       
    26 channel is used to store opacity information along with the color values for
       
    27 each pixel. For example, if the color is represented as RGB values, the pixel
       
    28 values are typically stored as RGBA, where the final value is the alpha value.
       
    29 This represents the percentage opacity. Like the RGB values, the alpha value
       
    30 is frequently expressed in the range of 0 (completely transparent) to 255
       
    31 (fully opaque). For example, (0, 0, 0, 0) represents fully transparent black
       
    32 and (255, 255, 255, 127) represents white that has 50% opacity. </p> <p>Each
       
    33 of the RGB values are multiplied by the alpha percentage to give the opacity
       
    34 of the pixel. In order to reduce the need for multiplication during the compositing
       
    35 process, the RGB values are sometimes multiplied by the alpha value before
       
    36 storage. This is known as <b>premultiplied alpha</b> format. For example,
       
    37 a premultiplied alpha representation of white that has 50% opacity is (127,
       
    38 127, 127, 127). </p> </section>
       
    39 <section id="GUID-ED7D01C9-6B18-4280-B44E-B62ADE9EBA90"><title>Enabling transparency</title> <p>To enable transparency, call
       
    40 the <xref href="GUID-683603DD-F3D3-3193-BEB3-8236C7DE7F79.dita"><apiname>RWindow::SetTransparencyAlphaChannel()</apiname></xref> method
       
    41 on the window (which must be an <xref href="GUID-683603DD-F3D3-3193-BEB3-8236C7DE7F79.dita"><apiname>RWindow</apiname></xref> type)
       
    42 before it is activated. The transparency is then determined by the alpha values
       
    43 of the content rendered to the window. Typically you set the background to
       
    44 be fully or partially transparent, as shown in the following example: </p> <codeblock id="GUID-C33B91C2-D83C-5A6D-91A5-AB29B8EF46A0" xml:space="preserve">// Set transparency mode on.
       
    45 iWindow.SetTransparencyAlphaChannel();
       
    46     
       
    47 // Set the background to be fully transparent black.
       
    48 iWindow.SetBackgroundColor(TRgb(0,0,0,0)); 
       
    49     
       
    50 // Activate the window.
       
    51 iWindow.Activate();
       
    52     
       
    53 // Begin drawing to the window.
       
    54 ...  </codeblock></section>
       
    55 <section id="GUID-66EBABCC-4BF4-4DE8-9AD3-27598F3A0025"><title>Note</title><p>In earlier versions of the Symbian platform,
       
    56 it was possible to create transparent windows using a mask and the <xref href="GUID-683603DD-F3D3-3193-BEB3-8236C7DE7F79.dita"><apiname>RWindow</apiname></xref> class's <codeph>SetTransparencyFactor()</codeph>, <codeph>SetTransparencyBitmap()</codeph> and <codeph>SetTransparencyWsBitmap()</codeph> methods. <b>This
       
    57 mechanism is now deprecated and these methods are no longer functional</b>.</p><p>A
       
    58 new application and UI framework is planned for Symbian^4 (S^4). In order
       
    59 for AVKON applications (and clients that draw using <xref href="GUID-0AEE5955-C530-35F1-A904-69183331B294.dita"><apiname>CWindowGc</apiname></xref>)
       
    60 to work correctly on this new framework, the main view must be opaque. See <xref href="GUID-29272C8D-A0F6-4861-90FB-D1637D0D8CD8.dita">How will the New Application
       
    61 Architecture Affect my Applications?</xref> for more information.</p> </section>
       
    62 </conbody><related-links>
       
    63 <link href="GUID-99AE1D62-571A-5A63-B472-C0FBC0861F52.dita"><linktext>Window Types</linktext>
       
    64 </link>
       
    65 <link href="GUID-29272C8D-A0F6-4861-90FB-D1637D0D8CD8.dita"><linktext>How will
       
    66 the New Application Architecture Affect my Applications?</linktext></link>
       
    67 </related-links></concept>