|
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 file based image class. |
|
15 * : This class acts as a window into single image or animation |
|
16 * : in one physical file. Note that file will be locked as long |
|
17 * : as instance of this class is present. |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 #ifndef MIHLFILEIMAGE_H |
|
23 #define MIHLFILEIMAGE_H |
|
24 |
|
25 // INCLUDES |
|
26 #include <MIHLImage.h> |
|
27 #include <gdi.h> |
|
28 |
|
29 // FORWARD DECLARATION |
|
30 class MIHLBitmap; |
|
31 class MIHLFilter; |
|
32 |
|
33 // CLASS DECLARATION |
|
34 /** |
|
35 * MIHLFileImage |
|
36 * |
|
37 * Pure virtual interface for file based image class. |
|
38 * This class acts as a window into single image or animation |
|
39 * in one physical file. Note that file will be locked as long |
|
40 * as instance of this class is present. |
|
41 * |
|
42 * If interface needs to be pushed into CleanupStack, |
|
43 * remember to use CleanupDeletePushL() function! |
|
44 * DO NOT USE CleanupStack::PushL()!! |
|
45 * |
|
46 * @lib IHL.lib |
|
47 * @since 3.0 |
|
48 */ |
|
49 class MIHLFileImage : public MIHLImage |
|
50 { |
|
51 public: |
|
52 |
|
53 /** |
|
54 * Virtual destructor. |
|
55 */ |
|
56 virtual ~MIHLFileImage() {} |
|
57 |
|
58 public: |
|
59 |
|
60 /** |
|
61 * Flags to control file image functionality. |
|
62 * These can be combined using an OR operation. |
|
63 * @since 3.0 |
|
64 */ |
|
65 enum TOptions |
|
66 { |
|
67 EOptionNoDRMConsume = 0x01, |
|
68 }; |
|
69 |
|
70 public: |
|
71 |
|
72 /** |
|
73 * Return image type's unique identifier. |
|
74 * @since 3.0 |
|
75 * @return Image type Uid. |
|
76 */ |
|
77 virtual const TUid& ImageType() const = 0; |
|
78 |
|
79 /** |
|
80 * Return image subtype's unique identifier. |
|
81 * @since 3.0 |
|
82 * @return Image subtype Uid. |
|
83 */ |
|
84 virtual const TUid& ImageSubType() const = 0; |
|
85 |
|
86 /** |
|
87 * Return image index of this instance from source file. |
|
88 * Note that animation is counted as an single image. |
|
89 * @since 3.0 |
|
90 * @return Index of this instance. |
|
91 */ |
|
92 virtual TInt ImageIndex() const = 0; |
|
93 |
|
94 /** |
|
95 * Return count of images in source file. |
|
96 * Note that animation is counted as an single image. |
|
97 * @since 3.0 |
|
98 * @return Count of images in source file. |
|
99 */ |
|
100 virtual TInt ImageCount() const = 0; |
|
101 |
|
102 |
|
103 /** |
|
104 * Return image size. |
|
105 * @since 3.0 |
|
106 * @return Image size in pixels. |
|
107 */ |
|
108 virtual TSize Size() const = 0; |
|
109 |
|
110 /** |
|
111 * Return preferred display mode for image. |
|
112 * Note that this display mode may differ from images original |
|
113 * display mode. Image processing may |
|
114 * need more colors than image has originally. |
|
115 * @since 3.0 |
|
116 * @return Preferred image display mode. |
|
117 */ |
|
118 virtual TDisplayMode DisplayMode() const = 0; |
|
119 |
|
120 /** |
|
121 * Return display mode of mask bitmap. |
|
122 * If image doesn't support transparency, ENone is returned. |
|
123 * @since 3.0 |
|
124 * @return ENone if image is not transparent. |
|
125 * Mask display mode if image has transparency. |
|
126 */ |
|
127 virtual TDisplayMode MaskDisplayMode() const = 0; |
|
128 |
|
129 /** |
|
130 * Return image background color. |
|
131 * @since 3.0 |
|
132 * @return Image background color. |
|
133 */ |
|
134 virtual TRgb BackgroundColor() const = 0; |
|
135 |
|
136 /** |
|
137 * Return array of fixed load sizes which can |
|
138 * be used in bitmap loading operation. |
|
139 * Array contain only sizes that differs from image original size. |
|
140 * If image can be loaded only to original size or it's fully |
|
141 * scaleable, array is empty. |
|
142 * Sizes starts from smallest and ends at largest. |
|
143 * @since 3.0 |
|
144 * @return Array of supported image load sizes. |
|
145 */ |
|
146 virtual const RArray<TSize>& CustomLoadSizeArray() const = 0; |
|
147 |
|
148 /** |
|
149 * Check if image can be loaded directly into any given load size. |
|
150 * @since 3.0 |
|
151 * @return Array of supported image load sizes. |
|
152 */ |
|
153 virtual TBool IsFullyScaleable() const = 0; |
|
154 |
|
155 /** |
|
156 * Check if image is animated. |
|
157 * @since 3.0 |
|
158 * @return ETrue if image is animated, EFalse if not. |
|
159 */ |
|
160 virtual TBool IsAnimation() const = 0; |
|
161 |
|
162 /** |
|
163 * Return animation frame count. |
|
164 * If image is not animated, it has no animation frames either. |
|
165 * @since 3.0 |
|
166 * @return Animation frame count. |
|
167 */ |
|
168 virtual TInt AnimationFrameCount() const = 0; |
|
169 |
|
170 /** |
|
171 * Return animation frame delay. |
|
172 * If image is not animated, it has no animation frames either. |
|
173 * @since 3.0 |
|
174 * @param aAnimationFrameIndex Animation frame index. |
|
175 * @return Animation frame delay. |
|
176 */ |
|
177 virtual TTimeIntervalMicroSeconds32 AnimationFrameDelay( TInt aAnimationFrameIndex ) const = 0; |
|
178 |
|
179 /** |
|
180 * Load image into bitmap. |
|
181 * If using scale support, given bitmap must be created with wanted size |
|
182 * from CustomLoadSizeArray(). Displaymode can be get from Displaymode() method. |
|
183 * Mask bitmap is always reseted. It's recreated if image is transparent by using |
|
184 * size of given bitmap and displaymode from MaskDisplayMode() method. |
|
185 * If image is animated, first animation frame is loaded. |
|
186 * @since 3.0 |
|
187 * @param aStatus Load request status reference. |
|
188 * @param aDestination Destination bitmap reference. |
|
189 * @param aFrameIndex for loading single frame from image |
|
190 * @return Return system wide error codes: |
|
191 * KerrArgument if given bitmap is not created or it's size is incorrect. |
|
192 * KErrBusy image has load request pending already. |
|
193 */ |
|
194 virtual TInt Load( TRequestStatus& aStatus, MIHLBitmap& aDestination, TInt aFrameIndex = 0 ) = 0; |
|
195 |
|
196 /** |
|
197 * Load animation frame into bitmap. |
|
198 * If using scale support, given bitmap must be created with wanted size |
|
199 * from CustomLoadSizeArray(). Displaymode can be get from Displaymode() method. |
|
200 * Because some animations are build on top of previous frames, passing already loaded previous |
|
201 * frame as a destination bitmap will increase load speed of next frames. |
|
202 * Method will panic if given animation frame index is out of bounds. |
|
203 * @since 3.0 |
|
204 * @param aStatus Load request status reference. |
|
205 * @param aDestination Destination bitmap reference. |
|
206 * @param aAnimationFrameIndex Animation frame index. |
|
207 * @return Return system wide error codes: |
|
208 * KErrArgument if given bitmap is not created or it's size is incorrect. |
|
209 * KErrBusy image has load request pending already. |
|
210 */ |
|
211 virtual TInt LoadAnimation( TRequestStatus& aStatus, MIHLBitmap& aDestination, |
|
212 TInt aAnimationFrameIndex ) = 0; |
|
213 |
|
214 /** |
|
215 * Check if image has load request pending. |
|
216 * @since 3.0 |
|
217 * @return ETrue if request is pending, EFalse if not. |
|
218 */ |
|
219 virtual TBool IsBusy() const = 0; |
|
220 |
|
221 /** |
|
222 * Cancel pending load request. |
|
223 * If not active, method does nothing. |
|
224 * @since 3.0 |
|
225 */ |
|
226 virtual void CancelLoad() = 0; |
|
227 |
|
228 /** |
|
229 * Set filter. |
|
230 * For future use, not used currently! |
|
231 * @since 3.0 |
|
232 */ |
|
233 virtual void SetFilter( MIHLFilter* aFilter ) = 0; |
|
234 }; |
|
235 |
|
236 #endif // MIHLFILEIMAGE_H |
|
237 |
|
238 // End of File |