epoc32/include/imagedisplay.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 public client API for the Image Display Library
    15 // 
    16 //
    17 
    18 #ifndef __IMAGEDISPLAY_H__
    19 #define __IMAGEDISPLAY_H__
    20 	
    21 #include <fbs.h>
    22 #include <mm/mmcaf.h>
    23 
    24 // fwd refs
    25 class CImageDisplayFramework;
    26 /**
    27 Uid value for the TDescriptorDataSource data source
    28 */
    29 const TInt KUidDescDataSourceValue=0x10207087;
    30 /**
    31 Uid for the TDescriptorDataSource data source
    32 */
    33 const TUid KUidDescDataSource={KUidDescDataSourceValue};
    34 
    35 /**
    36 	Descriptor-based image datasource.
    37 	
    38 	@publishedAll
    39 	@released
    40 */
    41 class TDescriptorDataSource: public TMMSource
    42 	{
    43 public:
    44 	IMPORT_C TDescriptorDataSource(const TPtrC8& aData);
    45 	IMPORT_C const TPtrC8& DataBuf() const;
    46    
    47 private:
    48 	TPtrC8   iData;
    49 	};
    50 
    51 
    52 /**
    53 	Observer class for image display.
    54 	
    55 	@publishedAll
    56 	@released
    57 */
    58 class MIclImageDisplayObserver
    59 	{
    60 public:
    61 	/**	
    62 		Called when the image is ready to display 
    63 	    A plug-in should use this function to pass information asynchronously to an API client. This function is asynchronous.
    64 	@param aBitmap
    65 				a pointer to the bitmap that contains decoding result (may be NULL on error condition)
    66 
    67 	@param aStatus
    68 				the plugin status that should be combination of the TPluginStatus set
    69 
    70 	@param aUpdatedArea
    71 				a rectangle within the aBitmap that was updated during the latest operation
    72 
    73 	@param aError
    74 				error code of latest operation
    75 
    76 	*/
    77 	virtual void MiidoImageReady(const CFbsBitmap* aBitmap, TUint aStatus, const TRect& aUpdatedArea, TInt aError) = 0;
    78 	};
    79 
    80 
    81 /**
    82 The public API for clients to call the Image Display library.
    83 This class provides functions to convert images stored in descriptors or
    84 files to bitmaps ready for display.
    85 
    86 @publishedAll
    87 @released
    88 */
    89 class CImageDisplay : public CBase
    90 	{
    91 public:
    92 
    93 	/**
    94 	Flags to control how the image is handled
    95 	These can be combined using an OR operation.
    96 	Note that the rotate and mirror options have
    97 	to be set together with EOptionThumbnail or 
    98 	EOptionMainImage.
    99 	*/
   100 	enum TImageOptions
   101 		{
   102 		/** No options defined */
   103 		EOptionsUndefined		= 0x00000000,
   104 		/** Use the thumbnail image as source */
   105 		EOptionThumbnail		= 0x00000001,
   106 		/** Use the main image as source */
   107 		EOptionMainImage		= 0x00000002,
   108 		/** Rotate the image by 90 degrees clockwise */
   109 		EOptionRotateCw90		= 0x00000004,
   110 		/** Rotate the image by 180 degrees clockwise */
   111 		EOptionRotateCw180		= 0x00000008,
   112 		/** Rotate the image by 270 degrees clockwise */
   113 		EOptionRotateCw270		= 0x00000010,
   114 		/** Mirror an image about the horizontal axis */
   115 		EOptionMirrorHorizontal = 0x00000020,
   116 		/** Mirror an image about the vertical axis */
   117 		EOptionMirrorVertical	= 0x00000040,
   118 		/** Rotate the image automatically (if necessary) */
   119 		EOptionAutoRotate		= 0x00000080
   120 		};
   121 
   122 	/**
   123 	Return flags from ImageStatus()
   124 	*/
   125 	enum TImageStatus
   126 		{
   127 		/** ImageStatus is unknown */
   128 		EImageTypeUnknown	= 0x00000000,	
   129 		/** Image is single frame */
   130 		EImageSingleFrame	= 0x00000001,	
   131 		/** Image is multiframe */
   132 		EImageMultiFrame	= 0x00000002,
   133 		/** Image is animated */
   134 		EImageAnimated		= 0x00000004,
   135 		/** Image has got a mask/alpha channel */
   136 		EImageMasked		= 0x00000008,
   137 		/** Image has got a thumbnail */
   138 		EImageHasThumbnail	= 0x00000010,
   139 		/** Image is fully scalable i.e. arbitrary scaling can be perofmed quite quickly */
   140 		EImageIsFullyScalable= 0x00000020
   141 		};
   142 	
   143 	/**
   144 	An array containing the sizes of images.
   145 	*/
   146 	typedef RArray<TSize> RImageSizeArray;
   147 
   148 public:
   149 	IMPORT_C static CImageDisplay* NewL(MIclImageDisplayObserver& aCallback, RFs& aFs);
   150 	IMPORT_C ~CImageDisplay();
   151 	IMPORT_C void SetPluginUid(TUid aPluginUid);
   152 	IMPORT_C TInt SetImageSource(const TMMSource& aSource);
   153 	
   154 	IMPORT_C void SetSourceMimeType(const TDesC8& aMIMEType);
   155 	IMPORT_C void SetSourceImageType(TUid aImageType, TUid aImageSubType = KNullUid);	
   156 
   157 	IMPORT_C void SetSourceRect(const TRect& aRect);
   158 	IMPORT_C void ResetSourceRect();
   159 	
   160 	IMPORT_C void SetSizeInPixels(const TSize& aSize, TBool aMaintainAspectRatio = ETrue);
   161 	IMPORT_C void SetDisplayMode(TDisplayMode aDisplayMode);
   162 
   163 	IMPORT_C TInt SetOptions(TUint aOptions);
   164 
   165 	IMPORT_C void SetupL();	
   166 
   167 	IMPORT_C void Play();
   168 	IMPORT_C void Pause();
   169 	IMPORT_C void StopPlay();
   170 	IMPORT_C void Reset();
   171 
   172 	// getters
   173 	IMPORT_C TInt ExtensionInterface(TUid aIFaceUid, TAny*& aIFacePtr);
   174 	IMPORT_C TBool ValidBitmap() const;
   175 	IMPORT_C const RImageSizeArray& RecommendedImageSizes() const;
   176 	IMPORT_C void GetBitmap(const CFbsBitmap*& aBitmap, const CFbsBitmap*& aMask) const;
   177 	IMPORT_C TUint ImageStatus() const;
   178 	IMPORT_C TInt NumFrames(TInt& aNumFrames) const;
   179 
   180 private:
   181 	CImageDisplay();
   182 	void ConstructL(MIclImageDisplayObserver& aCallback, RFs& aFs);
   183 
   184 private:
   185 	CImageDisplayFramework* iBody;
   186 	};
   187 
   188 #endif // __IMAGEDISPLAY_H__