Symbian programming Summary-graphic and image-Direct screen access

Source: Internet
Author: User

This article was originally prepared by Yang. If you need to reselect the article, please indicate the source. Thank you!

In Symbian OS, there are two ways to draw images to reduce flickering:

  1. Use double cache to draw images (Click here to enter related articles)
  2. Use the CDirectScreenAccess class to draw the screen directly.

The CDirectScreenAccess class is described as follows:

Direct screen access is a way of drawing to the screen without using the window server. as this avoids client-server communication, it is much faster, and may be useful for games and video. note that some interaction with the window server is needed in order to prevent the application from drawing over other application's data.

In addition, CDirectScreenAccess can also intercept the pop-up events of system notification messages (such as menu pop-up, dial-in by phone, and message receipt), so as to avoid unnecessary refresh.

1. simple use of CDirectScreenAccess

CDirectScreenAccess is easy to use. The following steps describe how to use CDirectScreenAccess:

  1. Use the wizard in Carbide C ++ to generate a GUI application
  2. Create the member variable CDirectScreenAccess * iDSA in the View class;
  3. Create a private method void DrawGraphics () in the View class. The Code is as follows:

    Void CTestDirectDrawAppView: DrawGraphics ()
    {
    CFbsBitGc * gc = iDSA-> Gc ();

    TRgb colorRed = AKN_LAF_COLOR (35 );
    Gc-> SetPenColor (colorRed );
    Gc-> DrawRect (TRect (0, 0,100,100 ));

    IDSA-> ScreenDevice ()-> Update ();
    }

  4. Add the following code to the ConstructL method of the View class:

    CEikonEnv * env = CEikonEnv: Static ();
    IDSA = CDirectScreenAccess: NewL (env-> WsSession (), * (env-> ScreenDevice (), this-> Window (), * this );

    IDSA-> StartL ();
    DrawGraphics ();

  5. Create the following two private methods in the View class:

    Void Restart (RDirectScreenAccess: TTerminationReasons aReason );
    Void AbortNow (RDirectScreenAccess: TTerminationReasons aReason );

    The implementation is as follows:

    Void CTestDirectDrawAppView: Restart (RDirectScreenAccess: TTerminationReasons aReason)
    {
    IDSA-> StartL ();
    DrawGraphics ();
    }

    Void CTestDirectDrawAppView: AbortNow (RDirectScreenAccess: TTerminationReasons aReason)
    {
    IDSA-> Cancel ();
    }

    Click here to download the source code

 

Ii. Analysis implementation process

1. General Drawing Process

2. Drawing Process when there is a system dialog box notification

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.