All About Symbian - Nokia (S60) and Sony Ericsson (UIQ) smartphones unwrapped

  #1  
Old 17-12-2007, 08:58 AM
romcab romcab is offline
Registered User
 
Join Date: Dec 2007
Posts: 2
romcab is on a distinguished road
Bitmap Loading Problem

Hi guys,
I'm new in symbian c++ and I'm currently trying to load bitmap image. I was able to run my application but an error occured. 1) System error and MyImage
Alloc:3124cd680. Pls see my code below to find out what is wrong with my code.
thanks guys.

ImageLoader.h
#ifndef IMAGELOADER_H_
#define IMAGELOADER_H_

#include <e32base.h>
#include <coecntrl.h>
#include <w32std.h>
#include <e32std.h>
#include <cntdef.h>
#include <cntdb.h>
#include <fbs.h>

//FORWARD DECLARATIONS
class CFbsBitmap;

class ImageLoader : public CCoeControl
{
public:
ImageLoader();
virtual ~ImageLoader();
void LoadImage(const TDesC& aFileName);
void MyDraw(const TRect& /*aRect*/) const;


private:
CFbsBitmap* iBitmap;

};

#endif /*IMAGELOADER_H_*/

ImageLoader.cpp
#include "ImageLoader.h"

ImageLoader::ImageLoader()
{
}

ImageLoader::~ImageLoader()
{
delete iBitmap;
}

void ImageLoader::LoadImage(TDesC16 const& aFileName)
{
iBitmap = new (ELeave) CFbsBitmap;
CleanupStack::PushL(iBitmap);
User::LeaveIfError(iBitmap->Load(aFileName, 1) );
CleanupStack::Pop(iBitmap);
}

void ImageLoader::MyDraw(const TRect& /*aRect*/) const
{
// Get the standard graphics context
CWindowGc& gc = SystemGc();

// Gets the control's extent
TRect drawRect( Rect());

// Clears the screen
gc.Clear( drawRect );

if(iBitmap)
{
gc.DrawBitmap(Rect(), iBitmap);
}
}

MyImageAppView.cpp
void CMyImageAppView::ConstructL( const TRect& aRect )
{
// Create a window for this application view
CreateWindowL();

// Set the windows size
SetRect( aRect );

//Added #start
ImageLoader* loader = new (ELeave) ImageLoader;
loader->LoadImage(KBitmapName);
loader->MyDraw(aRect);
//Added #end

// Activate the window, which makes it ready to be drawn
ActivateL();
}
Ads
 

Bookmarks

Tags
bitmap, loading, problem

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
One hell of a problem jkeysers Nokia N80 13 20-10-2006 09:12 AM
N-Gage QD problem m0uth Nokia N-Gage and N-Gage QD 5 07-06-2005 09:25 PM
Realplayer 'loading..' problem on 9300 abo_moaaz Nokia 9300 and 9500 6 09-05-2005 10:12 AM
Problem in Loading Audio driver pinky_sharma UIQ Multimedia 1 09-12-2004 08:14 AM



All times are GMT. The time now is 03:40 PM.


vBulletin skins developed by: eXtremepixels
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright Notes || Contact Us || Privacy Policy