Transparent Windows

This topic introduces the window transparency feature, which you can use to create semi-transparent UI content over other UI content. In ScreenPlay you can also use transparent windows to create semi-transparent UI content over external content, such as video and OpenGL ES. For example, in ScreenPlay you can display a semi-transparent dialog box over an OpenGL ES game. Transparent windows are implemented using alpha compositing, which means that the transparency information is embedded within the drawing commands.

Note : Semi-transparent UI content over content provided by Direct Screen Access (DSA) has never been supported and ScreenPlay does not change this.

Variant : ScreenPlay and non-ScreenPlay. Target audience : Application developers.

Alpha compositing

In alpha compositing, an alpha channel is used to store opacity information along with the color values for each pixel. For example, if the color is represented as RGB values, the pixel values are typically stored as RGBA, where the final value is the alpha value. This represents the percentage opacity. Like the RGB values, the alpha value is frequently expressed in the range of 0 (completely transparent) to 255 (fully opaque). For example, (0, 0, 0, 0) represents fully transparent black and (255, 255, 255, 127) represents white that has 50% opacity.

Each of the RGB values are multiplied by the alpha percentage to give the opacity of the pixel. In order to reduce the need for multiplication during the compositing process, the RGB values are sometimes multiplied by the alpha value before storage. This is known as premultiplied alpha format. For example, a premultiplied alpha representation of white that has 50% opacity is (127, 127, 127, 127).

Enabling transparency

To enable transparency, call the RWindow::SetTransparencyAlphaChannel() method on the window (which must be an RWindow type) before it is activated. The transparency is then determined by the alpha values of the content rendered to the window. Typically you set the background to be fully or partially transparent, as shown in the following example:

       
        
       
       // Set transparency mode on.
iWindow.SetTransparencyAlphaChannel();
    
// Set the background to be fully transparent black.
iWindow.SetBackgroundColor(TRgb(0,0,0,0)); 
    
// Activate the window.
iWindow.Activate();
    
// Begin drawing to the window.
...
      

Note

In earlier versions of the Symbian platform, it was possible to create transparent windows using a mask and the RWindow class's SetTransparencyFactor() , SetTransparencyBitmap() and SetTransparencyWsBitmap() methods. This mechanism is now deprecated and these methods are no longer functional .

A new application and UI framework is planned for Symbian^4 (S^4). In order for AVKON applications (and clients that draw using CWindowGc ) to work correctly on this new framework, the main view must be opaque. See How will the New Application Architecture Affect my Applications? for more information.