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.
williamr@2
     1
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     2
// All rights reserved.
williamr@2
     3
// This component and the accompanying materials are made available
williamr@4
     4
// under the terms of "Eclipse Public License v1.0"
williamr@2
     5
// which accompanies this distribution, and is available
williamr@4
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     7
//
williamr@2
     8
// Initial Contributors:
williamr@2
     9
// Nokia Corporation - initial contribution.
williamr@2
    10
//
williamr@2
    11
// Contributors:
williamr@2
    12
//
williamr@2
    13
// Description:
williamr@2
    14
// This is the plugin API for the Image Display framework
williamr@2
    15
// 
williamr@2
    16
//
williamr@2
    17
williamr@2
    18
#ifndef __IMAGEDISPLAYPLUGIN_H__
williamr@2
    19
#define __IMAGEDISPLAYPLUGIN_H__
williamr@2
    20
williamr@2
    21
#include <imagedisplay.h>
williamr@2
    22
#include <icl/imagedisplaypluginext.h>
williamr@2
    23
williamr@2
    24
// fwd ref
williamr@2
    25
class CImageDisplayFramework;
williamr@2
    26
class CImageDisplayPluginBody;
williamr@2
    27
williamr@2
    28
/**
williamr@2
    29
This is the plugin API for the Image Display framework
williamr@2
    30
Intended for use by plugin writers only.
williamr@2
    31
williamr@2
    32
@publishedAll
williamr@2
    33
@released
williamr@2
    34
*/
williamr@2
    35
class CImageDisplayPlugin : public CBase
williamr@2
    36
	{
williamr@2
    37
	friend class CImageDisplayFramework;
williamr@2
    38
	friend class CImageDisplayPluginBody;
williamr@2
    39
williamr@2
    40
public:
williamr@2
    41
	/**
williamr@2
    42
	Data source type definitions for plug-ins
williamr@2
    43
	*/
williamr@2
    44
	enum TImageSourceType 
williamr@2
    45
		{
williamr@2
    46
		/** Undefined. Plug-in won't be given this value */
williamr@2
    47
		EImgSrcNotDefined	=0,
williamr@2
    48
		/** The datasource is a file name */
williamr@2
    49
		EImgSrcFileName,
williamr@2
    50
		/** The datasource is a file handle */
williamr@2
    51
		EImgSrcFileHandle,
williamr@2
    52
		/** The datasource is a descriptor */
williamr@2
    53
		EImgSrcDescriptor,
williamr@2
    54
		};
williamr@2
    55
williamr@2
    56
	/**
williamr@2
    57
	Defines an ImageDisplay plug-in status flag values
williamr@2
    58
	*/
williamr@2
    59
	enum TPluginStatus
williamr@2
    60
		{
williamr@2
    61
		/** A plug-in has nothing more to decode; also must be set also on fatal error contidition */
williamr@2
    62
		EStatusNoMoreToDecode				=0x00000001,
williamr@2
    63
		/** The next frame is not ready yet, bitmap may contain distorted image */
williamr@2
    64
		EStatusBusy							=0x00000002,
williamr@2
    65
		/** Image decoding is paused i.e. call Play() to continue (if EStatusNoMoreToDecode is not set) */
williamr@2
    66
		EStatusPaused						=0x00000004,
williamr@2
    67
		/** The next frame has been already decoded*/
williamr@2
    68
		EStatusFrameReady					=0x00000008,
williamr@2
    69
		/** May be set after image decode completion i.e. when EStatusNoMoreToDecode is set */
williamr@2
    70
		EStatusDisplayThisFrameIndefinetely	=0x00000010,
williamr@2
    71
		/** May be set if the image format supports progressive decoding; indicates that a bitmap contains roughtly decoded image */
williamr@2
    72
		EStatusPartialFrame                	=0x00000020,
williamr@2
    73
		/** May be set in case when a plug-in asks to invalidate previous frame contents */
williamr@2
    74
		EStatusEraseOutputContents         	=0x00000040,
williamr@2
    75
		};
williamr@2
    76
	/**
williamr@2
    77
		Virtual destructor. Current implementation will call the REComSession::DestroyedImplementation() to finalize destruction
williamr@2
    78
		of the ECom plugin
williamr@2
    79
	*/
williamr@2
    80
	IMPORT_C ~CImageDisplayPlugin();
williamr@2
    81
williamr@2
    82
protected:
williamr@2
    83
	/**
williamr@2
    84
	Initialise the plugin and check the image display settings.
williamr@2
    85
williamr@2
    86
	This is called by the ImageDisplay framework when the client app calls
williamr@2
    87
	CImageDisplay::SetupL(). 
williamr@2
    88
	
williamr@2
    89
	The plugin should check the validity of the source image and all other settings
williamr@2
    90
	set by the client API. If any of these is unsupported then it should leave with 
williamr@2
    91
	KErrArgument
williamr@2
    92
williamr@2
    93
	A plugin implementing CImageDisplayPluginExtension to allow extension of the 
williamr@2
    94
	client API should initialise it here.
williamr@2
    95
williamr@2
    96
	This is a virtual function that each individual plugin must implement.
williamr@2
    97
williamr@2
    98
	@leave  KErrArgument
williamr@2
    99
	Some of the configuration parameters are invalid
williamr@2
   100
	*/
williamr@2
   101
	virtual void OpenL() = 0;
williamr@2
   102
williamr@2
   103
	/**
williamr@2
   104
	Initiate the image display operation
williamr@2
   105
williamr@2
   106
	This is a virtual function that each individual plugin must implement.
williamr@2
   107
williamr@2
   108
	*/
williamr@2
   109
	virtual void Play() = 0;
williamr@2
   110
williamr@2
   111
	/**
williamr@2
   112
	Pause image decoding
williamr@2
   113
williamr@2
   114
	This is a virtual function that each individual plugin must implement.
williamr@2
   115
	*/
williamr@2
   116
	virtual void Pause() = 0;
williamr@2
   117
williamr@2
   118
	/**
williamr@2
   119
	Cancel the image display operation
williamr@2
   120
	May be called by the framework even when there is no outstanding request.
williamr@2
   121
williamr@2
   122
	This is a virtual function that each individual plugin must implement.
williamr@2
   123
	*/
williamr@2
   124
	virtual void StopPlay() = 0;
williamr@2
   125
williamr@2
   126
	/**
williamr@2
   127
	Should return an array of recommended image sizes i.e. sizes which would be processed faster 
williamr@2
   128
	@return a reference to the array of recommended image sizes
williamr@2
   129
williamr@2
   130
	This is a virtual function that each individual plugin must implement.
williamr@2
   131
	*/	
williamr@2
   132
	virtual const CImageDisplay::RImageSizeArray& RecommendedImageSizes() const=0;
williamr@2
   133
	
williamr@2
   134
	/**
williamr@2
   135
		Exported default constructor
williamr@2
   136
	*/
williamr@2
   137
	IMPORT_C CImageDisplayPlugin();
williamr@2
   138
williamr@2
   139
	// getters
williamr@2
   140
	/**
williamr@2
   141
	   returns an image datasource type
williamr@2
   142
	   @return TImageSourceType 
williamr@2
   143
	*/
williamr@2
   144
	IMPORT_C TImageSourceType SourceType() const;
williamr@2
   145
	/**
williamr@2
   146
	   returns an image source file name
williamr@2
   147
	   @return const TDesC& a reference to read-only descriptor
williamr@2
   148
	   @panic ImageDisplay 4 EImageWrongType if image data source is of type other than the file name
williamr@2
   149
	*/
williamr@2
   150
	IMPORT_C const TDesC& SourceFilename() const;
williamr@2
   151
	/**
williamr@2
   152
	   returns an image source file handle
williamr@2
   153
	   @return const RFile& a reference to a file handle 
williamr@2
   154
	   @panic ImageDisplay 4 EImageWrongType if image data source is of type other than the file handle
williamr@2
   155
	*/
williamr@2
   156
	IMPORT_C RFile& SourceFileHandle() const;
williamr@2
   157
	/**
williamr@2
   158
	   returns an image source descriptor
williamr@2
   159
	   @return const TDesC8& a reference to a 8 bit descriptor
williamr@2
   160
	   @panic ImageDisplay 4 EImageWrongType if image data source is of type other than the descriptor
williamr@2
   161
	*/
williamr@2
   162
	IMPORT_C const TDesC8& SourceData() const;
williamr@2
   163
williamr@2
   164
	/**
williamr@2
   165
	   returns an intent that is requested by client for opening the image source
williamr@2
   166
	   @return ContentAccess::TIntent a desired intent value
williamr@2
   167
	*/
williamr@2
   168
	IMPORT_C ContentAccess::TIntent SourceDataIntent() const;
williamr@2
   169
williamr@2
   170
	/**
williamr@2
   171
	   returns requested content data Id that should be used to open content
williamr@2
   172
	   @return const TDesC& a desired data unique Id
williamr@2
   173
	*/
williamr@4
   174
	IMPORT_C const TDesC& SourceDataId() const;
williamr@2
   175
williamr@2
   176
	/**
williamr@2
   177
	   returns an image source MIME type or KNullDesC8 if not defined
williamr@2
   178
	   @return const TDesC8& a reference to a 8 bit descriptor
williamr@2
   179
	*/
williamr@2
   180
	IMPORT_C const TDesC8& SourceMimeType() const;
williamr@2
   181
	/**
williamr@2
   182
	   returns a global image type 
williamr@2
   183
	   @return const TUid an image type Uid
williamr@2
   184
	*/
williamr@2
   185
	IMPORT_C const TUid SourceImageType() const;
williamr@2
   186
	/**
williamr@2
   187
	   returns a global image subtype or KNullUid if not defined
williamr@2
   188
	   @return const TUid an image subtype Uid
williamr@2
   189
	*/
williamr@2
   190
	IMPORT_C const TUid SourceImageSubType() const;
williamr@2
   191
	/**
williamr@2
   192
	   returns a requested by an API client source clipping rect
williamr@2
   193
	   @param aRect a reference to source clipping rect which is valid only if return value is ETrue
williamr@2
   194
	   @return ETrue if clipping rect was defined by client
williamr@2
   195
	*/
williamr@2
   196
	IMPORT_C TBool SourceRect(TRect& aRect) const;
williamr@2
   197
	/**
williamr@2
   198
	   returns a requested by an API client destination image size
williamr@2
   199
	   @return const TSize - requested image size in pixels
williamr@2
   200
	*/
williamr@2
   201
	IMPORT_C const TSize& DestinationSizeInPixels() const;
williamr@2
   202
	/**
williamr@2
   203
	   returns a requested by an API client image options e.g. combination of the TImageOptions
williamr@2
   204
	   @return TUint - requested image option set
williamr@2
   205
	*/
williamr@2
   206
	IMPORT_C TUint Options() const;
williamr@2
   207
	/**
williamr@2
   208
	   returns ETrue if an API client requested to preserve source image aspect ratio
williamr@2
   209
	   @return TBool - requested aspect ratio flag 
williamr@2
   210
	*/
williamr@2
   211
	IMPORT_C TBool MaintainAspectRatio() const;
williamr@2
   212
	/**
williamr@2
   213
	   returns a requested by an API client display mode for an image being decoded
williamr@2
   214
	   @return TDisplayMode - requested display mode
williamr@2
   215
	*/
williamr@2
   216
	IMPORT_C TDisplayMode DisplayMode() const;
williamr@2
   217
	/**
williamr@2
   218
	   A plug-in that supports an extension interface has to override this function 
williamr@2
   219
	   @param aIFaceUid
williamr@2
   220
				a request extension Uid
williamr@2
   221
	   @param aIFacePtr
williamr@2
   222
				a reference to the pointer that should be given extension interface pointer on success
williamr@2
   223
	   @return KErrNotSupported if requested extension is not supported otherwise KErrNone
williamr@2
   224
	*/
williamr@2
   225
	IMPORT_C virtual TInt ExtensionInterface(TUid aIFaceUid, TAny*& aIFacePtr);
williamr@2
   226
	/**
williamr@2
   227
	   A plug-in that supports image mask getting has to override this function
williamr@2
   228
	   @param aBitmap
williamr@2
   229
				a reference to bitmap pointer
williamr@2
   230
	   @param aMask
williamr@2
   231
				a reference to bitmap pointer, a plug-in may return NULL if no mask is available
williamr@2
   232
	*/
williamr@2
   233
	IMPORT_C virtual void GetBitmap(const CFbsBitmap*& aBitmap, const CFbsBitmap*& aMask) const;
williamr@2
   234
	/**
williamr@2
   235
	   A plug-in that supports target bitmap status checkig has to override this function 
williamr@2
   236
	   @return TBool - ETrue if subsequent call to the GetBitmap() able to return valid bitmaps
williamr@2
   237
	*/
williamr@2
   238
	IMPORT_C virtual TBool ValidBitmap() const;
williamr@2
   239
	/**
williamr@2
   240
	   A plug-in that supports source image status checking has to override this function
williamr@2
   241
	   @return TUint - set of the TImageStatus flags
williamr@2
   242
	*/
williamr@2
   243
	IMPORT_C virtual TUint ImageStatus() const;
williamr@2
   244
	/**
williamr@2
   245
	   A plug-in that supports getting of source image number of frames has to override this function
williamr@2
   246
	   @param aNumFrames 
williamr@2
   247
				Number of frames in the source image
williamr@2
   248
	   @return TInt - KErrNone if aNumFrames contains a valid number of frames
williamr@2
   249
	*/
williamr@2
   250
	IMPORT_C virtual TInt NumFrames(TInt& aNumFrames) const;
williamr@2
   251
	
williamr@2
   252
	// callback methods - used to pass data to the clieant throught the CImageDisplayFramework
williamr@2
   253
	/**
williamr@2
   254
	   A plug-in may use this function to determine if a previuos callback function to an API client has been completed
williamr@2
   255
	   @return ETrue if callback has not been completed yet
williamr@2
   256
	*/
williamr@2
   257
	IMPORT_C TBool CallbackIsRunning() const;
williamr@2
   258
	/**
williamr@2
   259
	   A plug-in should use this function to pass information asinchronously to an API client. This function is asinchronous.
williamr@2
   260
	   @param aBitmap
williamr@2
   261
				a pointer to the bitmap that contains decoding result
williamr@2
   262
williamr@2
   263
	   @param aStatus
williamr@2
   264
				the plugin status that should be combination of the TPluginStatus set
williamr@2
   265
williamr@2
   266
	   @param aUpdatedArea
williamr@2
   267
				a rectangle within the aBitmap that was updated during the latest operation
williamr@2
   268
williamr@2
   269
	   @param aError
williamr@2
   270
				error code of latest operation
williamr@2
   271
williamr@2
   272
	*/
williamr@2
   273
	IMPORT_C void AsyncCallbackImageReady(const CFbsBitmap* aBitmap, TUint aStatus, const TRect& aUpdatedArea, TInt aError);
williamr@2
   274
williamr@2
   275
	/**
williamr@2
   276
	 A plug-in should use this function to cancel callback to a client if it is stil pending
williamr@2
   277
	*/
williamr@2
   278
	IMPORT_C void CancelCallback();
williamr@2
   279
williamr@2
   280
protected:
williamr@2
   281
	/**
williamr@2
   282
	An array containing the sizes of the images.
williamr@2
   283
	*/	
williamr@2
   284
	CImageDisplay::RImageSizeArray iImageSizes;
williamr@2
   285
williamr@2
   286
private:
williamr@2
   287
	/**
williamr@2
   288
	  not for public use
williamr@2
   289
	*/
williamr@2
   290
	IMPORT_C static CImageDisplayPlugin* NewL(TUid aImplementationUid, CImageDisplayFramework& aFramework);
williamr@2
   291
	void ConstructL(CImageDisplayFramework& aFramework, TUid aInstanceUid);
williamr@2
   292
		
williamr@2
   293
	static TInt AsyncCbGate(TAny* aPtr);
williamr@2
   294
	TInt AsyncCbGate();
williamr@2
   295
williamr@2
   296
	/** Reserved. Not for public use */
williamr@2
   297
	IMPORT_C virtual void ReservedVirtual1();
williamr@2
   298
	/** Reserved. Not for public use */
williamr@2
   299
	IMPORT_C virtual void ReservedVirtual2();
williamr@2
   300
	/** Reserved. Not for public use */
williamr@2
   301
	IMPORT_C virtual void ReservedVirtual3();
williamr@2
   302
	/** Reserved. Not for public use */
williamr@2
   303
	IMPORT_C virtual void ReservedVirtual4();
williamr@2
   304
williamr@2
   305
private:
williamr@2
   306
	CImageDisplayFramework*		iFramework;
williamr@2
   307
	CImageDisplayPluginBody*	iBody;
williamr@2
   308
	TUid						iInstanceUid;
williamr@2
   309
	/**
williamr@2
   310
	  Future proofing not for public use
williamr@2
   311
	*/
williamr@2
   312
	TAny*	iReserved1;
williamr@2
   313
	};
williamr@2
   314
williamr@2
   315
#endif // __IMAGEDISPLAYPLUGIN_H__
williamr@4
   316