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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // This is the public client API for the Image Display Library
18 #ifndef __IMAGEDISPLAY_H__
19 #define __IMAGEDISPLAY_H__
25 class CImageDisplayFramework;
27 Uid value for the TDescriptorDataSource data source
29 const TInt KUidDescDataSourceValue=0x10207087;
31 Uid for the TDescriptorDataSource data source
33 const TUid KUidDescDataSource={KUidDescDataSourceValue};
36 Descriptor-based image datasource.
41 class TDescriptorDataSource: public TMMSource
44 IMPORT_C TDescriptorDataSource(const TPtrC8& aData);
45 IMPORT_C const TPtrC8& DataBuf() const;
53 Observer class for image display.
58 class MIclImageDisplayObserver
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.
65 a pointer to the bitmap that contains decoding result (may be NULL on error condition)
68 the plugin status that should be combination of the TPluginStatus set
71 a rectangle within the aBitmap that was updated during the latest operation
74 error code of latest operation
77 virtual void MiidoImageReady(const CFbsBitmap* aBitmap, TUint aStatus, const TRect& aUpdatedArea, TInt aError) = 0;
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.
89 class CImageDisplay : public CBase
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
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
123 Return flags from ImageStatus()
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
144 An array containing the sizes of images.
146 typedef RArray<TSize> RImageSizeArray;
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);
154 IMPORT_C void SetSourceMimeType(const TDesC8& aMIMEType);
155 IMPORT_C void SetSourceImageType(TUid aImageType, TUid aImageSubType = KNullUid);
157 IMPORT_C void SetSourceRect(const TRect& aRect);
158 IMPORT_C void ResetSourceRect();
160 IMPORT_C void SetSizeInPixels(const TSize& aSize, TBool aMaintainAspectRatio = ETrue);
161 IMPORT_C void SetDisplayMode(TDisplayMode aDisplayMode);
163 IMPORT_C TInt SetOptions(TUint aOptions);
165 IMPORT_C void SetupL();
167 IMPORT_C void Play();
168 IMPORT_C void Pause();
169 IMPORT_C void StopPlay();
170 IMPORT_C void Reset();
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;
182 void ConstructL(MIclImageDisplayObserver& aCallback, RFs& aFs);
185 CImageDisplayFramework* iBody;
188 #endif // __IMAGEDISPLAY_H__