×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Sep 2004
    Posts
    9

    How to show bitmap from a byte stream?

    How to show bitmap from a byte stream?

    I am developing a application which neeed to fetch a bitmap from a server.
    I am able to get the byte from the server but i cannot find any API to show the bitmap on the screeen. ....

    Can anyone help me?

  2. #2
    Registered User
    Join Date
    Oct 2004
    Posts
    12
    Hi,

    you can use the following method:

    CWindowGc::BitBlt().

    Before you must internalize the byte stream in a CFbsBitmap object and pass it to the method above.

  3. #3
    Registered User
    Join Date
    Sep 2004
    Posts
    9
    I am still quite confusing....
    Suppose the we have declare a TBuf8 buffer to hold the incoming bitmap file data..then we should i do exactly?
    could you kindly show some code as I have try many times on it?

  4. #4
    Registered User
    Join Date
    Oct 2004
    Posts
    12
    Hi,

    I try to show you how you could solve the problem.

    Suppose that the bitmap is stored in

    TBuf8<Size> aBitmapDescriptor;

    Than you create a
    RDesReadStream aStream; aStream.Open(aBitmapDescriptor);

    CFbsBitmap* aBitmap = new (ELeave)
    CFbsBitmap();
    CleanupStack::PushL(aBitmap);
    aScreen->InternalizeL(aBitmap);

    /* Pass this bitmap to your container and call inside Draw() method gc.BitBlt(), where the bitmap is one of the parameters and
    CWindowGc& gc = SystemGc();
    To draw yuor container you call its method DrawNow().*/


    //Release allocated resources
    aStream.Close();
    CleanupStack::PopAndDestroy(aBitmap);

    I hope that's useful for you.

  5. #5
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,144
    if you are talking about network servers, you might wanna move the file over the network in some compressed format, like jpg, then you need to use the image converters to get the jpg data stored in the buffer to be converted to the bitmap, see SDK docs for more information.

    yucca

  6. #6
    Registered User
    Join Date
    Sep 2004
    Posts
    9
    Thx.This is my code...in the function Draw

    TBuf8<256> aBitmapDescriptor;

    RDesReadStream aStream;
    aStream.Open(aBitmapDescriptor);

    CFbsBitmap* aBitmap = new (ELeave) CFbsBitmap();
    CleanupStack::PushL(aBitmap);
    aBitmap->InternalizeL(aStream);


    aStream.Close();
    CleanupStack::PopAndDestroy(aBitmap);


    I am using N-gage and Series 60 SDK 1.2. I can compile the program, but when I run it on the phone, System error was result after i add "aBitmap->InternalizeL(aStream);"
    I dun know the reason, can anybody kindly tell me the reason?
    Last edited by ccwhk; 2005-03-26 at 10:35.

Posting Permissions

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