54
|
1 |
/*
|
|
2 |
* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: CCamSnapshot class definition
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef CAM_SNAPSHOT_H
|
|
20 |
#define CAM_SNAPSHOT_H
|
|
21 |
|
|
22 |
#include <e32base.h>
|
|
23 |
#include <ecam.h>
|
|
24 |
#include "mcamcameraobserver.h" // MCamCameraObserver, MCamCameraObservable
|
|
25 |
#include "camimagedecoder.h" // MCamImageDecoderObserver
|
|
26 |
#include "cambitmapscaler.h" // MCamBitmapScalerObserver
|
|
27 |
|
|
28 |
|
|
29 |
class CCamBufferShare;
|
|
30 |
|
|
31 |
/**
|
|
32 |
* @class CCamSnapshot
|
|
33 |
*
|
|
34 |
*/
|
|
35 |
class CCamSnapshot : public CBase,
|
|
36 |
// public MCameraSnapshot,
|
|
37 |
public MCamCameraObserver,
|
|
38 |
public MCamImageDecoderObserver,
|
|
39 |
public MCamBitmapScalerObserver
|
|
40 |
{
|
|
41 |
// -------------------------------------------------------
|
|
42 |
// Constructors and destructor
|
|
43 |
public:
|
|
44 |
|
|
45 |
static CCamSnapshot* NewL( CCamera& aCamera,
|
|
46 |
MCameraObserver2& aObserver,
|
|
47 |
MCamCameraObservable& aObservable );
|
|
48 |
|
|
49 |
~CCamSnapshot();
|
|
50 |
|
|
51 |
// -------------------------------------------------------
|
|
52 |
// from MCameraSnapshot
|
|
53 |
public:
|
|
54 |
|
|
55 |
TUint32 SupportedFormats();
|
|
56 |
|
|
57 |
void PrepareSnapshotL( CCamera::TFormat aFormat, const TPoint& aPosition, const TSize& aSize, const TRgb& aBgColor, TBool aMaintainAspectRatio);
|
|
58 |
void PrepareSnapshotL( CCamera::TFormat aFormat, const TSize& aSize, TBool aMaintainAspectRatio );
|
|
59 |
|
|
60 |
void SetBgColorL( const TRgb& aBgColor );
|
|
61 |
void SetPositionL( const TPoint& aPosition );
|
|
62 |
|
|
63 |
TBool IsSnapshotActive() const;
|
|
64 |
void StartSnapshot();
|
|
65 |
void StopSnapshot();
|
|
66 |
|
|
67 |
MCameraBuffer& SnapshotDataL( RArray<TInt>& aFrameIndexOrder );
|
|
68 |
|
|
69 |
// -------------------------------------------------------
|
|
70 |
// From MCamCameraObserver
|
|
71 |
public:
|
|
72 |
|
|
73 |
/**
|
|
74 |
* @see MCamCameraObserver
|
|
75 |
*/
|
|
76 |
virtual void HandleCameraEventL( TInt aStatus,
|
|
77 |
TCamCameraEventId aEventId,
|
|
78 |
TAny* aEventData = NULL );
|
|
79 |
|
|
80 |
// -------------------------------------------------------
|
|
81 |
// from MCamImageDecoderObserver
|
|
82 |
public:
|
|
83 |
|
|
84 |
/**
|
|
85 |
* @see MCamImageDecoderObserver
|
|
86 |
*/
|
|
87 |
virtual void ImageDecodedL( TInt aStatus, const CFbsBitmap* aBitmap, const CFbsBitmap* aMask );
|
|
88 |
|
|
89 |
// -------------------------------------------------------
|
|
90 |
// from MCamBitmapScalerObserver
|
|
91 |
public:
|
|
92 |
|
|
93 |
/**
|
|
94 |
* @see MCamBitmapScalerObserver
|
|
95 |
*/
|
|
96 |
virtual void BitmapScaled( TInt aStatus, const CFbsBitmap* aBitmap );
|
|
97 |
|
|
98 |
// -------------------------------------------------------
|
|
99 |
// New methods
|
|
100 |
public:
|
|
101 |
|
|
102 |
void StartSnapshotProcessing( CCamBufferShare* aBuffer,
|
|
103 |
TInt aError );
|
|
104 |
|
|
105 |
static TInt SnapshotReadyCallback( TAny* aSelf );
|
|
106 |
|
|
107 |
private:
|
|
108 |
|
|
109 |
void DoStartSnapshotProcessingL( CCamBufferShare* aBuffer,
|
|
110 |
TInt aError );
|
|
111 |
|
|
112 |
TDisplayMode Format2DisplayMode( CCamera::TFormat aFormat ) const;
|
|
113 |
|
|
114 |
void SetImageData( CCamBufferShare* aImageData );
|
|
115 |
|
|
116 |
private:
|
|
117 |
|
|
118 |
void ConstructL();
|
|
119 |
CCamSnapshot( CCamera& aCamera,
|
|
120 |
MCameraObserver2& aObserver,
|
|
121 |
MCamCameraObservable& aObservable );
|
|
122 |
|
|
123 |
// =======================================================
|
|
124 |
// data
|
|
125 |
private:
|
|
126 |
|
|
127 |
MCameraObserver2& iObserver;
|
|
128 |
MCamCameraObservable& iObservable;
|
|
129 |
|
|
130 |
TInt iCameraHandle;
|
|
131 |
|
|
132 |
CCamImageDecoder* iDecoder;
|
|
133 |
CCamBitmapScaler* iScaler;
|
|
134 |
|
|
135 |
CCamBufferShare* iImageData;
|
|
136 |
CFbsBitmap* iSnapshotBitmap;
|
|
137 |
|
|
138 |
TBool iSnapshotOn;
|
|
139 |
TInt iStatus;
|
|
140 |
|
|
141 |
// Video snapshot is taken from VF frames.
|
|
142 |
// Flags to control the process.
|
|
143 |
TBool iUseNextVfFrame;
|
|
144 |
TBool iVideoMode;
|
|
145 |
|
|
146 |
CCamera::TFormat iFormat;
|
|
147 |
TPoint iPosition;
|
|
148 |
TSize iSize;
|
|
149 |
TRgb iBackgroundColor;
|
|
150 |
TBool iMaintainAspectRatio;
|
|
151 |
|
|
152 |
CIdle* iIdle;
|
|
153 |
|
|
154 |
// =======================================================
|
|
155 |
};
|
|
156 |
|
|
157 |
#endif
|
|
158 |
|
|
159 |
// end of file
|
|
160 |
|