1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/imagedisplay.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -0,0 +1,188 @@
1.4 +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// 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
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// This is the public client API for the Image Display Library
1.18 +//
1.19 +//
1.20 +
1.21 +#ifndef __IMAGEDISPLAY_H__
1.22 +#define __IMAGEDISPLAY_H__
1.23 +
1.24 +#include <fbs.h>
1.25 +#include <mm/mmcaf.h>
1.26 +
1.27 +// fwd refs
1.28 +class CImageDisplayFramework;
1.29 +/**
1.30 +Uid value for the TDescriptorDataSource data source
1.31 +*/
1.32 +const TInt KUidDescDataSourceValue=0x10207087;
1.33 +/**
1.34 +Uid for the TDescriptorDataSource data source
1.35 +*/
1.36 +const TUid KUidDescDataSource={KUidDescDataSourceValue};
1.37 +
1.38 +/**
1.39 + Descriptor-based image datasource.
1.40 +
1.41 + @publishedAll
1.42 + @released
1.43 +*/
1.44 +class TDescriptorDataSource: public TMMSource
1.45 + {
1.46 +public:
1.47 + IMPORT_C TDescriptorDataSource(const TPtrC8& aData);
1.48 + IMPORT_C const TPtrC8& DataBuf() const;
1.49 +
1.50 +private:
1.51 + TPtrC8 iData;
1.52 + };
1.53 +
1.54 +
1.55 +/**
1.56 + Observer class for image display.
1.57 +
1.58 + @publishedAll
1.59 + @released
1.60 +*/
1.61 +class MIclImageDisplayObserver
1.62 + {
1.63 +public:
1.64 + /**
1.65 + Called when the image is ready to display
1.66 + A plug-in should use this function to pass information asynchronously to an API client. This function is asynchronous.
1.67 + @param aBitmap
1.68 + a pointer to the bitmap that contains decoding result (may be NULL on error condition)
1.69 +
1.70 + @param aStatus
1.71 + the plugin status that should be combination of the TPluginStatus set
1.72 +
1.73 + @param aUpdatedArea
1.74 + a rectangle within the aBitmap that was updated during the latest operation
1.75 +
1.76 + @param aError
1.77 + error code of latest operation
1.78 +
1.79 + */
1.80 + virtual void MiidoImageReady(const CFbsBitmap* aBitmap, TUint aStatus, const TRect& aUpdatedArea, TInt aError) = 0;
1.81 + };
1.82 +
1.83 +
1.84 +/**
1.85 +The public API for clients to call the Image Display library.
1.86 +This class provides functions to convert images stored in descriptors or
1.87 +files to bitmaps ready for display.
1.88 +
1.89 +@publishedAll
1.90 +@released
1.91 +*/
1.92 +class CImageDisplay : public CBase
1.93 + {
1.94 +public:
1.95 +
1.96 + /**
1.97 + Flags to control how the image is handled
1.98 + These can be combined using an OR operation.
1.99 + Note that the rotate and mirror options have
1.100 + to be set together with EOptionThumbnail or
1.101 + EOptionMainImage.
1.102 + */
1.103 + enum TImageOptions
1.104 + {
1.105 + /** No options defined */
1.106 + EOptionsUndefined = 0x00000000,
1.107 + /** Use the thumbnail image as source */
1.108 + EOptionThumbnail = 0x00000001,
1.109 + /** Use the main image as source */
1.110 + EOptionMainImage = 0x00000002,
1.111 + /** Rotate the image by 90 degrees clockwise */
1.112 + EOptionRotateCw90 = 0x00000004,
1.113 + /** Rotate the image by 180 degrees clockwise */
1.114 + EOptionRotateCw180 = 0x00000008,
1.115 + /** Rotate the image by 270 degrees clockwise */
1.116 + EOptionRotateCw270 = 0x00000010,
1.117 + /** Mirror an image about the horizontal axis */
1.118 + EOptionMirrorHorizontal = 0x00000020,
1.119 + /** Mirror an image about the vertical axis */
1.120 + EOptionMirrorVertical = 0x00000040,
1.121 + /** Rotate the image automatically (if necessary) */
1.122 + EOptionAutoRotate = 0x00000080
1.123 + };
1.124 +
1.125 + /**
1.126 + Return flags from ImageStatus()
1.127 + */
1.128 + enum TImageStatus
1.129 + {
1.130 + /** ImageStatus is unknown */
1.131 + EImageTypeUnknown = 0x00000000,
1.132 + /** Image is single frame */
1.133 + EImageSingleFrame = 0x00000001,
1.134 + /** Image is multiframe */
1.135 + EImageMultiFrame = 0x00000002,
1.136 + /** Image is animated */
1.137 + EImageAnimated = 0x00000004,
1.138 + /** Image has got a mask/alpha channel */
1.139 + EImageMasked = 0x00000008,
1.140 + /** Image has got a thumbnail */
1.141 + EImageHasThumbnail = 0x00000010,
1.142 + /** Image is fully scalable i.e. arbitrary scaling can be perofmed quite quickly */
1.143 + EImageIsFullyScalable= 0x00000020
1.144 + };
1.145 +
1.146 + /**
1.147 + An array containing the sizes of images.
1.148 + */
1.149 + typedef RArray<TSize> RImageSizeArray;
1.150 +
1.151 +public:
1.152 + IMPORT_C static CImageDisplay* NewL(MIclImageDisplayObserver& aCallback, RFs& aFs);
1.153 + IMPORT_C ~CImageDisplay();
1.154 + IMPORT_C void SetPluginUid(TUid aPluginUid);
1.155 + IMPORT_C TInt SetImageSource(const TMMSource& aSource);
1.156 +
1.157 + IMPORT_C void SetSourceMimeType(const TDesC8& aMIMEType);
1.158 + IMPORT_C void SetSourceImageType(TUid aImageType, TUid aImageSubType = KNullUid);
1.159 +
1.160 + IMPORT_C void SetSourceRect(const TRect& aRect);
1.161 + IMPORT_C void ResetSourceRect();
1.162 +
1.163 + IMPORT_C void SetSizeInPixels(const TSize& aSize, TBool aMaintainAspectRatio = ETrue);
1.164 + IMPORT_C void SetDisplayMode(TDisplayMode aDisplayMode);
1.165 +
1.166 + IMPORT_C TInt SetOptions(TUint aOptions);
1.167 +
1.168 + IMPORT_C void SetupL();
1.169 +
1.170 + IMPORT_C void Play();
1.171 + IMPORT_C void Pause();
1.172 + IMPORT_C void StopPlay();
1.173 + IMPORT_C void Reset();
1.174 +
1.175 + // getters
1.176 + IMPORT_C TInt ExtensionInterface(TUid aIFaceUid, TAny*& aIFacePtr);
1.177 + IMPORT_C TBool ValidBitmap() const;
1.178 + IMPORT_C const RImageSizeArray& RecommendedImageSizes() const;
1.179 + IMPORT_C void GetBitmap(const CFbsBitmap*& aBitmap, const CFbsBitmap*& aMask) const;
1.180 + IMPORT_C TUint ImageStatus() const;
1.181 + IMPORT_C TInt NumFrames(TInt& aNumFrames) const;
1.182 +
1.183 +private:
1.184 + CImageDisplay();
1.185 + void ConstructL(MIclImageDisplayObserver& aCallback, RFs& aFs);
1.186 +
1.187 +private:
1.188 + CImageDisplayFramework* iBody;
1.189 + };
1.190 +
1.191 +#endif // __IMAGEDISPLAY_H__