*** CAN YOU TAKE A LOOK AT THIS ***

Login to reply to this topic.
Tue, 2005-11-22 10:51
Joined: 2005-11-16
Forum posts: 34
I have some codes here that wroks when used with as a gc object. Take a look at this:


Code:
// INCLUDE FILES
// Class include
#include "ImageLoader.h"
#include <coemain.h>

#define IMAGEREAD_TIMEOUT 5 * 1000 * 1000

static const TDisplayMode KDeviceColourDepth = EColor4K;
static const TInt KPngFrameIndex = 0;


CImageLoader::CImageLoader()
{
}

CImageLoader::~CImageLoader()
{
   delete iConverter;
   delete iBitmap;
   delete iScaler;
}


CFbsBitmap* CImageLoader::ReadImageL(const TDesC& aFileName)
{
iConverter = CMdaImageFileToBitmapUtility::NewL(*this);
iConverter->OpenL(aFileName);


CActiveScheduler::Start();

return iBitmap;
}


// called when OpenL() finishses
void CImageLoader::MiuoOpenComplete(TInt aError)
{
   if( aError != KErrNone )
   {
       iErrorCode = aError;
       return;
   }

   TFrameInfo info;
   iConverter->FrameInfo(0, info);
       
   // create a bitmap to write into
   iBitmap = new (ELeave) CFbsBitmap();
   TInt rc = iBitmap->Create(info.iOverallSizeInPixels, KDeviceColourDepth);
   
   if( rc != KErrNone )
   {
     iErrorCode = rc;
     return;
}

    // convert the gif into a bitmap
    TRAPD(error, iConverter->ConvertL(*iBitmap));
   
    // handle the error
   if( error != KErrNone)
   {
     iErrorCode = error;
     //Cancel();
     return;
    }
}


// called when ConvertL() finishes
void CImageLoader::MiuoConvertComplete(TInt aError)
{
   if( aError != KErrNone )
   {
       iErrorCode = aError;
       //Cancel();
       return;
   }

   CActiveScheduler::Stop();
   //Cancel();
   iConverter->Close();

}

//Uncalled
void CImageLoader::MiuoCreateComplete(TInt /*aError*/)
{
}

//bitmap scaler
CFbsBitmap* CImageLoader::ScaleDown(TInt newWidth, TInt newHeight)
{
TInt KNewImageWidth = newWidth;
TInt KNewImageHeight = newHeight;
iScaler = CMdaBitmapScaler::NewL();

TRAPD(err,iScaler->ScaleL(*this,*iBitmap,TSize(KNewImageWidth,KNewImageHeight)));
CActiveScheduler::Start();

if (err == KErrNone)
{
iConvertState = EConvertStateScaling;
}

return iBitmap;
}

How do you think I can use this to put a picture into a RichTextEditor? I really,really,really,really,really need your help. Even a hint will do.

Thanks guys!

Thu, 2005-12-08 13:41
Joined: 2003-12-05
Forum posts: 672
Re: *** CAN YOU TAKE A LOOK AT THIS ***
Hint:

http://developer.sonyericsson.com/site/global/techsupport/tipstrickscode/symbian/p_working_rich_text.jsp

By the way, your topic title almost made me vomit, just barely could read your question but you were lucky today....
  • Login to reply to this topic.