|
1 /* |
|
2 * Copyright (c) 2007 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: Camera Bitmap Scaler class and observer interface. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CAM_BITMAPSCALER_H |
|
20 #define CAM_BITMAPSCALER_H |
|
21 |
|
22 // =========================================================================== |
|
23 // Included headers |
|
24 #include <e32std.h> |
|
25 #include <f32file.h> |
|
26 |
|
27 // =========================================================================== |
|
28 // Forward declarations |
|
29 class CFbsBitmap; |
|
30 class CBitmapScaler; |
|
31 |
|
32 // =========================================================================== |
|
33 // Classes |
|
34 |
|
35 /** |
|
36 * Interface for Camera Bitmap Scaler Observers |
|
37 */ |
|
38 class MCamBitmapScalerObserver |
|
39 { |
|
40 public: |
|
41 |
|
42 /** |
|
43 * Notify observer that the bitmap scaling has finished. |
|
44 * @param aStatus Status code describing the success of the operation. |
|
45 * KErrNone if all went as planned. |
|
46 * @param aBitmap Scaled bitmap. NULL if errors in scaling. |
|
47 */ |
|
48 virtual void BitmapScaled( TInt aStatus, const CFbsBitmap* aBitmap ) = 0; |
|
49 |
|
50 }; |
|
51 |
|
52 |
|
53 /** |
|
54 * Image Decoder class |
|
55 */ |
|
56 class CCamBitmapScaler : public CActive |
|
57 { |
|
58 // ======================================================= |
|
59 public: |
|
60 |
|
61 /** |
|
62 * 2-phase constructor. |
|
63 */ |
|
64 static CCamBitmapScaler* NewL( MCamBitmapScalerObserver& aObserver ); |
|
65 |
|
66 /** |
|
67 * Destructor. |
|
68 */ |
|
69 virtual ~CCamBitmapScaler(); |
|
70 |
|
71 // ------------------------------------------------------- |
|
72 // From CActive |
|
73 protected: |
|
74 |
|
75 /** |
|
76 * Called when Cancel is requested and this AO is active. |
|
77 * @see CActive |
|
78 */ |
|
79 virtual void DoCancel(); |
|
80 |
|
81 /** |
|
82 * We get notified of the scaling success by a call to RunL |
|
83 * when scaling finishes. |
|
84 * @see CActive |
|
85 */ |
|
86 virtual void RunL(); |
|
87 |
|
88 /** |
|
89 * If a leave occurs in RunL, RunError gets called by the |
|
90 * Active Scheduler. |
|
91 * @param aError Leave code from RunL. |
|
92 * @see CActive |
|
93 */ |
|
94 virtual TInt RunError( TInt aError ); |
|
95 |
|
96 // ------------------------------------------------------- |
|
97 public: |
|
98 |
|
99 void InitScalingL( const TSize& aTargetSize, |
|
100 const TDisplayMode& aTargetDisplayMode, |
|
101 TBool aMaintainAspect ); |
|
102 |
|
103 void StartScaling( CFbsBitmap& aSourceBitmap ); |
|
104 |
|
105 private: |
|
106 |
|
107 /** |
|
108 * 2nd phase constructor. |
|
109 */ |
|
110 void ConstructL(); |
|
111 |
|
112 /** |
|
113 * 1st phase constructor. |
|
114 * Cannot leave. |
|
115 */ |
|
116 CCamBitmapScaler( MCamBitmapScalerObserver& aObserver ); |
|
117 |
|
118 // ======================================================= |
|
119 // Data |
|
120 private: |
|
121 |
|
122 MCamBitmapScalerObserver& iObserver; |
|
123 CBitmapScaler* iScaler; |
|
124 CFbsBitmap* iScaledBitmap; |
|
125 TBool iMaintainAspect; |
|
126 |
|
127 // ======================================================= |
|
128 }; |
|
129 |
|
130 // =========================================================================== |
|
131 #endif // CAM_BITMAPSCALER_H |
|
132 |
|
133 // end of file |