Displaying bitmap without using mbm file ! Please help me ! Thanks very much !
| Mon, 2006-02-13 11:45 | |
|
Hi all!
At the present, I have a problem : " Displaying bitmap without using mbm file " . I try to search and do it but I can't. Have you finished this problem ? If you can do that, please give me a way for doing it or send example for me to search thanghq@unisoft.jp ! Thanks very much ! This is my source but It didn't perform. The emulator will close immediately when program is opened . /************* CTopView.cpp *************************/ void CTopView::ConstructL( const TRect& aRect ) {   //-----  create window-owning control   CreateWindowL();   SetRect( aRect );   //-----  enable dragging   EnableDragEvents();   //-----  Create bitmap   CFbsBitmap * aBmp = new CFbsBitmap;   CleanupStack::PushL( aBmp );   TSize iSz( 134,38 );   aBmp->Create( iSz, EColor16M ); // 16bit   // Get address of bitmap   TUint8* pData = ( TUint8* )aBmp->DataAddress( );   // Open the file and read its data   _LIT( KBitmapFileName, "C:\\system\\data\\navigis\\map.bmp" );   // Open a RFs   RFs aFs;   User::LeaveIfError( aFs.Connect() );   CleanupClosePushL( aFs );   // Open the file   RFile file;   file.Open( aFs, KBitmapFileName, EFileRead );   CleanupClosePushL( file );   // Read from the file   TInt iSize;   file.Size( iSize );   HBufC8* buf = HBufC8::NewLC( iSize );   TPtr8 pBuf = buf->Des();   pBuf.Set( pData, iSize, iSize );   file.Read( pBuf );   //----  Views should be made invisible until ViewActivated has been called   MakeVisible( EFalse );   SetComponentsToInheritVisibility();   ActivateL(); } void CTopView::Draw(const TRect& aRect) const {    CWindowGc& gc = SystemGc();    //-----  Area in which we shall draw    TRect drawRect = Rect();    gc.Clear();    //-----  Draw an outline rectangle (the default pen    //-----    and brush styles ensure this) slightly    //-----    smaller than the drawing area.    drawRect.Shrink( 10,10 );    gc.DrawRect( drawRect );    //-----   Draw file bmp    gc.DrawBitmap( drawRect, aBmp ); } |
|






Forum posts: 121
You can load the image by supplying a file name, and the OS will convert it to a CFbsBitmap, which you can then use to draw on the screen.
I think the class your after might be CImageDecoder .
Good luck
Forum posts: 107
Forum posts: 15
best regards
Ronald
best regards,
Ronald Stevanus
Forum posts: 107
Forum posts: 15
best regards
Ronald
best regards,
Ronald Stevanus
Forum posts: 148
\UIQ_21\examples\MultiMedia\ImageConv