|
1 /* |
|
2 * Copyright (c) 2007-2008 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 provider for image file |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef HNATTRIMGPROVFILEIMAGE_H_ |
|
20 #define HNATTRIMGPROVFILEIMAGE_H_ |
|
21 |
|
22 #include "hnattrimgprovider.h" |
|
23 |
|
24 class CImageDecoder; |
|
25 |
|
26 /** |
|
27 * Image provider class for empty image. |
|
28 * Image provider specialization that loads image |
|
29 * from an image file path. |
|
30 * |
|
31 * @lib hnpresentationmodel |
|
32 * @since S60 5.0 |
|
33 * @ingroup group_hnpresentationmodel |
|
34 */ |
|
35 NONSHARABLE_CLASS( CHnAttrImgProvFileImage ) : public CHnAttrImgProvider |
|
36 { |
|
37 public: |
|
38 |
|
39 /** |
|
40 * Two-phase constructor. |
|
41 * |
|
42 * @since S60 5.0 |
|
43 * @param aFileName Image file name. |
|
44 * @return Fully constructed object. |
|
45 */ |
|
46 IMPORT_C static CHnAttrImgProvFileImage* NewL( const TDesC& aFileName ); |
|
47 |
|
48 /** |
|
49 * Two-phase constructor. |
|
50 * |
|
51 * @since S60 5.0 |
|
52 * @param aFileName Image file name. |
|
53 * @return Fully constructed object. |
|
54 */ |
|
55 IMPORT_C static CHnAttrImgProvFileImage* NewLC( const TDesC& aFileName ); |
|
56 |
|
57 /** |
|
58 * Virtual destructor. |
|
59 * |
|
60 * @since S60 5.0 |
|
61 */ |
|
62 virtual ~CHnAttrImgProvFileImage(); |
|
63 |
|
64 // from base class CHnAttrImgProvider |
|
65 public: |
|
66 |
|
67 /** |
|
68 * Returns value. |
|
69 * |
|
70 * @return Value. |
|
71 * @since S60 5.0 |
|
72 */ |
|
73 const TDesC8& Value(); |
|
74 |
|
75 private: |
|
76 |
|
77 /** |
|
78 * Defualt constructor. |
|
79 * |
|
80 * @since S60 5.0 |
|
81 */ |
|
82 CHnAttrImgProvFileImage(); |
|
83 |
|
84 /** |
|
85 * Standard symbian 2nd phase constructor. |
|
86 * |
|
87 * @since S60 5.0 |
|
88 * @param aFileName Image file name. |
|
89 */ |
|
90 void ConstructL( const TDesC& aFileName ); |
|
91 |
|
92 /** |
|
93 * Determines optimal size for a bitmap to store an image from file. |
|
94 * |
|
95 * The bitmap whose size is determindd by this method is supposed to |
|
96 * be passed to CImageDecoder::Convert method. |
|
97 * The size will be chosen so that the following two requirements are |
|
98 * satisfied: |
|
99 * 1. Bitmap size does not exceed the initial bitmap size passed in |
|
100 * aBitmapSize. |
|
101 * 2. CImageDecoder::Convert fills the whole bitmap with image data |
|
102 * (there will be no empty space in the bitmap). |
|
103 * Please note that the information about the size of the image in the |
|
104 * file is accessible through the aImageDec object. |
|
105 * @param aImageDec reference to a CImageDecoder object |
|
106 * @param aBitmapSize maximal bitmap size, optimal bitmap size after |
|
107 * execution |
|
108 */ |
|
109 void CorrectBitmapSize( CImageDecoder& aImageDec, TSize& aBitmapSize ); |
|
110 |
|
111 private: // data |
|
112 |
|
113 /** |
|
114 * Value |
|
115 */ |
|
116 RBuf8 iValue; |
|
117 |
|
118 }; |
|
119 |
|
120 #endif // HNATTRIMGPROVFILEIMAGE_H_ |
|
121 |