Esempio n. 1
0
void CWinSystemWin32DX::OnResize(int width, int height)
{
  if (!m_IsAlteringWindow)
    ReleaseBackBuffer();

  m_deviceResources->SetLogicalSize(width, height);

  if (!m_IsAlteringWindow)
    CreateBackBuffer();
}
CZXingBarcodeReaderAppView::~CZXingBarcodeReaderAppView ()
	{
	if (iCameraWrapper)
		{
	iCameraWrapper->ReleaseAndPowerOff();
		}
	delete iCameraWrapper;
	delete iData;

	ReleaseBackBuffer();
	}
void CZXingBarcodeReaderAppView::SizeChanged()
	{
	// Create camera wrapper class here because
	// whole camera wrapper and all handles have to reset
	// while orientatio of the application changes.
	if (iCameraWrapper)
		{
	// Power off camera if it is on
	iCameraWrapper->StopViewFinder();
	iCameraWrapper->ReleaseAndPowerOff();
	delete iCameraWrapper; iCameraWrapper = NULL;
		}
	TInt camErr(KErrNotSupported);
	if(CCameraEngine::CamerasAvailable() > 0)
		{
	TRAP(camErr, iCameraWrapper = CCameraEngine::NewL(0,0,this));
		}

	// iViewFinderSize is picture size for viewfinder.
	// iCaptureSize is picture size for capturing picture.
	// We want fill whole screen
	if (Rect().Size().iWidth > Rect().Size().iHeight)
		{
	iViewFinderSize = TSize(Rect().Size().iWidth,Rect().Size().iWidth);
	iCaptureSize = TSize(1280,960); // Captured picture size
		}
	else
		{
	iViewFinderSize = TSize(Rect().Size().iHeight,Rect().Size().iHeight);
	iCaptureSize = TSize(1280,960); // Captured picture size
		}

	// Focus rectangle
	iFocusRect = Rect();
	iFocusRect.Shrink(Rect().Size().iWidth/4, Rect().Size().iHeight/4);

	// Create back buffer where recieved camera pictures are copied
	ReleaseBackBuffer();
	CreateBackBufferL();

	// Power on camera, start viewfinder when MceoCameraReady() received
	if(camErr == KErrNone)
		{
	iCameraWrapper->ReserveAndPowerOn();    
	SetTitle(_L("Camera power on"));
		}
	else
		{
	SetTitle(_L("no camera found"));
		}
	}