Drawing view finder frames problem
Login to reply to this topic.
Mon, 2007-03-19 08:59
Joined: 2005-07-28
Forum posts: 14
Hi,

I am trying to devellop a console based  camera application. This application is meant for the environment where there is no windowserver service. I am facing a problem of showing the viewfinder frames onto the screen. Below is the way i try to construct a offscreen bit map and then blit it onto the screen. But nothing shows up.

void CMyCamera::ViewFinderFrameReady(CFbsBitmap& aFrame)
{
   .......
   CFbsBitmap* fbsBitmap = new (ELeave) CFbsBitmap();
   CleanupStack::PushL(fbsBitmap);
   TInt err = fbsBitmap->Create(TSize(100, 100), EColor256);
   RDebug::Print(_L("fbsBitmap->Create Error = %d"), err);
   if(err != KErrNone) User::Leave(err);
   CFbsBitGc* bitmapGc = NULL;
   CFbsBitmapDevice* bitmapDev;
   TRAP(err, bitmapDev = CFbsBitmapDevice::NewL(fbsBitmap));
   RDebug::Print(_L("CFbsBitmapDevice::NewL Error = %d"), err);
   if(err != KErrNone) User::Leave(err);
   
   CleanupStack::PushL(bitmapDev);

   bitmapDev->CreateContext(bitmapGc);
   CleanupStack::PushL(bitmapGc);
   bitmapGc->SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha );
   bitmapGc->DrawBitmap(TRect(0, 0, iVfSize.iWidth, iVfSize.iHeight), &aFrame);
   bitmapGc->BitBlt(TPoint(0,20), fbsBitmap);

.......

}

I get the call back from Camera (ViewFinderFrameReady). But nothing is shown in the screen.

As there is not Window server, I cant use CWindowGc& gc = SystemGc(); to get system gc. Instead I am restricted to use CFbsBitGc or CGraphicsContext.

Please help!!!

Brs,
OJ

Wed, 2007-03-21 19:01
Joined: 2004-05-23
Forum posts: 115
I think you are drawing to memory, not to the screen. I don't think you can draw to screen without CWindowGc or DSA. And  to Flush() in the end is always a good idea.

Thu, 2007-03-22 10:31
Joined: 2005-07-28
Forum posts: 14
Hi,

I found out the problem. I was actually drawing it to the memory and the correct implementaation is using CFbsScreenDevice instead of CFbsBitmapDevice.

It works now!!

But, I was wondering how to improve the view finder frame rate. Currently its quite slow. Though the callback from CameraAPI is almost 15fps but the display is not more than 5-7fps.

Anybody has any idea if CFbsBitGc::Bitblt can draw that fast? I understood that its a synchronous call and also time consuming. Is there anyway to implement the same with better view finder frame rate?

Please help!!

Brs,
OJ
Thu, 2007-03-22 17:17
Joined: 2004-05-23
Forum posts: 115
It shouldn't run at 7-8. On the Nokia 6600 it's running 14 fps with some postprocessing. On the newest phones it should be even faster. What phone are you using ?


copyright 2003-2009 NewLC SARL