CMdaImageDescToBitmap : KErrNotSupported

Login to reply to this topic.
Thu, 2005-06-09 09:56
Joined: 2003-12-30
Forum posts: 93
Hi !

I have a curious problem trying to convert a desc to a Bitmap. The iBuffer has a correct size and there's an error in MiuoOpenComplete there's a KerrNotSupported. Of course I've read a post concerning this problem (http://forum.newlc.com/index.php/topic,1555.0.html)
but really can't figure out how the proposed code snippet can work.
Has someone a code snipet of this kinda mysterious CMdaImageDescToBitmapUtility Library Huh Huh

Thx a lot for your answers !

Here's my non-working code if you want to suggest some modifications :

void CMyClass::ReadFromDescAndConvert()
{
   iDescToBitmapConverter = CMdaImageDescToBitmapUtility::NewL(*this);
   ReadFile();
   // iBuffer has the correct size
   iDescToBitmapConverter->OpenL(*iBuffer);
}

void CMyClass::Draw(const TRect& )
{
             CWindowGc& gc = SystemGc();
   gc.BitBlt(aPoint,iBitmap); // Raises a WSERV 7 Panic

}

void CMyClass::MiuoOpenComplete(TInt aError)
{

   // Test to read a bitmap content from a Desc
   if(aError==KErrNone)
   {

      TFrameInfo frame;
              iDescToBitmapConverter->FrameInfo(0, frame);
              TSize size = frame.iOverallSizeInPixels;
      iBitmap->Create(size, EColor16MU);
      iDescToBitmapConverter->ConvertL(*iBitmap);

   }
   else
   {
      CAknInformationNote* n = new CAknInformationNote;
      n->ExecuteLD(_L("error"));
   }
}

void CMyClass::ReadFile()
{
   RFile file;
   HBufC* aFile = HBufC::NewL(256);

   // Name of the file to read
   aFile->Des().Copy(_L("myPicture.mbm"));
   TInt err=file.Open(CEikonEnv::Static()->FsSession(),aFile->Des(),EFileStreamText);
   if (err==KErrNone) {
      TInt size;
      file.Size(size);
      iBuffer = HBufC8::NewL(size);
      TPtr8 p = iBuffer->Des();
      file.Read(p);
      file.Close();
   }
   
}

MatD


Sun, 2005-06-12 21:33
Joined: 2003-10-08
Forum posts: 106
Re: CMdaImageDescToBitmap : KErrNotSupported
Quote
aFile->Des().Copy(_L("myPicture.mbm"));

  Whoops! Is that an MBM I see!?? KErrNotSupported is returned by the CMdaImageDescToBitmapUtility when it does not recognize the image file format that has been passed to it in the descriptor! Also, it only supports non-native image formats like PNG, BMP, GIF, etc.
  To load an MBM, you can directly create a CFbsBitmap and use it's Load() method (check the SDK docs on CFBsBitmap).

Regards,
Varun

  • Login to reply to this topic.