1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // This is the plugin API for the Image Display framework
18 #ifndef __IMAGEDISPLAYPLUGIN_H__
19 #define __IMAGEDISPLAYPLUGIN_H__
21 #include <imagedisplay.h>
22 #include <icl/imagedisplaypluginext.h>
25 class CImageDisplayFramework;
26 class CImageDisplayPluginBody;
29 This is the plugin API for the Image Display framework
30 Intended for use by plugin writers only.
35 class CImageDisplayPlugin : public CBase
37 friend class CImageDisplayFramework;
38 friend class CImageDisplayPluginBody;
42 Data source type definitions for plug-ins
46 /** Undefined. Plug-in won't be given this value */
48 /** The datasource is a file name */
50 /** The datasource is a file handle */
52 /** The datasource is a descriptor */
57 Defines an ImageDisplay plug-in status flag values
61 /** A plug-in has nothing more to decode; also must be set also on fatal error contidition */
62 EStatusNoMoreToDecode =0x00000001,
63 /** The next frame is not ready yet, bitmap may contain distorted image */
64 EStatusBusy =0x00000002,
65 /** Image decoding is paused i.e. call Play() to continue (if EStatusNoMoreToDecode is not set) */
66 EStatusPaused =0x00000004,
67 /** The next frame has been already decoded*/
68 EStatusFrameReady =0x00000008,
69 /** May be set after image decode completion i.e. when EStatusNoMoreToDecode is set */
70 EStatusDisplayThisFrameIndefinetely =0x00000010,
71 /** May be set if the image format supports progressive decoding; indicates that a bitmap contains roughtly decoded image */
72 EStatusPartialFrame =0x00000020,
73 /** May be set in case when a plug-in asks to invalidate previous frame contents */
74 EStatusEraseOutputContents =0x00000040,
77 Virtual destructor. Current implementation will call the REComSession::DestroyedImplementation() to finalize destruction
80 IMPORT_C ~CImageDisplayPlugin();
84 Initialise the plugin and check the image display settings.
86 This is called by the ImageDisplay framework when the client app calls
87 CImageDisplay::SetupL().
89 The plugin should check the validity of the source image and all other settings
90 set by the client API. If any of these is unsupported then it should leave with
93 A plugin implementing CImageDisplayPluginExtension to allow extension of the
94 client API should initialise it here.
96 This is a virtual function that each individual plugin must implement.
99 Some of the configuration parameters are invalid
101 virtual void OpenL() = 0;
104 Initiate the image display operation
106 This is a virtual function that each individual plugin must implement.
109 virtual void Play() = 0;
114 This is a virtual function that each individual plugin must implement.
116 virtual void Pause() = 0;
119 Cancel the image display operation
120 May be called by the framework even when there is no outstanding request.
122 This is a virtual function that each individual plugin must implement.
124 virtual void StopPlay() = 0;
127 Should return an array of recommended image sizes i.e. sizes which would be processed faster
128 @return a reference to the array of recommended image sizes
130 This is a virtual function that each individual plugin must implement.
132 virtual const CImageDisplay::RImageSizeArray& RecommendedImageSizes() const=0;
135 Exported default constructor
137 IMPORT_C CImageDisplayPlugin();
141 returns an image datasource type
142 @return TImageSourceType
144 IMPORT_C TImageSourceType SourceType() const;
146 returns an image source file name
147 @return const TDesC& a reference to read-only descriptor
148 @panic ImageDisplay 4 EImageWrongType if image data source is of type other than the file name
150 IMPORT_C const TDesC& SourceFilename() const;
152 returns an image source file handle
153 @return const RFile& a reference to a file handle
154 @panic ImageDisplay 4 EImageWrongType if image data source is of type other than the file handle
156 IMPORT_C RFile& SourceFileHandle() const;
158 returns an image source descriptor
159 @return const TDesC8& a reference to a 8 bit descriptor
160 @panic ImageDisplay 4 EImageWrongType if image data source is of type other than the descriptor
162 IMPORT_C const TDesC8& SourceData() const;
165 returns an intent that is requested by client for opening the image source
166 @return ContentAccess::TIntent a desired intent value
168 IMPORT_C ContentAccess::TIntent SourceDataIntent() const;
171 returns requested content data Id that should be used to open content
172 @return const TDesC& a desired data unique Id
174 IMPORT_C const TDesC& CImageDisplayPlugin::SourceDataId() const;
177 returns an image source MIME type or KNullDesC8 if not defined
178 @return const TDesC8& a reference to a 8 bit descriptor
180 IMPORT_C const TDesC8& SourceMimeType() const;
182 returns a global image type
183 @return const TUid an image type Uid
185 IMPORT_C const TUid SourceImageType() const;
187 returns a global image subtype or KNullUid if not defined
188 @return const TUid an image subtype Uid
190 IMPORT_C const TUid SourceImageSubType() const;
192 returns a requested by an API client source clipping rect
193 @param aRect a reference to source clipping rect which is valid only if return value is ETrue
194 @return ETrue if clipping rect was defined by client
196 IMPORT_C TBool SourceRect(TRect& aRect) const;
198 returns a requested by an API client destination image size
199 @return const TSize - requested image size in pixels
201 IMPORT_C const TSize& DestinationSizeInPixels() const;
203 returns a requested by an API client image options e.g. combination of the TImageOptions
204 @return TUint - requested image option set
206 IMPORT_C TUint Options() const;
208 returns ETrue if an API client requested to preserve source image aspect ratio
209 @return TBool - requested aspect ratio flag
211 IMPORT_C TBool MaintainAspectRatio() const;
213 returns a requested by an API client display mode for an image being decoded
214 @return TDisplayMode - requested display mode
216 IMPORT_C TDisplayMode DisplayMode() const;
218 A plug-in that supports an extension interface has to override this function
220 a request extension Uid
222 a reference to the pointer that should be given extension interface pointer on success
223 @return KErrNotSupported if requested extension is not supported otherwise KErrNone
225 IMPORT_C virtual TInt ExtensionInterface(TUid aIFaceUid, TAny*& aIFacePtr);
227 A plug-in that supports image mask getting has to override this function
229 a reference to bitmap pointer
231 a reference to bitmap pointer, a plug-in may return NULL if no mask is available
233 IMPORT_C virtual void GetBitmap(const CFbsBitmap*& aBitmap, const CFbsBitmap*& aMask) const;
235 A plug-in that supports target bitmap status checkig has to override this function
236 @return TBool - ETrue if subsequent call to the GetBitmap() able to return valid bitmaps
238 IMPORT_C virtual TBool ValidBitmap() const;
240 A plug-in that supports source image status checking has to override this function
241 @return TUint - set of the TImageStatus flags
243 IMPORT_C virtual TUint ImageStatus() const;
245 A plug-in that supports getting of source image number of frames has to override this function
247 Number of frames in the source image
248 @return TInt - KErrNone if aNumFrames contains a valid number of frames
250 IMPORT_C virtual TInt NumFrames(TInt& aNumFrames) const;
252 // callback methods - used to pass data to the clieant throught the CImageDisplayFramework
254 A plug-in may use this function to determine if a previuos callback function to an API client has been completed
255 @return ETrue if callback has not been completed yet
257 IMPORT_C TBool CallbackIsRunning() const;
259 A plug-in should use this function to pass information asinchronously to an API client. This function is asinchronous.
261 a pointer to the bitmap that contains decoding result
264 the plugin status that should be combination of the TPluginStatus set
267 a rectangle within the aBitmap that was updated during the latest operation
270 error code of latest operation
273 IMPORT_C void AsyncCallbackImageReady(const CFbsBitmap* aBitmap, TUint aStatus, const TRect& aUpdatedArea, TInt aError);
276 A plug-in should use this function to cancel callback to a client if it is stil pending
278 IMPORT_C void CancelCallback();
282 An array containing the sizes of the images.
284 CImageDisplay::RImageSizeArray iImageSizes;
290 IMPORT_C static CImageDisplayPlugin* NewL(TUid aImplementationUid, CImageDisplayFramework& aFramework);
291 void ConstructL(CImageDisplayFramework& aFramework, TUid aInstanceUid);
293 static TInt AsyncCbGate(TAny* aPtr);
296 /** Reserved. Not for public use */
297 IMPORT_C virtual void ReservedVirtual1();
298 /** Reserved. Not for public use */
299 IMPORT_C virtual void ReservedVirtual2();
300 /** Reserved. Not for public use */
301 IMPORT_C virtual void ReservedVirtual3();
302 /** Reserved. Not for public use */
303 IMPORT_C virtual void ReservedVirtual4();
306 CImageDisplayFramework* iFramework;
307 CImageDisplayPluginBody* iBody;
310 Future proofing not for public use
315 #endif // __IMAGEDISPLAYPLUGIN_H__