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
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
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
Forum posts: 15
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
Forum posts: 1233
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
Forum posts: 9
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
Forum posts: 15
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
Forum posts: 11
User::LeaveIfError(iBitmap->Load(bitmapFile, EMbmBitmapfilename1));
To
User::LeaveIfError(iBitmap->Load(bitmapFile, 0 ));