sl@0: // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #ifndef ENHANCEFUNCTIONALITY_H sl@0: #define ENHANCEFUNCTIONALITY_H sl@0: sl@0: #include sl@0: #include sl@0: sl@0: #include "ECamUnitTestPlugin.h" sl@0: #include sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: sl@0: sl@0: class CCamUnitTestPlugin; sl@0: sl@0: class CCamHistogram : public CBase, public MCameraHistogram sl@0: { sl@0: class CHistogram; sl@0: public: sl@0: static CCamHistogram* NewL(CCamUnitTestPlugin& aOwner); sl@0: ~CCamHistogram(); sl@0: TUint32 SupportedHistograms(); sl@0: TUint PrepareHistogramL(CCamera::CCameraHistogram::THistogramType aType); sl@0: TUint PrepareDSAHistogramL(CCamera::CCameraHistogram::THistogramType aType, const TPoint& aPosition, const TSize& aSize, const TRgb& aColor); sl@0: void StartHistogramL(TUint aHistHandle); sl@0: void StopHistogramL(TUint aHistHandle); sl@0: void DestroyHistogramL(TUint aHistHandle); sl@0: void Release(); sl@0: void GetActiveHistogramsL(RArray& aActiveHistograms); sl@0: void UpdateDSAHistogramPropertiesL(TUint aHistHandle, const TPoint& aPosition, const TSize& aSize, const TRgb& aColor); sl@0: void GetDSAHistogramPropertiesL(TUint aHistHandle, TPoint& aPosition, TSize& aSize, TRgb& aColor); sl@0: MHistogramBuffer& HistogramDataL(); sl@0: MHistogramBuffer& HistogramDataL(TUint aHistHandle); sl@0: sl@0: void ConstructL(); sl@0: sl@0: private: sl@0: CCamHistogram(CCamUnitTestPlugin& aOwner); sl@0: sl@0: sl@0: private: sl@0: CCamUnitTestPlugin& iOwner; sl@0: sl@0: TBool iHistActive; sl@0: TBool iDSAHistActive; sl@0: sl@0: TInt iHistogramCount; sl@0: CArrayFixFlat* iHistograms; sl@0: sl@0: HBufC* iHistData; sl@0: }; sl@0: sl@0: sl@0: class CCamHistogram::CHistogram : public CBase sl@0: { sl@0: public: sl@0: static CHistogram* NewL(TBool aDSA, CCamera::CCameraHistogram::THistogramType aType, TPoint aPosition, TSize aSize, TRgb iColor); sl@0: sl@0: public: sl@0: CHistogram(TBool aDSA, CCamera::CCameraHistogram::THistogramType aType, TPoint aPosition, TSize aSize, TRgb iColor); sl@0: ~CHistogram (); sl@0: sl@0: TBool IsActive(); sl@0: sl@0: public: sl@0: TBool iDSA; sl@0: CCamera::CCameraHistogram::THistogramType iType; sl@0: TInt iAlpha; sl@0: TPoint iPosition; sl@0: TSize iSize; sl@0: TRgb iColor; sl@0: sl@0: TBool iActive; // ETrue is StartHistogramL has been called sl@0: sl@0: }; sl@0: sl@0: // For Snapshot sl@0: class CCamSnapshot : public CBase, public MCameraSnapshot sl@0: { sl@0: public: sl@0: static CCamSnapshot* NewL(CCamUnitTestPlugin& aOwner); sl@0: ~CCamSnapshot(); sl@0: sl@0: TUint32 SupportedFormats(); sl@0: void PrepareSnapshotL(CCamera::TFormat aFormat, const TPoint& aPosition, const TSize& aSize, const TRgb& aBgColor, TBool aMaintainAspectRatio); sl@0: void PrepareSnapshotL(CCamera::TFormat aFormat, const TSize& aSize, TBool aMaintainAspectRatio); sl@0: sl@0: void SetBgColorL(const TRgb& aBgColor); sl@0: void SetPositionL(const TPoint& aPosition); sl@0: sl@0: TBool IsSnapshotActive() const; sl@0: void StartSnapshot(); sl@0: void StopSnapshot(); sl@0: MCameraBuffer& SnapshotDataL(RArray& aFrameIndexOrder); sl@0: void Release(); sl@0: sl@0: private: sl@0: CCamSnapshot(CCamUnitTestPlugin& aOwner); sl@0: sl@0: private: sl@0: CCamUnitTestPlugin& iOwner; sl@0: sl@0: CCamera::TFormat iFormat; sl@0: TSize iSize; sl@0: TRgb iBgColor; sl@0: TBool iAspRatio; sl@0: TPoint iPos; sl@0: TBool iActive; // ETrue is StartHistogramL has been called sl@0: }; sl@0: sl@0: sl@0: //For Overlay sl@0: class CCamOverlay : public CBase, public MCameraOverlay, public MCameraOverlay2 sl@0: { sl@0: class COverlay; sl@0: public: sl@0: static CCamOverlay* NewL(CCamUnitTestPlugin& aOwner); sl@0: ~CCamOverlay(); sl@0: sl@0: void ConstructL(); sl@0: sl@0: //from MCameraOverlay sl@0: TUint CreateOverlayL(const CCamera::CCameraOverlay::TOverlayParameters& aParameters, CFbsBitmap* aBitmap); sl@0: void SetOverlayBitmapL(TUint aOverlayHandleRef, const CFbsBitmap* aBitmap); sl@0: void GetOverlayBitmapL(TUint aOverlayHandleRef, CFbsBitmap* aBitmap); sl@0: void GetOverlayParametersL(TUint aOverlayHandle, CCamera::CCameraOverlay::TOverlayParameters& aInfo); sl@0: void SetOverlayParametersL(TUint aOverlayHandle, const CCamera::CCameraOverlay::TOverlayParameters& aParameters); sl@0: void ReleaseOverlay(TUint aOverlayHandleRef); sl@0: void Release(); sl@0: void GetOverlaySupport(CCamera::CCameraOverlay::TOverlaySupportInfo& aInfo); sl@0: void GetAllOverlaysInZOrderL(RArray& aOverlayHandles); sl@0: void SetAllOverlaysInZOrderL(const RArray& aOverlayHandles); sl@0: sl@0: //from MCameraOverlay2 sl@0: void SetModifiableOverlayBitmapL(TUint aOverlayHandle, CFbsBitmap* aBitmap); sl@0: void GetAllOverlaysInZOrderL(CCamera::CCameraOverlay::TOverlayCameraMode aOverlayCameraMode, TInt aViewFinderHandle, RArray& aOverlayHandles) const; sl@0: void SetAllOverlaysInZOrderL(CCamera::CCameraOverlay::TOverlayCameraMode aOverlayCameraMode, TInt aViewFinderHandle, const RArray& aOverlayHandles); sl@0: sl@0: private: sl@0: CCamOverlay(CCamUnitTestPlugin& aOwner); sl@0: sl@0: public: sl@0: TInt iRefCount; sl@0: sl@0: private: sl@0: CCamUnitTestPlugin& iOwner; sl@0: CArrayFixFlat* iOverlays; sl@0: sl@0: CCamera::CCameraOverlay::TOverlaySupportInfo iSupportInfo; sl@0: }; sl@0: sl@0: class CCamOverlay::COverlay : public CBase sl@0: { sl@0: public: sl@0: static COverlay* NewL(const CCamera::CCameraOverlay::TOverlayParameters& aParameters, CFbsBitmap* aBitmap); sl@0: sl@0: public: sl@0: ~COverlay (); sl@0: void ConstructL(); sl@0: sl@0: private: sl@0: COverlay(const CCamera::CCameraOverlay::TOverlayParameters& aParameters, CFbsBitmap* aBitmap); sl@0: sl@0: public: sl@0: CCamera::CCameraOverlay::TOverlayParameters iOverlayParms; sl@0: CFbsBitmap* iBitmap; // doesn't own sl@0: TUint iZOrderReverse; //for sorting on z-order sl@0: }; sl@0: sl@0: sl@0: class RCamSnapshotBuffer : public MCameraBuffer sl@0: { sl@0: public: sl@0: RCamSnapshotBuffer(CFbsBitmap*& aFrame): iAvailable(ETrue), iFrame(aFrame) {} sl@0: virtual TInt NumFrames() {return 0;} sl@0: virtual TDesC8* DataL(TInt aFrameIndex) {if (aFrameIndex != 0) { User::Leave(KErrArgument); } return NULL; } sl@0: virtual CFbsBitmap& BitmapL(TInt aFrameIndex) {if (aFrameIndex != 0) { User::Leave(KErrArgument); } return *iFrame;} sl@0: virtual RChunk& ChunkL() { return iChunk;} sl@0: virtual TInt ChunkOffsetL(TInt aFrameIndex) {if (aFrameIndex != 0) { User::Leave(KErrArgument); } return 0;} sl@0: virtual TInt FrameSize(TInt aFrameIndex) {if (aFrameIndex != 0) { User::Leave(KErrArgument); } return 0; } sl@0: virtual void Release() {iAvailable = ETrue;} sl@0: sl@0: public: sl@0: TBool iAvailable; sl@0: CFbsBitmap*& iFrame; sl@0: RChunk iChunk; sl@0: }; sl@0: sl@0: #endif // ENHANCEFUNCTIONALITY_H