|
1 /* |
|
2 * Copyright (c) 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: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef GLXIMAGEDECODER_H |
|
20 #define GLXIMAGEDECODER_H |
|
21 #include <QPixmap> |
|
22 #include <f32file.h> |
|
23 #include "glximagedecoderwrapper.h" |
|
24 |
|
25 class GlxImageDecoderWrapper; |
|
26 class CImageDecoder; |
|
27 class CFbsBitmap; |
|
28 const TReal KTargetSize = 1000000; |
|
29 //if any image is converted to Pixmap with an dimension > 2048 |
|
30 //the conversion will fail |
|
31 const TInt KMaxDimensionLimit = 2000; |
|
32 class CGlxImageDecoder : public CActive |
|
33 { |
|
34 public: |
|
35 static CGlxImageDecoder* NewL(GlxImageDecoderWrapper* decoderWrapper); |
|
36 ~CGlxImageDecoder(); |
|
37 QSizeF DecodeImageL(QString aSourceFileName); |
|
38 QPixmap GetPixmap(); |
|
39 void ResetDecoder(); |
|
40 public: |
|
41 /** |
|
42 * Standard Active object functions |
|
43 * */ |
|
44 virtual void RunL(); |
|
45 virtual void DoCancel(); |
|
46 private: |
|
47 /* |
|
48 * Constructor |
|
49 * */ |
|
50 CGlxImageDecoder(); |
|
51 /* |
|
52 *Second-phase constuction |
|
53 * */ |
|
54 void ConstructL(GlxImageDecoderWrapper* decoderWrapper); |
|
55 |
|
56 /* |
|
57 * Checks if the mimetype needs recalculations |
|
58 * @returnType false if jpeg |
|
59 * true otheriwise |
|
60 */ |
|
61 TBool DoesMimeTypeNeedsRecalculateL(QString aSourceFileName); |
|
62 |
|
63 /* |
|
64 * Does the recalculation and returns back the correct size |
|
65 * @returntype Size of the decoded bitmap |
|
66 */ |
|
67 TSize ReCalculateSizeL(QString aSourceFileName, TSize aDestSize); |
|
68 |
|
69 private: |
|
70 GlxImageDecoderWrapper* iDecoderWrapper; |
|
71 /*Specifies the Decoder */ |
|
72 CImageDecoder* iImageDecoder; // decoder from ICL API |
|
73 /*Contains the Bitmap generated*/ |
|
74 CFbsBitmap* iBitmap; |
|
75 /*Contains the bitmap in QT format8*/ |
|
76 QPixmap iDecodedPixmap; |
|
77 /*A handle to a file server session.*/ |
|
78 RFs iFs; |
|
79 |
|
80 }; |
|
81 #endif //GLXIMAGEDECODER_H |