|
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: Pure virtual interface for Image Viewer class. |
|
15 * : Class can be used to view, process and play animation |
|
16 * : from source image. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef MIHLIMAGEVIEWER_H |
|
22 #define MIHLIMAGEVIEWER_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <MIHLViewer.h> |
|
26 #include <e32std.h> |
|
27 |
|
28 // FORWARD DECLARATION |
|
29 class MIHLFilter; |
|
30 |
|
31 // CLASS DECLARATION |
|
32 /** |
|
33 * MIHLImageViewer |
|
34 * |
|
35 * Pure virtual interface for Image Viewer class. |
|
36 * Class can be used to view, process and play animation |
|
37 * from source image. |
|
38 * |
|
39 * If interface needs to be pushed into CleanupStack, |
|
40 * remember to use CleanupStackDeletePushL() function! |
|
41 * DO NOT USE CleanupStack::PushL()!! |
|
42 * |
|
43 * @lib IHL.lib |
|
44 * @since 3.0 |
|
45 */ |
|
46 class MIHLImageViewer : public MIHLViewer |
|
47 { |
|
48 public: |
|
49 |
|
50 /** |
|
51 * Virtual destructor. |
|
52 */ |
|
53 virtual ~MIHLImageViewer() {} |
|
54 |
|
55 public: |
|
56 |
|
57 /** |
|
58 * Flags to control viewer functionality. |
|
59 * These can be combined using an OR operation. |
|
60 * @since 3.0 |
|
61 */ |
|
62 enum TOptions |
|
63 { |
|
64 EOptionIgnoreAspectRatio = 0x01, |
|
65 EOptionUseBilinearInterpolation = 0x02 |
|
66 }; |
|
67 |
|
68 /** |
|
69 * Rotation angle of source image. |
|
70 * @since 3.0 |
|
71 */ |
|
72 enum TRotationAngle |
|
73 { |
|
74 ERotationAngle0 = 0, |
|
75 ERotationAngle90 = 90, |
|
76 ERotationAngle180 = 180, |
|
77 ERotationAngle270 = 270, |
|
78 }; |
|
79 |
|
80 public: |
|
81 |
|
82 /** |
|
83 * Check if source image is animated. |
|
84 * @since 3.0 |
|
85 * @return ETrue if source image is animated. EFalse if not. |
|
86 */ |
|
87 virtual TBool IsAnimation() const = 0; |
|
88 |
|
89 /** |
|
90 * Start animation playback. |
|
91 * If source image is not animated, method does nothing. |
|
92 * @since 3.0 |
|
93 */ |
|
94 virtual void Play() = 0; |
|
95 |
|
96 /** |
|
97 * Stop animation playback. |
|
98 * If source image is not animated or animation is |
|
99 * not played currently, method does nothing. |
|
100 * @since 3.0 |
|
101 */ |
|
102 virtual void Stop() = 0; |
|
103 |
|
104 /** |
|
105 * Check if animation playback is currently running. |
|
106 * @since 3.0 |
|
107 * @return ETrue if animation is running. EFalse if not. |
|
108 */ |
|
109 virtual TBool IsPlaying() const = 0; |
|
110 |
|
111 /** |
|
112 * Count of frames in animated image. |
|
113 * If not animated, return zero. |
|
114 * @since 3.0 |
|
115 * @return Frames count of animation. |
|
116 */ |
|
117 virtual TInt AnimationFrameCount() const = 0; |
|
118 |
|
119 /** |
|
120 * Current animation frame in display. |
|
121 * @since 3.0 |
|
122 * @return Current animation frame index. |
|
123 */ |
|
124 virtual TInt AnimationFrame() const = 0; |
|
125 |
|
126 /** |
|
127 * Change current animation frame. |
|
128 * @since 3.0 |
|
129 * @param aFrameIndex New animation frame. |
|
130 * @return System wide error code. |
|
131 */ |
|
132 virtual TInt SetAnimationFrame( TInt aFrameIndex ) = 0; |
|
133 |
|
134 /** |
|
135 * Change viewer size. |
|
136 * This is also the maximum size of destination bitmap. |
|
137 * @since 3.0 |
|
138 * @param aViewerSize New viewer size. |
|
139 * @return System wide error code. |
|
140 */ |
|
141 virtual TInt SetViewerSize( const TSize& aViewerSize, TInt srcBitmapScaleFactor = 1 ) = 0; |
|
142 |
|
143 /** |
|
144 * Viewer size. |
|
145 * This is also the maximum size of destination bitmap. |
|
146 * @since 3.0 |
|
147 * @return Viewer size. |
|
148 */ |
|
149 virtual TSize ViewerSize() const = 0; |
|
150 |
|
151 /** |
|
152 * Move source clip rectangle. |
|
153 * This is the area that is used from source image |
|
154 * and processed to destination bitmap. |
|
155 * Check valid move area with SourceRect() |
|
156 * and SourceSize() methods. |
|
157 * @since 3.0 |
|
158 * @param aDx Movement in X-axis. |
|
159 * @param aDy Movement in Y-axis. |
|
160 * @return System wide error code. |
|
161 */ |
|
162 virtual TInt MoveSourceRect( TInt aDx, TInt aDy ) = 0; |
|
163 |
|
164 /** |
|
165 * Set source clip rectangle position. |
|
166 * This is the area that is used from source image |
|
167 * and processed to destination bitmap. |
|
168 * Check valid move area with SourceRect() |
|
169 * and SourceSize() methods. |
|
170 * @since 3.0 |
|
171 * @param aPosition Topleft posion of rectangle. |
|
172 * @return System wide error code. |
|
173 */ |
|
174 virtual TInt SetSourceRectPosition( const TPoint& aPosition ) = 0; |
|
175 |
|
176 /** |
|
177 * This is the area that is used from source image |
|
178 * and processed to destination bitmap. |
|
179 * @since 3.0 |
|
180 * @return Source clip rectangle. |
|
181 */ |
|
182 virtual TRect SourceRect() const = 0; |
|
183 |
|
184 /** |
|
185 * Source image size. |
|
186 * Note that this will change if image is rotated. |
|
187 * @since 3.0 |
|
188 * @return Source image size. |
|
189 */ |
|
190 virtual TSize SourceSize() const = 0; |
|
191 |
|
192 /** |
|
193 * Set new zoom ratio. |
|
194 * Zoom ratio is multiplier for scaling, |
|
195 * 0,5 is 50%, 1.0 is 100%, 2,0 is 200% and so on. |
|
196 * Value cannot be zero or negative. |
|
197 * @since 3.0 |
|
198 * @param aZoomRatio New zoom ratio. |
|
199 * @return System wide error code. |
|
200 */ |
|
201 virtual TInt SetZoomRatio( TReal aZoomRatio ) = 0; |
|
202 |
|
203 /** |
|
204 * Current zoom ratio. |
|
205 * @since 3.0 |
|
206 * @return Current zoom ratio. |
|
207 */ |
|
208 virtual TReal ZoomRatio() const = 0; |
|
209 |
|
210 /** |
|
211 * Zoom to fit ratio. |
|
212 * Using this zoom ratio, image will fit |
|
213 * exactly to viewer. |
|
214 * @since 3.0 |
|
215 * @return Zoom to fit ratio. |
|
216 */ |
|
217 virtual TReal ZoomToFitRatio() const = 0; |
|
218 |
|
219 /** |
|
220 * Rotate source image 90 degree clockwise. |
|
221 * Source rect is also moved to remain in same position |
|
222 * where it was according to source image data. |
|
223 * @since 3.0 |
|
224 * @return System wide error code. |
|
225 */ |
|
226 virtual TInt RotateClockwise() = 0; |
|
227 |
|
228 /** |
|
229 * Rotate source image 90 degree counterclockwise. |
|
230 * Source rect is also moved to remain in same position |
|
231 * where it was according to source image data. |
|
232 * @since 3.0 |
|
233 * @return System wide error code. |
|
234 */ |
|
235 virtual TInt RotateCounterClockwise() = 0; |
|
236 |
|
237 /** |
|
238 * Set rotation angle. Use values from TRotationAngle enumeration. |
|
239 * Source rect is also moved to remain in same position |
|
240 * where it was according to source image data. |
|
241 * @since 3.0 |
|
242 * @param aRotationAngle New rotation angle. |
|
243 * @return System wide error code. |
|
244 */ |
|
245 virtual TInt SetRotationAngle( TInt aRotationAngle ) = 0; |
|
246 |
|
247 /** |
|
248 * Current rotation angle. |
|
249 * @since 3.0 |
|
250 * @return Current rotation angle. |
|
251 */ |
|
252 virtual TInt RotationAngle() const = 0; |
|
253 |
|
254 /** |
|
255 * Set vertical mirroring for source image. |
|
256 * Source rect is also moved to remain in same position |
|
257 * where it was according to source image data. |
|
258 * @since 3.0 |
|
259 * @param aValue Mirroring flag. |
|
260 * @return System wide error code. |
|
261 */ |
|
262 virtual TInt SetVerticalMirroring( TBool aValue ) = 0; |
|
263 |
|
264 /** |
|
265 * Check if source is vertically mirrored. |
|
266 * @since 3.0 |
|
267 * @return ETrue if mirrored, EFalse if not. |
|
268 */ |
|
269 virtual TBool VerticalMirroring() const = 0; |
|
270 |
|
271 /** |
|
272 * Set horizontal mirroring for source image. |
|
273 * Source rect is also moved to remain in same position |
|
274 * where it was according to source image data. |
|
275 * @since 3.0 |
|
276 * @param aValue Mirroring flag. |
|
277 * @return System wide error code. |
|
278 */ |
|
279 virtual TInt SetHorizontalMirroring( TBool aValue ) = 0; |
|
280 |
|
281 /** |
|
282 * Check if source is horizontally mirrored. |
|
283 * @since 3.0 |
|
284 * @return ETrue if mirrored, EFalse if not. |
|
285 */ |
|
286 virtual TBool HorizontalMirroring() const = 0; |
|
287 |
|
288 /** |
|
289 * Set filter. |
|
290 * For future use, not used currently! |
|
291 * @since 3.0 |
|
292 */ |
|
293 virtual void SetFilter( MIHLFilter* aFilter ) = 0; |
|
294 }; |
|
295 |
|
296 #endif // MIHLIMAGEVIEWER_H |
|
297 |
|
298 // End of File |