|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef PLUGINEXTENSIONMANAGER_H |
|
17 #define PLUGINEXTENSIONMANAGER_H |
|
18 |
|
19 #include <e32base.h> |
|
20 #include <icl/imageconversionextensionintf.h> |
|
21 #include <icl/imageprocessor.h> |
|
22 #include "pluginextensionmanager.h" |
|
23 |
|
24 /** |
|
25 @file |
|
26 @internalTechnology |
|
27 |
|
28 Overview: |
|
29 A set of internal classes to providing generic support for framework extension |
|
30 functionality. The CPluginExtensionManager contains the extensions (Operation |
|
31 and Scaler) and is owned by the concrete plugin. It also has access to the |
|
32 read codec via the MReadCodecExtension interface, which should be implemented |
|
33 by the concrete read codec. Thus, CPluginExtensionManager has access to the |
|
34 relevant classes in order to handle the call to GetDestinationSize(). |
|
35 */ |
|
36 |
|
37 class MReadCodecExtension; |
|
38 class COperationExtension; |
|
39 class CScalerExtension; |
|
40 class CImageProcessorExtension; |
|
41 |
|
42 /** |
|
43 Generic extension container for codec plugin use. |
|
44 */ |
|
45 NONSHARABLE_CLASS ( CPluginExtensionManager ) : public CBase |
|
46 { |
|
47 public: |
|
48 IMPORT_C static CPluginExtensionManager* NewL(MReadCodecExtension* aReadCodec); |
|
49 IMPORT_C ~CPluginExtensionManager(); |
|
50 IMPORT_C void ResetCodecExtension(MReadCodecExtension* aReadCodec); |
|
51 IMPORT_C static TInt ConvertScalingCoeffToReductionFactor(TInt aScalingCoeff); |
|
52 |
|
53 IMPORT_C void GetExtensionL(TUid aExtUid, MImageConvExtension*& aExtPtr); |
|
54 IMPORT_C void CreateExtensionForAutoRotateL(); |
|
55 IMPORT_C TInt GetDestinationSize(TSize& aOriginalSize); |
|
56 IMPORT_C void SetClippingRectL(const TRect* aClipRect, const RPointerArray<TFrameInfo>& aFrameInfo); |
|
57 |
|
58 IMPORT_C TBool ClippingRectExtensionRequested() const; |
|
59 IMPORT_C TBool ScalerExtensionRequested() const; |
|
60 IMPORT_C TBool OperationExtensionRequested() const; |
|
61 |
|
62 IMPORT_C TRect ClippingRect(); |
|
63 IMPORT_C TInt GetScalingCoefficient(TInt& aScalingCoeff, const TSize* aOriginalSize=NULL) const; |
|
64 IMPORT_C TInt GetScalerDesiredSize(TSize& aDesiredSize) const; |
|
65 IMPORT_C TInt GetScalerQuality(TImageConvScaler::TScalerQuality& aQuality) const; |
|
66 IMPORT_C TBool ScalerMaintainAspectRatio() const; |
|
67 IMPORT_C TTransformOptions Operation() const; |
|
68 IMPORT_C TTransformOptions OperationL(TUint16 aAutoRotationFlag) const; |
|
69 IMPORT_C TBool DimensionsSwapped() const; |
|
70 |
|
71 IMPORT_C TInt ValidateConvertData(TInt& aScalingCoeff, const TSize& aOriginalSize, TSize& aDestinationSize); |
|
72 IMPORT_C void TransferExtensionDataL(CImageProcessorExtension* aImageProcessor); |
|
73 |
|
74 private: |
|
75 CPluginExtensionManager(MReadCodecExtension* aReadCodec); |
|
76 |
|
77 private: |
|
78 COperationExtension* iOperationExtension; |
|
79 CScalerExtension* iScalerExtension; |
|
80 TRect iClippingRect; |
|
81 MReadCodecExtension* iReadCodec; |
|
82 }; |
|
83 |
|
84 /** |
|
85 Generic plugin codec operation extension |
|
86 */ |
|
87 NONSHARABLE_CLASS ( COperationExtension ) : public MImageConvOperation |
|
88 { |
|
89 friend class CPluginExtensionManager; |
|
90 |
|
91 public: |
|
92 static COperationExtension* NewL(); |
|
93 ~COperationExtension(); |
|
94 |
|
95 // From MImageConvOperation |
|
96 TUid Uid() const; |
|
97 void IncrementRef(); |
|
98 void Release(); |
|
99 TUint Capabilities() const; |
|
100 void AddOperationL(TImageConvOperation::TOperation aOperation); |
|
101 void ClearOperationStack(); |
|
102 |
|
103 private: |
|
104 void InsertOperationL(TImageConvOperation::TOperation aOperation, TInt aPos); |
|
105 COperationExtension(); |
|
106 TBool HasBeenSet(); |
|
107 TBool DimensionsSwapped() const; |
|
108 TTransformOptions Operation() const; |
|
109 |
|
110 private: |
|
111 TUint iRefCount; |
|
112 TUint iCapabilities; |
|
113 RArray<TImageConvOperation::TOperation> iOperationStack; |
|
114 }; |
|
115 |
|
116 /** |
|
117 Generic plugin codec scaler extension |
|
118 */ |
|
119 NONSHARABLE_CLASS ( CScalerExtension ) : public MImageConvScaler |
|
120 { |
|
121 friend class CPluginExtensionManager; |
|
122 |
|
123 public: |
|
124 enum TScalerCmd |
|
125 { |
|
126 EScalerExtFullSize, // = 0 |
|
127 EScalerExtUseScalingCoeff, |
|
128 EScalerExtUseDesiredSize |
|
129 }; |
|
130 |
|
131 public: |
|
132 static CScalerExtension* NewL(); |
|
133 ~CScalerExtension(); |
|
134 |
|
135 // From MImageConvScaler |
|
136 TUid Uid() const; |
|
137 void IncrementRef(); |
|
138 void Release(); |
|
139 void GetCapabilities(TScalerCaps& aCaps) const; |
|
140 void SetScalingL(const TSize& aDesiredSize, TImageConvScaler::TScalerQuality aQuality, TBool aLockAspectRatio); |
|
141 void SetScalingL(TInt aScalingCoeff, TImageConvScaler::TScalerQuality aScalingQuality); |
|
142 |
|
143 private: |
|
144 CScalerExtension(); |
|
145 TScalerCmd ScaleCmd() const; |
|
146 TInt GetScalingCoefficient(TInt& aScalingCoeff) const; |
|
147 TInt GetDesiredSize(TSize& aDesiredSize) const; |
|
148 TBool ScalingCoefficientSupported(TInt aScalingCoeff) const; |
|
149 TInt GetScalerQuality(TImageConvScaler::TScalerQuality& aQuality) const; |
|
150 TBool LockAspectRatioSet() const; |
|
151 |
|
152 private: |
|
153 TUint iRefCount; |
|
154 TScalerCmd iCommand; |
|
155 TScalerCaps iCapabilities; |
|
156 TInt iScalingCoefficient; |
|
157 TSize iDesiredSize; |
|
158 TImageConvScaler::TScalerQuality iQuality; |
|
159 TBool iLockAspectRatio; |
|
160 }; |
|
161 |
|
162 #endif // PLUGINEXTENSIONMANAGER_H |
|
163 |