3
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 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: Juha Kauppinen, Mika Hokkanen
|
|
13 |
*
|
|
14 |
* Description: Photo Browser
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef __IEEDITOR_H__
|
|
19 |
#define __IEEDITOR_H__
|
|
20 |
|
|
21 |
// Include files
|
|
22 |
#include <e32base.h>
|
|
23 |
#include <f32file.h>
|
|
24 |
#include <FBS.H>
|
|
25 |
#include <ImageConversion.h>
|
|
26 |
#include <IclExtJpegApi.h>
|
|
27 |
#include <IEImage.h>
|
|
28 |
|
|
29 |
#include <IDLImageProcessing.h>
|
|
30 |
|
|
31 |
#include "IEImageDecoder.h"
|
|
32 |
#include "IEImageEncoder.h"
|
|
33 |
#include "ImagicConsts.h"
|
|
34 |
|
|
35 |
#define _FACEBROWSING
|
|
36 |
|
|
37 |
// Forward class declaration
|
|
38 |
class CIEImageDecoder;
|
|
39 |
class CIEImageEncoder;
|
|
40 |
|
|
41 |
class TEditedImage
|
|
42 |
{
|
|
43 |
public:
|
|
44 |
TIEFeature iEditedFeature;
|
|
45 |
TInt iEditedValue;
|
|
46 |
TIEColorParams iColorValue;
|
|
47 |
HBufC8* iEditedYuvData;
|
|
48 |
};
|
|
49 |
|
|
50 |
class MIEObserver
|
|
51 |
{
|
|
52 |
public:
|
|
53 |
virtual void WizardImagesLoadedL(TInt aError) = 0;
|
|
54 |
virtual void FeatureCompleteL(TIEFeature aFeature, TInt aError) = 0;
|
|
55 |
virtual void FeatureErrorL(TIEFeature aFeature, TInt aError) = 0;
|
|
56 |
virtual void ImageSavedL(TInt aError, TReal aAspectRatio) = 0;
|
|
57 |
};
|
|
58 |
|
|
59 |
// Class declaration
|
|
60 |
class CIEEditor : public CBase,
|
|
61 |
public MDecodingObserver,
|
|
62 |
public MEncodingObserver,
|
|
63 |
public MIDLObserver
|
|
64 |
{
|
|
65 |
public:
|
|
66 |
static CIEEditor* NewL(RFs& aFileServer, MIEObserver& aObserver);
|
|
67 |
~CIEEditor();
|
|
68 |
|
|
69 |
private:
|
|
70 |
void ConstructL();
|
|
71 |
CIEEditor(RFs& aFileServer, MIEObserver& aObsaerver);
|
|
72 |
|
|
73 |
public: // From MDecodingObserver
|
|
74 |
void YuvImageReadyL(TInt aError);
|
|
75 |
void BitmapReadyL(TInt aError);
|
|
76 |
|
|
77 |
public: // From MEncodingObserver
|
|
78 |
void JpegImageReadyL(TInt aError);
|
|
79 |
|
|
80 |
TSize GetRotateImageSize();
|
|
81 |
TInt GetRotationAngle();
|
|
82 |
|
|
83 |
public: // From MIDLObserver
|
|
84 |
inline void ProcessingComplete(TDesC8& /*aData*/){};
|
|
85 |
inline void HandleError(TInt /*aError*/){};
|
|
86 |
|
|
87 |
public:
|
|
88 |
void EditImageL(TIEImage* aImage, const TIEFeature aFeature, const TInt aValue);
|
|
89 |
void EditImageWizardL(const TIEFeature aFeature, RArray<CFbsBitmap*>& aBitmapArray, const TInt aIndex = 0);
|
|
90 |
void EditBrightnessL(CFbsBitmap& aBitmap, const TInt aValue);
|
|
91 |
void EditContrastL(CFbsBitmap& aBitmap, const TInt aValue);
|
|
92 |
void EditColorL(CFbsBitmap& aBitmap,
|
|
93 |
const TInt aRedValue,
|
|
94 |
const TInt aGreenValue,
|
|
95 |
const TInt aBlueValue);
|
|
96 |
void EditGammaL(CFbsBitmap& aBitmap, const TInt aValue);
|
|
97 |
void EditEdgeEnhancementL(CFbsBitmap& aBitmap, const TInt aValue);
|
|
98 |
void RotateImageL(CFbsBitmap& aBitmap, const TRotationAngle aRotationAngle);
|
|
99 |
void CropImageL(CFbsBitmap& aBitmap, const TRect aRect);
|
|
100 |
void EditLocalColorCorrectionL(CFbsBitmap& aBitmap, const TInt aValue);
|
|
101 |
void SetImageAndModeL(const TDesC& aImageName, const TIEEditingMode aEditingMode);
|
|
102 |
void CompleteWizardEditL(const TInt aIndex);
|
|
103 |
void SaveEditedImageL(const TDesC& aSrcFileName, const TDesC& aTargetFileName);
|
|
104 |
void CleanYuvDataArray();
|
|
105 |
void DeleteInputYUVBuffer();
|
|
106 |
void CleanBitmapArray();
|
|
107 |
|
|
108 |
|
|
109 |
void DetectFaceL(const TDesC &aFileName);
|
|
110 |
void DetectFaceL();
|
|
111 |
void FaceDetectSetupL(const TIEFeature aFeature, const TIDLFeatures aIDLFeature);
|
|
112 |
void NoOfFacesDetected(TInt &aNoOfFaces);
|
|
113 |
|
|
114 |
void NoOfFacesDetected(TInt &aNoOfFaces, RArray<TRect> &aFaceCoordinates);
|
|
115 |
|
|
116 |
|
|
117 |
private:
|
|
118 |
void PrepareOutputBuffersL(TInt aBuffers, TInt aSize);
|
|
119 |
void CreateBitmapsL(TInt aBitmaps, TSize aSize);
|
|
120 |
|
|
121 |
void SetupL(CFbsBitmap& aBitmap,
|
|
122 |
const TIEFeature aFeature,
|
|
123 |
const TIDLFeatures aIDLFeature,
|
|
124 |
const TAny* aValue);
|
|
125 |
|
|
126 |
//void InitializeFeatureL();
|
|
127 |
void InitializeFeatureL(const TSize aInSize, const TSize aOutsize);
|
|
128 |
void ProcessImageL(TDesC8& aInputData, TDesC8& aOutputData);
|
|
129 |
|
|
130 |
void EditFeatureL(TIEFeature aFeature);
|
|
131 |
void EditBrightnessL();
|
|
132 |
void EditContrastL();
|
|
133 |
void EditColorL();
|
|
134 |
void EditSharpnessL();
|
|
135 |
void EditGammaL();
|
|
136 |
void RotateImageL();
|
|
137 |
void CropImageL();
|
|
138 |
void EditLocalColorCorrectionL();
|
|
139 |
|
|
140 |
void SaveImageL();
|
|
141 |
|
|
142 |
void SaveDataToFileL(const TDesC& aFileName, TDesC8& aData);
|
|
143 |
void GenerateFileName(TDes& aFileName, TDesC& aFeature, TInt aSuffix, TBool aIsYuv);
|
|
144 |
|
|
145 |
void SetImageParams(const TIEFeature aFeature, const TAny* aFeatureValue);
|
|
146 |
|
|
147 |
private: // Data
|
|
148 |
RFs& iFileServer;
|
|
149 |
MIEObserver& iObserver;
|
|
150 |
|
|
151 |
CIEImageDecoder* iImageDecoder;
|
|
152 |
CIEImageEncoder* iImageEncoder;
|
|
153 |
|
|
154 |
RArray<TEditedImage> iYuvDataArray;
|
|
155 |
RArray<CFbsBitmap*>* iBitmapArrayPtr;
|
|
156 |
RArray<CFbsBitmap*> iBitmapArray;
|
|
157 |
|
|
158 |
HBufC8* iInBufferYuv;
|
|
159 |
HBufC8* iOutBufferYuv;
|
|
160 |
HBufC8* iJpegBuffer;
|
|
161 |
|
|
162 |
CFbsBitmap* iBitmap;
|
|
163 |
|
|
164 |
CIDLImageProcessing* iIDLImageProcessor;
|
|
165 |
|
|
166 |
TSize iSize;
|
|
167 |
TSize iFinalImageSize;
|
|
168 |
TSize iRotatedSize;
|
|
169 |
TSize iCroppedSize;
|
|
170 |
|
|
171 |
TInt iBitmapArrayIndex;
|
|
172 |
TInt iYuvDataArrayIndex;
|
|
173 |
TInt iOrgImagePos;
|
|
174 |
|
|
175 |
TUint8* iBufU;
|
|
176 |
|
|
177 |
TIEImage iCurrentImage;
|
|
178 |
TIEFeature iCurrentFeature;
|
|
179 |
TIDLFeatures iCurrentIDLFeature;
|
|
180 |
TInt iFeatureValue;
|
|
181 |
TIEEditingMode iEditingMode;
|
|
182 |
|
|
183 |
TRotationAngle iRotationAngle;
|
|
184 |
TInt iAngle;
|
|
185 |
TInt iNumberOfRotation;
|
|
186 |
|
|
187 |
TRect iCropRect;
|
|
188 |
|
|
189 |
TBool iImageEdited;
|
|
190 |
TBool iEditComplete;
|
|
191 |
|
|
192 |
TInt iBufferSize;
|
|
193 |
float iAspectRatio;
|
|
194 |
|
|
195 |
TFileName iFileName;
|
|
196 |
|
|
197 |
#ifdef __SAVE_INTERMEDIATE_FILES__
|
|
198 |
TInt iCount;
|
|
199 |
#endif
|
|
200 |
|
|
201 |
};
|
|
202 |
|
|
203 |
#endif //__IEEDITOR_H__
|