os/mm/imagingandcamerafws/cameraunittest/src/ECamUnitTestPlugin/EnhanceFunctionality.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
#ifndef ENHANCEFUNCTIONALITY_H
sl@0
    17
#define ENHANCEFUNCTIONALITY_H
sl@0
    18
sl@0
    19
#include <ecam/ecamplugin.h>
sl@0
    20
#include <ecam/ecaminfoplugin.h>
sl@0
    21
sl@0
    22
#include "ECamUnitTestPlugin.h"
sl@0
    23
#include <fbs.h>
sl@0
    24
sl@0
    25
#include <ecam/mcamerahistogram.h>
sl@0
    26
#include <ecam/mcameraoverlay.h>
sl@0
    27
#include <ecam/mcamerasnapshot.h>
sl@0
    28
sl@0
    29
sl@0
    30
sl@0
    31
class CCamUnitTestPlugin;
sl@0
    32
sl@0
    33
class CCamHistogram : public CBase, public MCameraHistogram
sl@0
    34
	{
sl@0
    35
	class CHistogram;	
sl@0
    36
public:	
sl@0
    37
	static CCamHistogram* NewL(CCamUnitTestPlugin& aOwner);
sl@0
    38
	~CCamHistogram();
sl@0
    39
	TUint32 SupportedHistograms();
sl@0
    40
    TUint PrepareHistogramL(CCamera::CCameraHistogram::THistogramType aType); 
sl@0
    41
    TUint PrepareDSAHistogramL(CCamera::CCameraHistogram::THistogramType aType, const TPoint& aPosition, const TSize& aSize, const TRgb& aColor); 
sl@0
    42
    void StartHistogramL(TUint aHistHandle);
sl@0
    43
    void StopHistogramL(TUint aHistHandle);
sl@0
    44
    void DestroyHistogramL(TUint aHistHandle);
sl@0
    45
	void Release();
sl@0
    46
    void GetActiveHistogramsL(RArray<TUint>& aActiveHistograms); 
sl@0
    47
	void UpdateDSAHistogramPropertiesL(TUint aHistHandle, const TPoint& aPosition, const TSize& aSize, const TRgb& aColor);
sl@0
    48
	void GetDSAHistogramPropertiesL(TUint aHistHandle, TPoint& aPosition, TSize& aSize, TRgb& aColor);
sl@0
    49
	MHistogramBuffer& HistogramDataL();
sl@0
    50
	MHistogramBuffer& HistogramDataL(TUint aHistHandle);
sl@0
    51
	
sl@0
    52
	void ConstructL();
sl@0
    53
	
sl@0
    54
private:
sl@0
    55
	CCamHistogram(CCamUnitTestPlugin& aOwner);
sl@0
    56
	
sl@0
    57
	
sl@0
    58
private:
sl@0
    59
	CCamUnitTestPlugin& iOwner;
sl@0
    60
	
sl@0
    61
	TBool iHistActive;
sl@0
    62
	TBool iDSAHistActive;
sl@0
    63
	
sl@0
    64
	TInt iHistogramCount;
sl@0
    65
	CArrayFixFlat<CHistogram*>* iHistograms;
sl@0
    66
	
sl@0
    67
	HBufC* iHistData;
sl@0
    68
	};
sl@0
    69
sl@0
    70
sl@0
    71
class CCamHistogram::CHistogram : public CBase
sl@0
    72
	{
sl@0
    73
public:	
sl@0
    74
	static CHistogram* NewL(TBool aDSA, CCamera::CCameraHistogram::THistogramType aType, TPoint aPosition, TSize aSize, TRgb iColor);
sl@0
    75
	
sl@0
    76
public:
sl@0
    77
	CHistogram(TBool aDSA, CCamera::CCameraHistogram::THistogramType aType, TPoint aPosition, TSize aSize, TRgb iColor);
sl@0
    78
	~CHistogram ();
sl@0
    79
	
sl@0
    80
	TBool IsActive();
sl@0
    81
	
sl@0
    82
public:
sl@0
    83
	TBool iDSA;
sl@0
    84
	CCamera::CCameraHistogram::THistogramType iType;
sl@0
    85
	TInt iAlpha;
sl@0
    86
	TPoint iPosition;
sl@0
    87
	TSize iSize;
sl@0
    88
	TRgb iColor;
sl@0
    89
sl@0
    90
	TBool iActive; // ETrue is StartHistogramL has been called
sl@0
    91
sl@0
    92
	};
sl@0
    93
sl@0
    94
// For Snapshot
sl@0
    95
class CCamSnapshot : public CBase, public MCameraSnapshot
sl@0
    96
	{
sl@0
    97
public:	
sl@0
    98
	static CCamSnapshot* NewL(CCamUnitTestPlugin& aOwner);
sl@0
    99
	~CCamSnapshot();
sl@0
   100
	
sl@0
   101
	TUint32 SupportedFormats();
sl@0
   102
    void PrepareSnapshotL(CCamera::TFormat aFormat, const TPoint& aPosition, const TSize& aSize, const TRgb& aBgColor, TBool aMaintainAspectRatio);
sl@0
   103
    void PrepareSnapshotL(CCamera::TFormat aFormat, const TSize& aSize, TBool aMaintainAspectRatio);
sl@0
   104
    
sl@0
   105
    void SetBgColorL(const TRgb& aBgColor); 
sl@0
   106
	void SetPositionL(const TPoint& aPosition);
sl@0
   107
	
sl@0
   108
    TBool IsSnapshotActive() const;
sl@0
   109
    void StartSnapshot();
sl@0
   110
	void StopSnapshot();
sl@0
   111
	MCameraBuffer& SnapshotDataL(RArray<TInt>& aFrameIndexOrder);
sl@0
   112
	void Release();
sl@0
   113
sl@0
   114
private:	
sl@0
   115
	CCamSnapshot(CCamUnitTestPlugin& aOwner);
sl@0
   116
sl@0
   117
private:
sl@0
   118
	CCamUnitTestPlugin& iOwner;
sl@0
   119
		
sl@0
   120
	CCamera::TFormat iFormat;
sl@0
   121
	TSize iSize;
sl@0
   122
	TRgb iBgColor;
sl@0
   123
	TBool iAspRatio;
sl@0
   124
	TPoint iPos;
sl@0
   125
	TBool iActive; // ETrue is StartHistogramL has been called
sl@0
   126
	};
sl@0
   127
sl@0
   128
sl@0
   129
//For Overlay
sl@0
   130
class CCamOverlay : public CBase, public MCameraOverlay, public MCameraOverlay2
sl@0
   131
	{
sl@0
   132
	class COverlay;
sl@0
   133
public:
sl@0
   134
	static CCamOverlay* NewL(CCamUnitTestPlugin& aOwner);
sl@0
   135
	~CCamOverlay();
sl@0
   136
	
sl@0
   137
	void ConstructL();
sl@0
   138
	
sl@0
   139
	//from MCameraOverlay
sl@0
   140
	TUint CreateOverlayL(const CCamera::CCameraOverlay::TOverlayParameters& aParameters, CFbsBitmap* aBitmap);
sl@0
   141
	void SetOverlayBitmapL(TUint aOverlayHandleRef, const CFbsBitmap* aBitmap);
sl@0
   142
    void GetOverlayBitmapL(TUint aOverlayHandleRef, CFbsBitmap* aBitmap);
sl@0
   143
    void GetOverlayParametersL(TUint aOverlayHandle, CCamera::CCameraOverlay::TOverlayParameters& aInfo);
sl@0
   144
	void SetOverlayParametersL(TUint aOverlayHandle, const CCamera::CCameraOverlay::TOverlayParameters& aParameters);
sl@0
   145
	void ReleaseOverlay(TUint aOverlayHandleRef);
sl@0
   146
	void Release();
sl@0
   147
	void GetOverlaySupport(CCamera::CCameraOverlay::TOverlaySupportInfo& aInfo);
sl@0
   148
    void GetAllOverlaysInZOrderL(RArray<TUint>& aOverlayHandles);
sl@0
   149
	void SetAllOverlaysInZOrderL(const RArray<TUint>& aOverlayHandles);
sl@0
   150
	
sl@0
   151
	//from MCameraOverlay2
sl@0
   152
	void SetModifiableOverlayBitmapL(TUint aOverlayHandle, CFbsBitmap* aBitmap);
sl@0
   153
	void GetAllOverlaysInZOrderL(CCamera::CCameraOverlay::TOverlayCameraMode aOverlayCameraMode, TInt aViewFinderHandle, RArray<TUint>& aOverlayHandles) const;
sl@0
   154
	void SetAllOverlaysInZOrderL(CCamera::CCameraOverlay::TOverlayCameraMode aOverlayCameraMode, TInt aViewFinderHandle, const RArray<TUint>& aOverlayHandles);
sl@0
   155
	
sl@0
   156
private:
sl@0
   157
	CCamOverlay(CCamUnitTestPlugin& aOwner);
sl@0
   158
sl@0
   159
public:
sl@0
   160
	TInt iRefCount;
sl@0
   161
sl@0
   162
private:
sl@0
   163
	CCamUnitTestPlugin& iOwner;
sl@0
   164
	CArrayFixFlat<COverlay*>* iOverlays;	
sl@0
   165
	
sl@0
   166
	CCamera::CCameraOverlay::TOverlaySupportInfo iSupportInfo;
sl@0
   167
	};
sl@0
   168
	
sl@0
   169
class CCamOverlay::COverlay : public CBase
sl@0
   170
	{
sl@0
   171
public:	
sl@0
   172
	static COverlay* NewL(const CCamera::CCameraOverlay::TOverlayParameters& aParameters, CFbsBitmap* aBitmap);
sl@0
   173
	
sl@0
   174
public:
sl@0
   175
	~COverlay ();
sl@0
   176
	void ConstructL();
sl@0
   177
sl@0
   178
private:
sl@0
   179
	COverlay(const CCamera::CCameraOverlay::TOverlayParameters& aParameters, CFbsBitmap* aBitmap);
sl@0
   180
		
sl@0
   181
public:
sl@0
   182
	CCamera::CCameraOverlay::TOverlayParameters iOverlayParms;
sl@0
   183
	CFbsBitmap* iBitmap; // doesn't own
sl@0
   184
	TUint iZOrderReverse; //for sorting on z-order
sl@0
   185
	};
sl@0
   186
	
sl@0
   187
	
sl@0
   188
class RCamSnapshotBuffer : public MCameraBuffer
sl@0
   189
	{
sl@0
   190
public:
sl@0
   191
	RCamSnapshotBuffer(CFbsBitmap*& aFrame): iAvailable(ETrue), iFrame(aFrame) {}
sl@0
   192
	virtual TInt NumFrames() {return 0;}
sl@0
   193
	virtual TDesC8* DataL(TInt aFrameIndex) {if (aFrameIndex != 0) { User::Leave(KErrArgument); } return NULL; }
sl@0
   194
	virtual CFbsBitmap& BitmapL(TInt aFrameIndex) {if (aFrameIndex != 0) { User::Leave(KErrArgument); } return *iFrame;}
sl@0
   195
 	virtual	RChunk& ChunkL() { return iChunk;}
sl@0
   196
	virtual TInt ChunkOffsetL(TInt aFrameIndex) {if (aFrameIndex != 0) { User::Leave(KErrArgument); } return 0;}
sl@0
   197
	virtual TInt FrameSize(TInt aFrameIndex) {if (aFrameIndex != 0) { User::Leave(KErrArgument); } return 0; }
sl@0
   198
	virtual void Release() {iAvailable = ETrue;}
sl@0
   199
	
sl@0
   200
public:	
sl@0
   201
	TBool iAvailable;
sl@0
   202
	CFbsBitmap*& iFrame;
sl@0
   203
	RChunk iChunk;
sl@0
   204
	};
sl@0
   205
sl@0
   206
#endif // ENHANCEFUNCTIONALITY_H