×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Registered User
    Join Date
    Jun 2005
    Posts
    17

    It takes time to load image on incoming call

    hi all,
    i am displaying an Image on screen when there is an incoming call. Although i am getting the event of incoming call in my App, But it TAKES TIME TO LOAD IMAGE. Should i use "CDirectScreenAccess" instead.

    My code for displaying image, in the Constructor is:
    ////////////////////////////////////////////////////////////////
    RWsSession& wsSession = CEikonEnv::Static()->WsSession();
    iWindowGroup = RWindowGroup(wsSession);
    iWindowGroup.Construct((TUint32)&iWindowGroup );
    iWindowGroup.EnableReceiptOfFocus(EFalse);
    iWindowGroup.SetNonFading(ETrue);
    CreateWindowL(iWindowGroup);

    LoadData(); //Function to load Image
    iWindowGroup.SetOrdinalPosition(0, 1);
    ActivateL();
    ///////////////////////////////////////////////////////////////////
    And then i am drawing the Image in Draw() function


    regards,
    Rahul

  2. #2
    Super Contributor
    Join Date
    Apr 2003
    Location
    Czech Republic
    Posts
    915
    I don't think that it would help you. The problem probably isn't in the actual bitbld to screen but in loading from the file / converting or whatever else you are doing.

    It would help to know what exactly is going on in LoadData() method...

  3. #3
    Registered User
    Join Date
    Jun 2005
    Posts
    17
    hi sopta007,
    Thnx for ur reply!

    In LoadData Function, i am reading an image(jpeg) from a file, the path of which is already stored in my database, and returning a bitmap using "convert" function of CImageDecoder class. I think this conversion is taking time.

    But i have to display the image instantaneously when the phone rings.

  4. #4
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,165
    you could try using MBM format, also re-size the image in the target size before saving it into the file, then it should work rather fast.

    yucca

  5. #5
    Registered User
    Join Date
    Jun 2005
    Posts
    17
    hi yucca,
    mbm format works fast, that is OK.

    But i have to select different files for different contacts, and then load the selected file on incoming call.

    how to use Mbm format in this case.

  6. #6
    Registered User
    Join Date
    Jun 2005
    Posts
    17
    hi yucca,
    i am trying to save the selected image as mbm, but before that i am scaling it to fit into my Rect. My code hangs at the Scale function of CBitmapScaler.


    CFbsBitmap* CImageScaler::ScaleL(CFbsBitmap* aBitmapImage)
    {
    CBitmapScaler* iScaler = CBitmapScaler::NewL();
    CleanupStack::PushL(iScaler);

    TRequestStatus stat = KRequestPending;

    iScaler->Scale(&stat, *aBitmapImage, DISPLAY_RECT.Size(), ETrue);
    User::WaitForRequest(stat); //MY CODE HANGS HERE


    if(stat != KErrNone)
    iScaler->Cancel();

    CleanupStack::PopAndDestroy();

    return aBitmapImage;
    }

  7. #7
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,165
    have you tried using active objects instead of User::WaitForRequest(), maybe it would work better.

    yucca

  8. #8
    Registered User
    Join Date
    Jun 2005
    Posts
    17
    OK,
    but in case i use CActive, then what should i have in RunL() and where should i return my scaled bitmap..


    One thing more, when there is an incoming call, before showing the selected image there occurs a white background having size "my Rect" for a while.
    And then the image is shown. How to remove that white background.

    I am using RWindowGroup. And in Appui i am sending my app in background. then in container constructor i am using SetOrdinalPosition()

  9. #9
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,165
    basically in your run you would call the function that handleds the bitmap, basically you could define a callback funtion that you cann with the scaled bitmap.

    The wait background is propably drawn untill your image is ready.

    Basically what I meant with the scaling earlier, was that you should scale the image before saving it, so using Load function for the mbm would be enough in the application. In case you are loading non-scaled image for showing, just don't scale it anymore, use the draw function in gc to draw them into thye desired rect. The scaling basically would only be used to minimize the size of the mbm, and thus making it faster to load.

    Also if you simple call load before drawing, you should have valid image before the draw gets called, and the white background should go away.

    yucca

  10. #10
    Registered User
    Join Date
    Jun 2005
    Posts
    17
    how to call "scale" function of CBitmapScaler using callback.
    Can u give some sample code.

  11. #11
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,165
    no I meant that, make the active object scaler as a separate components, that is using a interface definition as a callback to the component that requires the bitmap object. And use the callback interface function to set the bitmap to the component, or at least to indicate it that the scaling is finalized.

    yucca

  12. #12
    Registered User
    Join Date
    Jun 2005
    Posts
    17
    can u explain a bit more and provide some examples.

  13. #13
    Registered User
    Join Date
    Jun 2005
    Posts
    17
    Thnx yucca,
    i am able to scale the image in my app and save it as mbm file.

    But while incoming call, there is still a WHITE BACKGROUND for a while and then my bitmap is loaded.
    I am loading the bitmap before ActivateL in the constructor.


    Rahul

  14. #14
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,165
    hmm, could you them try to modify the draw function on your container. Just make sure you do nothing untill the bitmap pointer is non-NULL as well as the bitmap has a usable handle on it.

    yucca

  15. #15
    Registered User
    Join Date
    Jun 2005
    Posts
    17
    hi,
    I m drawing bitmap only if the pointer is valid.

    And if i write nothing in Draw function, then also that white background is shown. And it remains active until i cancel the call.

    Rahul

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×