×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    4

    Unhappy convert images from buffer using CBufferedImageDecoder

    Hello,everyone.
    I use CBufferedImageDecoder to convert images from buffer,and then insert the images to iBitmapEditor(an EikRichTextEditor).It works if only one image,while an WSERV 7 error occured if two images.It means a invalid bitmap handle,but i didn't get the second image for buffer until the first iamge was completely converted.
    The code as follows:

    //NotifyCompletion,called by CImageConverterEngine::RunL()
    //iConverter,CImageConverterEngine
    void CContextContainer::NotifyCompletion( TInt aErr )
    {
    .......
    CMyPicture* picture;
    picture = new( ELeave )CMyPicture(sizeTwips, *(iConverter->iBitmap));
    CleanupStack::PushL(picture);
    TPictureHeader header;
    header.iPicture = TSwizzle<CPicture>(picture);
    CRichText* text = iBitmapEditor->RichText();
    text->InsertL(0, header);
    CleanupStack::Pop();

    iBitmapBuf->Des().Delete(0,iBitmapBuf->Des().Length());//clear the buf
    if (iArrayIndex < iArryAddr->Count())
    {
    //get the second image
    iBitmapBuf->Des().Copy();
    iConverter->StartToDecodeL(*iBitmapBuf);
    }
    }

    void CImageConverterEngine::StartToDecodeL( TDesC8& aData)
    {
    ....
    iBufImageDecoder->Convert( &iStatus, *iBitmap );
    ...
    }

    If any help,i will appreciate.

  2. #2
    Registered User
    Join Date
    Jun 2007
    Posts
    28

    Re: convert images from buffer using CBufferedImageDecoder

    After clearing the buffer for first image where are you updating the buffer with second image data???

    in the follwing line??
    //get the second image
    iBitmapBuf->Des().Copy();//didnt this line gave u compilation error??

  3. #3
    Regular Contributor
    Join Date
    Apr 2007
    Location
    beijing,china
    Posts
    496

    Re: convert images from buffer using CBufferedImageDecoder

    heaven or dell? survival or death?

  4. #4
    Registered User
    Join Date
    Oct 2007
    Posts
    4

    Re: convert images from buffer using CBufferedImageDecoder

    I find the answer.I shoudn't delete the iBitmap before iBitmapEditor destroyed.
    I add iBitmap to iBitmapArray(an array) and set iBitmap NULL,so the CImageConverterEngine will never delete iBitmap.

    Code as follows:
    void CContextContainer::NotifyCompletion( TInt aErr )
    {
    ...
    iArryBitmap->AppendL(iConverter->iBitmap);
    iConverter->iBitmap = NULL;
    ...
    }

  5. #5
    Registered User
    Join Date
    Oct 2007
    Posts
    4

    Smile Re: convert images from buffer using CBufferedImageDecoder

    void CImageConverterEngine::StartToDecodeL( TDesC8& aData)
    {
    delete iBufImageDecoder; iBufImageDecoder = NULL;
    delete iBitmap;//here is the point.
    iBitmap = NULL;
    ....
    iBufImageDecoder->Convert( &iStatus, *iBitmap );
    ...
    }
    void CContextContainer::NotifyCompletion( TInt aErr )
    {
    CMyPicture* picture;
    picture = new( ELeave )CMyPicture(sizeTwips, *(iConverter->iBitmap));
    ......
    }
    CMyPicture::CMyPicture( TSize aSize, CFbsBitmap& aBitmap )
    : iSizeInTwips(aSize), iBitmap(&aBitmap)
    {
    }

    Thank you.

Similar Threads

  1. Replies: 6
    Last Post: 2005-10-03, 05:51
  2. Dialog's clipping area (again). Nokia experts, please help
    By synov in forum Symbian User Interface
    Replies: 0
    Last Post: 2004-06-26, 14:35
  3. convert png images to jpeg
    By adneimocne in forum Mobile Java Media (Graphics & Sounds)
    Replies: 3
    Last Post: 2004-05-30, 16:16
  4. Nokia 30 SMS sending problem !!!!!
    By pgredelj in forum General Messaging
    Replies: 1
    Last Post: 2004-01-12, 12:48
  5. how to convert buffer to bitmap
    By somrup.pal in forum Symbian
    Replies: 1
    Last Post: 2003-09-24, 08:28

Posting Permissions

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