Can we directly load .bmp files using DrawBitmap

Login to reply to this topic.
Tue, 2006-03-07 15:48
Joined: 2006-03-03
Forum posts: 9
Can we directly load .bmp files using DrawBitmap in the Draw() method of Container Class

Wed, 2006-03-08 08:36
Joined: 2006-03-07
Forum posts: 15
Re: Can we directly load .bmp files using DrawBitmap
Hi
I suppose you could not directly use the bitmap path to load it from Draw() but you need to use the mbm file which will be created if you add the following code  in the mmp file:

START BITMAP Bitmap.mbm
HEADER
SOURCEPATH ..\Bitmapsfoldername //this folder should exist in the
//project  folder and the following bitmap files inside it
SOURCE C12 Bitmapfilename1.bmp
SOURCE C12 Bitmapfilename2.bmp
END
then the following in the hrh file
enum BitmapViewNumber
   {
   EBitmapDrawViewId1 = 1,
   EBitmapDrawViewId2,
   };
now in the ConstructL define the objects of CFbsBitmap

CFbsBitmap* iBitmap = new (ELeave) CFbsBitmap();
_LIT(KDrawBitmapPath, "\\system\\apps\\Bitmap\\Bitmap.mbm");
TFileName bitmapFile (KDrawBitmapPath);
User::LeaveIfError (CompleteWithAppPath (bitmapFile));
User::LeaveIfError(iBitmap->Load(bitmapFile, EMbmBitmapfilename1));

Then in the Draw()
CWindowGc& gc = SystemGc();
gc.Clear(aRect);
gc.DrawBitmap(TRect(TPoint(0,0), TSize(100,100)), iBitmap);   
This is would draw the bitmap on your screen
I think that would help you
Raja
   

Raja

Sat, 2006-03-11 16:42
Joined: 2004-11-29
Forum posts: 1233
Re: Can we directly load .bmp files using DrawBitmap
loading the bitmap in the draw function would also be a very bad thing to do.

It would make your program very slow...

heavy operations like moving big chunks of memory (as you do when you load a bitmap) should be done once and then reused.

draw is potentially called very often
Mon, 2006-03-13 10:05
Joined: 2006-03-03
Forum posts: 9
Can we directly load .bmp files using DrawBitmap
Hello all ,
I was able  to draw bitmaps from MBM files, Can v able to get images as such. other than gray-scale images.

Waiting for ur replies & answers

with regards
Wed, 2006-03-15 05:58
Joined: 2006-03-07
Forum posts: 15
Re: Can we directly load .bmp files using DrawBitmap
hi
why only gray scale??
You can also do it with colour images i guess
edit the bitmap file in paint and draw color image and try with it
this is the actual method to do with
bye

Raja

Wed, 2006-04-05 13:04
Joined: 2006-03-01
Forum posts: 11
Re: Can we directly load .bmp files using DrawBitmap
I cud see the  bitmap, only  when i changed the code from

User::LeaveIfError(iBitmap->Load(bitmapFile, EMbmBitmapfilename1));

           To

User::LeaveIfError(iBitmap->Load(bitmapFile, 0 ));

 Smiley
  • Login to reply to this topic.