MdaImageDescToBitmapUtility

Login to reply to this topic.
Mon, 2005-09-12 14:31
Joined: 2005-01-21
Forum posts: 37
I want to recieve a bitmapfile from pc to emulator.
I am using sdk socket example to get binary data from pc.

void CSocketsEngine::ResponseReceived( const TDesC8& aBuffer )
{
BitmapBuffer.Append(aBuffer);//after everyread,append data to picture buffer
if(icompleted) //all data has been recieved
{
RDesReadStream rdrs;
rdrs.Open(iBitmapBuffer);
bmp=new(ELeave)CFbsBitmap;
CleanupStack::PushL(bmp);
bmp->InternalizeL(rdrs); // at this line crash
rdrs.Close();
CleanupStack::PopAndDestroy(bmp);
bmp->Save(_L("c:\\System\\Apps\\calismalar\\s\\1.bmp"));
}

bmp->InternalizeL(rdrs); At this line program crashed.
Help pls!

Tue, 2005-09-13 22:49
Guest (not verified)
Forum posts: 2043
Re: InternalizeL
Crashing or leaving?

If its leaving why don't you see what the leave code is, if its crashing why don't you tell us all what the panic code is.

You can't expect an answer to your question as its currently posted.

Why don't you look at the contents of bmp and check its as you expect (i.e. what you place in the socket on the pc side)
Wed, 2005-09-14 10:21
Joined: 2005-01-21
Forum posts: 37
Re: InternalizeL
Error:0xC0000005 access violation.
In pc side my bmp size 1718 byte.In emulator side coming data 1718 byte.So iBitmapBuffer's data are true.
Wed, 2005-09-14 17:29
Guest (not verified)
Forum posts: 2043
Re: InternalizeL
Guess: As there's an internalize function there must be a corresponding externalize function which may add some data (such as the length). If you are putting your bitmapt raw across the socket and not externalizing it then it may not be in a format that is compatibile with the internalize function.
Fri, 2005-09-16 13:15
Joined: 2005-01-21
Forum posts: 37
Re: InternalizeL
Could you show me an example?
Fri, 2005-09-16 13:39
Joined: 2003-12-05
Forum posts: 683
Re: InternalizeL
If you receive the bitmap data from the PC to a descriptor, then probably you should create a CFbsBitmap using CMdaImageDescToBitmapUtility.
Fri, 2005-09-16 19:25
Joined: 2005-01-21
Forum posts: 37
Re: InternalizeL
void CSocketsEngine::ResponseReceived( const TDesC8& aBuffer )
{
......
iMdaImageDescToBitmapUtility = CMdaImageDescToBitmapUtility::NewL(*this);
TDesC8&   DesImage = ((TDesC8&)iResimBuffer); //iResimBuffer<2048>buf,  my bitmap row data.1716 byte.
iMdaImageDescToBitmapUtility->OpenL(DesImage);
.....
}

//from MMdaImageUtilObserver
void CSocketsEngine::MiuoCreateComplete(TInt /*aError*/)
    {

    };

void CSocketsEngine::MiuoOpenComplete(TInt aError)
  {
      if( aError != KErrNone )
        {
            // Sad   
        }
   
        TInt frameCount = iMdaImageDescToBitmapUtility->FrameCount();
        if( frameCount == 0 )
        {
            // Sad   
        }

       iBitmap = new (ELeave) CFbsBitmap();

        TFrameInfo frame;
        iMdaImageDescToBitmapUtility->FrameInfo(0, frame);

        TSize size = frame.iOverallSizeInPixels;
        iBitmap->Create(size, EColor16);
        iMdaImageDescToBitmapUtility->ConvertL(*iBitmap);
   
    }

void CSocketsEngine::MiuoConvertComplete(TInt aError)
    {
        if( aError == KErrNone )
        {
            iBitmap->Save(_L("c:\\System\\Apps\\calismalar\\gelenresimler\\1.bmp")); //saving bitmap..
        }
    }
-----------------------------------------------------------
No crash or leaving occured.
But when I try to open c:\\System\\Apps\\calismalar\\gelenresimler\\1.bmp with Paint an error eccured:Paint can't read this file.This is note valid bitmap file..
---------------------------------------------------------------------------------------------------
What should I do extra?
Sat, 2005-09-17 11:45
Joined: 2003-12-05
Forum posts: 683
Re: MdaImageDescToBitmapUtility
It is a Symbian bitmap file, not a windows one. You cannot open it using PaintBrush. Just Draw it to the screen on the emulator now. Or whatever you need. And read a section on bitmaps from the SDK docs.
Sat, 2005-09-17 22:43
Joined: 2005-01-21
Forum posts: 37
Re: MdaImageDescToBitmapUtility
Ok.
Thanks alot Andreas.
Mon, 2005-09-19 08:01
Joined: 2003-12-05
Forum posts: 683
Re: MdaImageDescToBitmapUtility
BTW, you can convert Symbian bitmap files (mbm) to Windows bitmaps using mbconv command line tool.

And regarding my earlier post about using the CMda... image conversion classes. If you receive the bitmap as a Windows bitmap, you first need to save it to disc from your descriptor data, then you need to convert the Win bmp to Symbian one, and then you can draw it.
Mon, 2005-09-19 17:52
Joined: 2005-01-21
Forum posts: 37
Re: MdaImageDescToBitmapUtility
Quote from: Andreas
BTW, you can convert Symbian bitmap files (mbm) to Windows bitmaps using mbconv command line tool.

And regarding my earlier post about using the CMda... image conversion classes. If you receive the bitmap as a Windows bitmap, you first need to save it to disc from your descriptor data, then you need to convert the Win bmp to Symbian one, and then you can draw it.
Also I have done it.But I  was trying to open symbian bitmap with paint:)))
Now I can draw bitmap.
Thanks alot.
Mon, 2005-09-26 23:50
Joined: 2005-01-21
Forum posts: 37
Re: MdaImageDescToBitmapUtility
I want to make  convertion a desc buffer to bitmap within a  loop.I mean that n times ResponseReceived function  will run.So n times "iMdaImageDescToBitmapUtility->OpenL(DesImage);" will run.
In emulator with debug, first passing in loop is really speed,but the second passing is very slow..What is the problem?



void CSocketsEngine::ResponseReceived( const TDesC8& aBuffer )
{
......
iMdaImageDescToBitmapUtility = CMdaImageDescToBitmapUtility::NewL(*this);
TDesC8&   DesImage = ((TDesC8&)iResimBuffer);
iMdaImageDescToBitmapUtility->OpenL(DesImage);
.....
}

//from MMdaImageUtilObserver
void CSocketsEngine::MiuoCreateComplete(TInt /*aError*/)
    {

    };

void CSocketsEngine::MiuoOpenComplete(TInt aError)
  {
      if( aError != KErrNone )
        {
            //     
        }
   
        TInt frameCount = iMdaImageDescToBitmapUtility->FrameCount();
        if( frameCount == 0 )
        {
            //     
        }

       iBitmap = new (ELeave) CFbsBitmap();

        TFrameInfo frame;
        iMdaImageDescToBitmapUtility->FrameInfo(0, frame);

        TSize size = frame.iOverallSizeInPixels;
        iBitmap->Create(size, EColor256);
        iMdaImageDescToBitmapUtility->ConvertL(*iBitmap);
   
    }

void CSocketsEngine::MiuoConvertComplete(TInt aError)
    {
        if( aError == KErrNone )
        {
            iBitmap->Save(_L("c:\\System\\Apps\\calismalar\\gelenresimler\\1.bmp")); //saving bitmap..
           iMdaImageDescToBitmapUtility->Close();
        }
    }
  • Login to reply to this topic.