1 /* |
|
2 * Copyright (c) 2006-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: Image thumbnail decoder. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef THUMBNAILIMAGEDECODERV3_H |
|
20 #define THUMBNAILIMAGEDECODERV3_H |
|
21 |
|
22 #include "thumbnailprovider.h" |
|
23 |
|
24 class CImageDecoder; |
|
25 class CFbsBitmap; |
|
26 |
|
27 // Size of buffer to load from file start to get EXIF thumbnail |
|
28 const TInt KJpegLoadBufferSize = 64 * 1024; |
|
29 |
|
30 |
|
31 /** |
|
32 * Image thumbnail decoder. |
|
33 * |
|
34 * @since S60 v5.0 |
|
35 */ |
|
36 class CThumbnailImageDecoderv3: public CActive |
|
37 { |
|
38 public: |
|
39 |
|
40 /** |
|
41 * C++ default constructor |
|
42 * |
|
43 * @since S60 v5.0 |
|
44 * @param aFs File server session |
|
45 * @return New image thumbnail decoder instance. |
|
46 */ |
|
47 CThumbnailImageDecoderv3( RFs& aFs ); |
|
48 |
|
49 /** |
|
50 * Destructor |
|
51 * |
|
52 * @since S60 v5.0 |
|
53 */ |
|
54 virtual ~CThumbnailImageDecoderv3(); |
|
55 |
|
56 |
|
57 /** |
|
58 * Creates a decoder from the given image buffer and gets image |
|
59 * information |
|
60 * |
|
61 * @since S60 v5.0 |
|
62 * @param aBuffer Source image buffer. |
|
63 * @param aObserver Observer to relay notifications about completed |
|
64 * operations. |
|
65 * @param aFlags Decoding option flags. |
|
66 * @param aMimeType Mime-type of image to be decoded. |
|
67 * @param aSize desired size of thumbnail. |
|
68 */ |
|
69 void CreateL( const TDesC8* aBuffer, MThumbnailProviderObserver& |
|
70 aObserver, const CThumbnailManager::TThumbnailFlags aFlags, const |
|
71 TDataType& aMimeType, const TSize& aSize ); |
|
72 |
|
73 /** |
|
74 * Decode image. |
|
75 * |
|
76 * @since S60 v5.0 |
|
77 * @param aDisplayMode Preferred display mode. |
|
78 */ |
|
79 void DecodeL( const TDisplayMode aDisplayMode ); |
|
80 |
|
81 /** |
|
82 * Returns the size of original image. |
|
83 * |
|
84 * @since S60 v5.0 |
|
85 * @return Size of original image. |
|
86 */ |
|
87 const TSize& OriginalSize()const; |
|
88 |
|
89 /** |
|
90 * Leave if image is corrupt |
|
91 * |
|
92 * @since S60 v5.0 |
|
93 */ |
|
94 void LeaveIfCorruptL(const TInt aError ); |
|
95 |
|
96 private: |
|
97 /** |
|
98 * Used to release reserved resources. |
|
99 * |
|
100 * @since S60 v5.0 |
|
101 */ |
|
102 void Release(); |
|
103 |
|
104 /** |
|
105 * Implements cancellation of an outstanding request. |
|
106 * |
|
107 * @since S60 v5.0 |
|
108 */ |
|
109 void DoCancel(); |
|
110 |
|
111 /** |
|
112 * Handles an active object's request completion event. |
|
113 * |
|
114 * @since S60 v5.0 |
|
115 */ |
|
116 void RunL(); |
|
117 |
|
118 |
|
119 /** |
|
120 * Creates image decoder to be used. |
|
121 * |
|
122 * @since S60 v5.0 |
|
123 */ |
|
124 void CreateDecoderL(); |
|
125 |
|
126 |
|
127 |
|
128 private: |
|
129 // data |
|
130 |
|
131 /** |
|
132 * Requested size. |
|
133 */ |
|
134 TSize iSize; |
|
135 |
|
136 /** |
|
137 * Image decoder. |
|
138 * Own. |
|
139 */ |
|
140 CImageDecoder* iDecoder; |
|
141 |
|
142 /** |
|
143 * Decoded bitmap. |
|
144 * Own. |
|
145 */ |
|
146 CFbsBitmap* iBitmap; |
|
147 |
|
148 /** |
|
149 * Image info flags (from TFrameInfo) |
|
150 */ |
|
151 TUint32 iFrameInfoFlags; |
|
152 |
|
153 /** |
|
154 * Original size of the image in pixels. |
|
155 */ |
|
156 TSize iOriginalSize; |
|
157 |
|
158 /** |
|
159 * Used fileserver. |
|
160 */ |
|
161 RFs& iFs; |
|
162 |
|
163 |
|
164 /** |
|
165 * Buffer from which thumbnail is to be created. |
|
166 */ |
|
167 const TDesC8* iBuffer; |
|
168 |
|
169 /** |
|
170 * Observer. |
|
171 */ |
|
172 MThumbnailProviderObserver* iObserver; // not own |
|
173 |
|
174 /** |
|
175 * Mime-type. |
|
176 */ |
|
177 TDataType iMimeType; |
|
178 }; |
|
179 |
|
180 #endif // THUMBNAILIMAGEDECODERV3_H |
|