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