|
1 /* |
|
2 * Copyright (c) 2004 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: Image Transforms subsystem. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef CVTIMAGESCALERIMPL_H |
|
22 #define CVTIMAGESCALERIMPL_H |
|
23 |
|
24 // INCLUDE FILES |
|
25 |
|
26 #include <e32base.h> |
|
27 #include <bitmaptransforms.h> |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 |
|
31 class CVtImage; |
|
32 |
|
33 // CLASS DECLARATIONS |
|
34 |
|
35 /** |
|
36 * Image scaler implementation. |
|
37 * |
|
38 * @lib videosource.lib |
|
39 */ |
|
40 class CVtImageScalerImpl : public CActive |
|
41 { |
|
42 protected: |
|
43 |
|
44 /** |
|
45 * Constructor. |
|
46 */ |
|
47 CVtImageScalerImpl(); |
|
48 |
|
49 public: |
|
50 |
|
51 /** |
|
52 * Destructor. |
|
53 */ |
|
54 ~CVtImageScalerImpl(); |
|
55 |
|
56 /** |
|
57 * Sets scaler params. |
|
58 * @param "aParams" Scaling params, including source and target images. |
|
59 * @exception In error situation leaves with one of the system wide |
|
60 * error codes. |
|
61 */ |
|
62 void SetSourceTargetL( const CVtImage& aSource, CVtImage& aTarget ); |
|
63 |
|
64 /** |
|
65 * Method to check whether bitmap heap locking is needed or not during |
|
66 * scaling process. |
|
67 * @exception In error situation leaves with one of the system wide |
|
68 * error codes. |
|
69 * @return ETrue if bitmap heap lock is needed, EFalse otherwise. |
|
70 */ |
|
71 TBool NeedHeapLock() const; |
|
72 |
|
73 /** |
|
74 * Pure virtual scaling method. |
|
75 * @param "aContinue" When method returns, this parameter will contain |
|
76 * ETrue if new call is needed (i.e. scaling is not yet finished) or |
|
77 * EFalse if scaling is complete. |
|
78 * @return KErrNone or one of the system wide error codes. |
|
79 */ |
|
80 virtual TInt Scale( TBool& aContinue ) = 0; |
|
81 |
|
82 protected: |
|
83 |
|
84 /** |
|
85 * Scales using CBitmapScaler, which is slow but works with any |
|
86 * Symbian color mode. |
|
87 * @param aQuality Scaling quality @see CBitmapScaler::TQualityAlgorithm |
|
88 * @exception In error situation leaves with one of the system wide |
|
89 * error codes. |
|
90 */ |
|
91 void ScaleWithBitmapScalerL( |
|
92 const CBitmapScaler::TQualityAlgorithm aQuality ); |
|
93 |
|
94 private: |
|
95 |
|
96 /** |
|
97 * Pure virtual source and target image validation method. |
|
98 * @param "aSource" Constant reference to source image. |
|
99 * @param "aTarget" Constant reference to target image. |
|
100 * @exception If source or target is not valid, this method leaves |
|
101 * with KErrNotSupported. |
|
102 */ |
|
103 virtual void ValidateSourceTargetL( |
|
104 const CVtImage& aSource, |
|
105 CVtImage& aTarget ) = 0; |
|
106 |
|
107 /** |
|
108 * Method for validating image size. |
|
109 * @param "aSize" Size to be validated. |
|
110 * @param "aMinSize" Minimum allowed size. If this is not given a default |
|
111 * size of TSize( 1, 1 ) is used. |
|
112 * @exception If size is not valid within given parameters, this |
|
113 * method leaves with KErrNotSupported. |
|
114 */ |
|
115 void LeaveIfNotValidSizeL( |
|
116 const TSize& aSize, |
|
117 const TSize aMinSize = TSize( 1, 1 ) ); |
|
118 |
|
119 private: // from CActive |
|
120 |
|
121 /** |
|
122 * @see CActive::RunL |
|
123 */ |
|
124 void RunL(); |
|
125 |
|
126 /** |
|
127 * @see CActive::DoCancel |
|
128 */ |
|
129 void DoCancel(); |
|
130 |
|
131 protected: |
|
132 |
|
133 // Source for scaling |
|
134 const CVtImage* iSource; // not owned |
|
135 |
|
136 // Target image (will hold scaled source) |
|
137 CVtImage* iTarget; // not owned |
|
138 |
|
139 // Bitmap scaler instance |
|
140 CBitmapScaler* iScaler; |
|
141 |
|
142 // Active scheduler waiter object |
|
143 CActiveSchedulerWait iActiveSchedulerWait; |
|
144 |
|
145 }; |
|
146 |
|
147 #endif // CVTIMAGESCALERIMPL_H |
|
148 |
|
149 // End of File |
|
150 |
|
151 |