1 /* |
|
2 * Copyright (c) 2008-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: |
|
13 * |
|
14 * Description: Task to generate a cropped thumbnail for a JPEG image. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 /** |
|
21 * @internal reviewed 30/07/2007 by Simon Brooks |
|
22 */ |
|
23 |
|
24 |
|
25 #ifndef C_GLXTNZOOMEDIMAGETASK_H |
|
26 #define C_GLXTNZOOMEDIMAGETASK_H |
|
27 |
|
28 #include "glxtntask.h" |
|
29 |
|
30 #include <glxthumbnailinfo.h> // For TGlxThumbnailFilter |
|
31 |
|
32 class CGlxtnFileInfo; |
|
33 class CGlxtnFileUtility; |
|
34 class TGlxThumbnailRequest; |
|
35 class CFbsBitmap; |
|
36 class CExtJpegDecoder; |
|
37 |
|
38 /** |
|
39 * Task to generate a cropped thumbnail for a JPEG image. |
|
40 * |
|
41 * @ingroup glx_thumbnail_creator |
|
42 */ |
|
43 NONSHARABLE_CLASS(CGlxtnZoomedImageTask) : public CGlxtnClientTask |
|
44 { |
|
45 public: |
|
46 /** |
|
47 * Two-phased constructor. |
|
48 */ |
|
49 static CGlxtnZoomedImageTask* NewL( |
|
50 const TGlxThumbnailRequest& aRequestInfo, |
|
51 CGlxtnFileUtility& aFileUtility, MGlxtnThumbnailCreatorClient& aClient); |
|
52 ~CGlxtnZoomedImageTask(); |
|
53 |
|
54 protected: // From CGlxtnTask |
|
55 virtual TBool DoStartL(TRequestStatus& aStatus); |
|
56 virtual void DoCancel(); |
|
57 virtual TBool DoRunL(TRequestStatus& aStatus); |
|
58 TBool DoRunError(TInt aError); |
|
59 |
|
60 private: |
|
61 CGlxtnZoomedImageTask(const TGlxThumbnailRequest& aRequestInfo, |
|
62 CGlxtnFileUtility& aFileUtility, MGlxtnThumbnailCreatorClient& aClient); |
|
63 void ConstructL(TInt aBitmapHandle); |
|
64 |
|
65 void DecodePartialImageL(TRequestStatus& aStatus); |
|
66 void CreateDecoderL(TInt aDecoderType); |
|
67 |
|
68 private: |
|
69 enum TTaskState |
|
70 { |
|
71 EStateFetchingUri, EStateDecoding, EStateProcessing |
|
72 }; |
|
73 |
|
74 /** File utility (not owned) */ |
|
75 CGlxtnFileUtility& iFileUtility; |
|
76 /** File information for item to thumbnail */ |
|
77 CGlxtnFileInfo* iInfo; |
|
78 /** Current state for task state machine */ |
|
79 TTaskState iState; |
|
80 /** Bitmap for the generated thumbnail */ |
|
81 CFbsBitmap* iThumbnail; |
|
82 /** Decoder for the JPEG file */ |
|
83 CExtJpegDecoder* iDecoder; |
|
84 /** Requested thumbnail size */ |
|
85 TSize iRequestedSize; |
|
86 /** Part of image to keep */ |
|
87 TRect iCroppingRect; |
|
88 /** Filtering to apply to generated image */ |
|
89 TGlxThumbnailFilter iFilter; |
|
90 /** DRM allowed flag passed from thumbnail request */ |
|
91 TBool iDrmAllowed; |
|
92 /** Whether current file is DRM protected */ |
|
93 TBool iProtected; |
|
94 }; |
|
95 |
|
96 #endif // C_GLXTNZOOMEDIMAGETASK_H |
|