20 <p> <i>Note</i>: Semi-transparent UI content over content provided by Direct |
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 |
21 Screen Access (DSA) has never been supported and ScreenPlay does not change |
22 this. </p> |
22 this. </p> |
23 <p> <b>Variant</b>: ScreenPlay and non-ScreenPlay. <b>Target audience</b>: |
23 <p> <b>Variant</b>: ScreenPlay and non-ScreenPlay. <b>Target audience</b>: |
24 Application developers. </p> |
24 Application developers. </p> |
25 <section id="GUID-7208D287-D0D9-4E19-89F0-87DB9BCE4736"><title>Alpha compositing</title> <p>In alpha compositing, an alpha |
25 <section id="GUID-7208D287-D0D9-4E19-89F0-87DB9BCE4736"><title>Alpha compositing</title> <p>In |
26 channel is used to store opacity information along with the color values for |
26 alpha compositing, an alpha channel is used to store opacity information along |
27 each pixel. For example, if the color is represented as RGB values, the pixel |
27 with the color values for each pixel. For example, if the color is represented |
28 values are typically stored as RGBA, where the final value is the alpha value. |
28 as RGB values, the pixel values are typically stored as RGBA, where the final |
29 This represents the percentage opacity. Like the RGB values, the alpha value |
29 value is the alpha value. This represents the percentage opacity. Like the |
30 is frequently expressed in the range of 0 (completely transparent) to 255 |
30 RGB values, the alpha value is frequently expressed in the range of 0 (completely |
31 (fully opaque). For example, (0, 0, 0, 0) represents fully transparent black |
31 transparent) to 255 (fully opaque). For example, (0, 0, 0, 0) represents fully |
32 and (255, 255, 255, 127) represents white that has 50% opacity. </p> <p>Each |
32 transparent black 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 |
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 |
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 |
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, |
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, |
37 a premultiplied alpha representation of white that has 50% opacity is (127, |
38 127, 127, 127). </p> </section> |
38 127, 127, 127). </p> </section> |
39 <section id="GUID-ED7D01C9-6B18-4280-B44E-B62ADE9EBA90"><title>Enabling transparency</title> <p>To enable transparency, call |
39 <section id="GUID-ED7D01C9-6B18-4280-B44E-B62ADE9EBA90"><title>Enabling transparency</title> <p>To |
40 the <xref href="GUID-683603DD-F3D3-3193-BEB3-8236C7DE7F79.dita"><apiname>RWindow::SetTransparencyAlphaChannel()</apiname></xref> method |
40 enable transparency, call 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) |
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 |
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 |
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. |
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(); |
45 iWindow.SetTransparencyAlphaChannel(); |
50 // Activate the window. |
50 // Activate the window. |
51 iWindow.Activate(); |
51 iWindow.Activate(); |
52 |
52 |
53 // Begin drawing to the window. |
53 // Begin drawing to the window. |
54 ... </codeblock></section> |
54 ... </codeblock></section> |
55 <section id="GUID-66EBABCC-4BF4-4DE8-9AD3-27598F3A0025"><title>Note</title><p>In earlier versions of the Symbian platform, |
55 <section id="GUID-66EBABCC-4BF4-4DE8-9AD3-27598F3A0025"><title>Note</title><p>In |
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 |
56 earlier versions of the Symbian platform, it was possible to create transparent |
57 mechanism is now deprecated and these methods are no longer functional</b>.</p><p>A |
57 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 mechanism |
|
58 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 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 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 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 Architecture Affect my Applications?</xref> for more information.</p> </section> |
62 </conbody><related-links> |
63 </conbody><related-links> |
63 <link href="GUID-99AE1D62-571A-5A63-B472-C0FBC0861F52.dita"><linktext>Window Types</linktext> |
64 <link href="GUID-99AE1D62-571A-5A63-B472-C0FBC0861F52.dita"><linktext>Window Types</linktext> |
64 </link> |
65 </link> |
65 <link href="GUID-29272C8D-A0F6-4861-90FB-D1637D0D8CD8.dita"><linktext>How will |
66 <link href="GUID-29272C8D-A0F6-4861-90FB-D1637D0D8CD8.dita"><linktext>How will |
66 the New Application Architecture Affect my Applications?</linktext></link> |
67 the New Application Architecture Affect my Applications?</linktext></link> |
|
68 <link href="GUID-96E46D0E-1CE3-58B4-AE99-6B2E622ADAF9.dita"><linktext>Drawing transparent |
|
69 windows example</linktext></link> |
67 </related-links></concept> |
70 </related-links></concept> |