epoc32/include/icl/imagedisplayplugin.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     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 "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // This is the plugin API for the Image Display framework
    15 // 
    16 //
    17 
    18 #ifndef __IMAGEDISPLAYPLUGIN_H__
    19 #define __IMAGEDISPLAYPLUGIN_H__
    20 
    21 #include <imagedisplay.h>
    22 #include <icl/imagedisplaypluginext.h>
    23 
    24 // fwd ref
    25 class CImageDisplayFramework;
    26 class CImageDisplayPluginBody;
    27 
    28 /**
    29 This is the plugin API for the Image Display framework
    30 Intended for use by plugin writers only.
    31 
    32 @publishedAll
    33 @released
    34 */
    35 class CImageDisplayPlugin : public CBase
    36 	{
    37 	friend class CImageDisplayFramework;
    38 	friend class CImageDisplayPluginBody;
    39 
    40 public:
    41 	/**
    42 	Data source type definitions for plug-ins
    43 	*/
    44 	enum TImageSourceType 
    45 		{
    46 		/** Undefined. Plug-in won't be given this value */
    47 		EImgSrcNotDefined	=0,
    48 		/** The datasource is a file name */
    49 		EImgSrcFileName,
    50 		/** The datasource is a file handle */
    51 		EImgSrcFileHandle,
    52 		/** The datasource is a descriptor */
    53 		EImgSrcDescriptor,
    54 		};
    55 
    56 	/**
    57 	Defines an ImageDisplay plug-in status flag values
    58 	*/
    59 	enum TPluginStatus
    60 		{
    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,
    75 		};
    76 	/**
    77 		Virtual destructor. Current implementation will call the REComSession::DestroyedImplementation() to finalize destruction
    78 		of the ECom plugin
    79 	*/
    80 	IMPORT_C ~CImageDisplayPlugin();
    81 
    82 protected:
    83 	/**
    84 	Initialise the plugin and check the image display settings.
    85 
    86 	This is called by the ImageDisplay framework when the client app calls
    87 	CImageDisplay::SetupL(). 
    88 	
    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 
    91 	KErrArgument
    92 
    93 	A plugin implementing CImageDisplayPluginExtension to allow extension of the 
    94 	client API should initialise it here.
    95 
    96 	This is a virtual function that each individual plugin must implement.
    97 
    98 	@leave  KErrArgument
    99 	Some of the configuration parameters are invalid
   100 	*/
   101 	virtual void OpenL() = 0;
   102 
   103 	/**
   104 	Initiate the image display operation
   105 
   106 	This is a virtual function that each individual plugin must implement.
   107 
   108 	*/
   109 	virtual void Play() = 0;
   110 
   111 	/**
   112 	Pause image decoding
   113 
   114 	This is a virtual function that each individual plugin must implement.
   115 	*/
   116 	virtual void Pause() = 0;
   117 
   118 	/**
   119 	Cancel the image display operation
   120 	May be called by the framework even when there is no outstanding request.
   121 
   122 	This is a virtual function that each individual plugin must implement.
   123 	*/
   124 	virtual void StopPlay() = 0;
   125 
   126 	/**
   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
   129 
   130 	This is a virtual function that each individual plugin must implement.
   131 	*/	
   132 	virtual const CImageDisplay::RImageSizeArray& RecommendedImageSizes() const=0;
   133 	
   134 	/**
   135 		Exported default constructor
   136 	*/
   137 	IMPORT_C CImageDisplayPlugin();
   138 
   139 	// getters
   140 	/**
   141 	   returns an image datasource type
   142 	   @return TImageSourceType 
   143 	*/
   144 	IMPORT_C TImageSourceType SourceType() const;
   145 	/**
   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
   149 	*/
   150 	IMPORT_C const TDesC& SourceFilename() const;
   151 	/**
   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
   155 	*/
   156 	IMPORT_C RFile& SourceFileHandle() const;
   157 	/**
   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
   161 	*/
   162 	IMPORT_C const TDesC8& SourceData() const;
   163 
   164 	/**
   165 	   returns an intent that is requested by client for opening the image source
   166 	   @return ContentAccess::TIntent a desired intent value
   167 	*/
   168 	IMPORT_C ContentAccess::TIntent SourceDataIntent() const;
   169 
   170 	/**
   171 	   returns requested content data Id that should be used to open content
   172 	   @return const TDesC& a desired data unique Id
   173 	*/
   174 	IMPORT_C const TDesC& SourceDataId() const;
   175 
   176 	/**
   177 	   returns an image source MIME type or KNullDesC8 if not defined
   178 	   @return const TDesC8& a reference to a 8 bit descriptor
   179 	*/
   180 	IMPORT_C const TDesC8& SourceMimeType() const;
   181 	/**
   182 	   returns a global image type 
   183 	   @return const TUid an image type Uid
   184 	*/
   185 	IMPORT_C const TUid SourceImageType() const;
   186 	/**
   187 	   returns a global image subtype or KNullUid if not defined
   188 	   @return const TUid an image subtype Uid
   189 	*/
   190 	IMPORT_C const TUid SourceImageSubType() const;
   191 	/**
   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
   195 	*/
   196 	IMPORT_C TBool SourceRect(TRect& aRect) const;
   197 	/**
   198 	   returns a requested by an API client destination image size
   199 	   @return const TSize - requested image size in pixels
   200 	*/
   201 	IMPORT_C const TSize& DestinationSizeInPixels() const;
   202 	/**
   203 	   returns a requested by an API client image options e.g. combination of the TImageOptions
   204 	   @return TUint - requested image option set
   205 	*/
   206 	IMPORT_C TUint Options() const;
   207 	/**
   208 	   returns ETrue if an API client requested to preserve source image aspect ratio
   209 	   @return TBool - requested aspect ratio flag 
   210 	*/
   211 	IMPORT_C TBool MaintainAspectRatio() const;
   212 	/**
   213 	   returns a requested by an API client display mode for an image being decoded
   214 	   @return TDisplayMode - requested display mode
   215 	*/
   216 	IMPORT_C TDisplayMode DisplayMode() const;
   217 	/**
   218 	   A plug-in that supports an extension interface has to override this function 
   219 	   @param aIFaceUid
   220 				a request extension Uid
   221 	   @param aIFacePtr
   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
   224 	*/
   225 	IMPORT_C virtual TInt ExtensionInterface(TUid aIFaceUid, TAny*& aIFacePtr);
   226 	/**
   227 	   A plug-in that supports image mask getting has to override this function
   228 	   @param aBitmap
   229 				a reference to bitmap pointer
   230 	   @param aMask
   231 				a reference to bitmap pointer, a plug-in may return NULL if no mask is available
   232 	*/
   233 	IMPORT_C virtual void GetBitmap(const CFbsBitmap*& aBitmap, const CFbsBitmap*& aMask) const;
   234 	/**
   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
   237 	*/
   238 	IMPORT_C virtual TBool ValidBitmap() const;
   239 	/**
   240 	   A plug-in that supports source image status checking has to override this function
   241 	   @return TUint - set of the TImageStatus flags
   242 	*/
   243 	IMPORT_C virtual TUint ImageStatus() const;
   244 	/**
   245 	   A plug-in that supports getting of source image number of frames has to override this function
   246 	   @param aNumFrames 
   247 				Number of frames in the source image
   248 	   @return TInt - KErrNone if aNumFrames contains a valid number of frames
   249 	*/
   250 	IMPORT_C virtual TInt NumFrames(TInt& aNumFrames) const;
   251 	
   252 	// callback methods - used to pass data to the clieant throught the CImageDisplayFramework
   253 	/**
   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
   256 	*/
   257 	IMPORT_C TBool CallbackIsRunning() const;
   258 	/**
   259 	   A plug-in should use this function to pass information asinchronously to an API client. This function is asinchronous.
   260 	   @param aBitmap
   261 				a pointer to the bitmap that contains decoding result
   262 
   263 	   @param aStatus
   264 				the plugin status that should be combination of the TPluginStatus set
   265 
   266 	   @param aUpdatedArea
   267 				a rectangle within the aBitmap that was updated during the latest operation
   268 
   269 	   @param aError
   270 				error code of latest operation
   271 
   272 	*/
   273 	IMPORT_C void AsyncCallbackImageReady(const CFbsBitmap* aBitmap, TUint aStatus, const TRect& aUpdatedArea, TInt aError);
   274 
   275 	/**
   276 	 A plug-in should use this function to cancel callback to a client if it is stil pending
   277 	*/
   278 	IMPORT_C void CancelCallback();
   279 
   280 protected:
   281 	/**
   282 	An array containing the sizes of the images.
   283 	*/	
   284 	CImageDisplay::RImageSizeArray iImageSizes;
   285 
   286 private:
   287 	/**
   288 	  not for public use
   289 	*/
   290 	IMPORT_C static CImageDisplayPlugin* NewL(TUid aImplementationUid, CImageDisplayFramework& aFramework);
   291 	void ConstructL(CImageDisplayFramework& aFramework, TUid aInstanceUid);
   292 		
   293 	static TInt AsyncCbGate(TAny* aPtr);
   294 	TInt AsyncCbGate();
   295 
   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();
   304 
   305 private:
   306 	CImageDisplayFramework*		iFramework;
   307 	CImageDisplayPluginBody*	iBody;
   308 	TUid						iInstanceUid;
   309 	/**
   310 	  Future proofing not for public use
   311 	*/
   312 	TAny*	iReserved1;
   313 	};
   314 
   315 #endif // __IMAGEDISPLAYPLUGIN_H__
   316