1 // Copyright (c) 1998-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 // BC Version that uses CImageDecode/Encode objects but is essentially source
15 // compatible with the old MdaImageConverter calls
24 #ifndef __MDAIMAGECONVERTER_H__
25 #define __MDAIMAGECONVERTER_H__
29 #include <icl/imagedata.h>
30 #include <mda/common/resource.h>
31 #include <mda/client/utility.h>
32 #include <mda/common/video.h>
39 @deprecated 7.0s - Replaced by Image Conversion library - no direct equivalent
41 This class has been deprecated in 7.0s.
43 An interface to a set of image conversion utility callback functions.
45 The class is a mixin and is intended to be inherited by the client
46 classes which observe the image conversion operations. The functions
47 encapsulated by this class are called when the open, create and
48 conversion operations complete.The interface is also used by the
49 bitmap image rotator and the bitmap image re-scaler. A reference to
50 this object is passed as a parameter when constructing image
51 conversion utility, image rotator and image re-scaler objects.
55 class MMdaImageUtilObserver
60 Defines required client behaviour when a create operation has
64 A value identifying the status of the create
65 operation. KErrNone or one of the system
68 virtual void MiuoCreateComplete(TInt aError) = 0;
71 Defines required client behaviour when an open operation has
75 A value identifying the status of the create
76 operation. KErrNone or one of the system
79 virtual void MiuoOpenComplete(TInt aError) = 0;
82 Defines required client behaviour when a conversion, image rotation or
83 image re-scaling operation has completed.
86 A value identifying the status of the operation.
87 KErrNone or one of the system wide error
90 virtual void MiuoConvertComplete(TInt aError) = 0;
93 // Note: TFrameInfo is now declared via ImageClientApi - was previously here
96 class CMdaImageUtilityPriv;
100 @deprecated 7.0s - Replaced by Image Conversion library - no direct equivalent
102 Defines the public interface to image conversion.
104 This class has been deprecated in 7.0s, it's functionality is now part of the
105 Image Converter Library. For more information see CImageEncoder and CImageDecoder.
107 Clients of the concrete conversion classes call the functions provided
108 by this interface to perform the conversion. The implementation of
109 these functions is provided either by the concrete conversion classes
110 themselves or by private implementation classes.
116 class CMdaImageUtility : public CActive, private MMdaObjectStateChangeObserver
118 friend class CMdaImageUtilityPriv;
121 virtual ~CMdaImageUtility();
122 IMPORT_C virtual void Close();
125 Begins the image conversion operation for the specified frame
128 The operation is asynchronous. When the conversion operation is
129 complete, successfully or otherwise, the callback function
130 MMdaImageUtilObserver::MiuoConvertComplete() is
131 called.When converting from a file or descriptor to a bitmap, the
132 operation can complete with KErrUnderflow, if there is
133 insufficient information in the file or descriptor. Typically, this
134 occurs when using the file or descriptor as a cache. In this
135 situation, the conversion operation should be performed repeatedly
136 until the file or descriptor has accumulated enough information for
137 the operation to complete with KErrNone. As much of the
138 image as is present is converted and written to the target bitmap at
139 each call to this function.
142 A reference to a bitmap. This may be a source or a
143 target for the conversion process, depending on the
144 concrete conversion class utility being used.
146 The frame number. This value is relative to zero. For
147 those concrete conversion classes which perform
148 conversion from a bitmap, this value must always be
149 zero. For those concrete conversion classes which
150 perform conversion to a bitmap, this value must be
151 less than the number of frames in the image.
153 virtual void ConvertL(CFbsBitmap& aBitmap,TInt aFrameNumber = 0) = 0;
156 Begins the image conversion operation for the specified frame overloaded function.
158 The operation is asynchronous. When the conversion operation is complete, successfully or otherwise, the
159 callback function MMdaImageUtilObserver::MiuoConvertComplete() is called.When converting from a file or
160 descriptor to a bitmap, the operation can complete with KErrUnderflow, if there is insufficient information
161 in the file or descriptor. Typically, this occurs when using the file or descriptor as a cache. In this
162 situation, the conversion operation should be performed repeatedly until the file or descriptor has accumulated
163 enough information for the operation to complete with KErrNone. As much of the image as is present is converted
164 and written to the target bitmap at each call to this function.
167 A reference to a bitmap. This may be a source or a target for the conversion process, depending on
168 the concrete conversion class utility being used.
170 A source or target mask bitmap, if present.
172 The frame number. This value is relative to zero. For those concrete conversion classes which perform
173 conversion from a bitmap, this value must always be zero. For those concrete conversion classes which
174 perform conversion to a bitmap, this value must be less than the number of frames in the image.
176 @see CMdaImageUtility::ConvertL(CFbsBitmap& aBitmap,TInt aFrameNumber = 0)
178 virtual void ConvertL(CFbsBitmap& aBitmap,CFbsBitmap& aMaskBitmap,TInt aFrameNumber = 0) = 0;
181 Cancels the conversion operation.
183 The callback function MMdaImageUtilObserver::MiuoConvertComplete() is not called.
185 virtual void CancelConvertL() = 0;
186 IMPORT_C virtual void FrameInfo(TInt aFrame,TFrameInfo& aInfo) const;
187 IMPORT_C virtual TInt FrameCount() const;
189 // Reserved functions - do not call
190 virtual void ImageUtil_Reserved1();
191 virtual void ImageUtil_Reserved2();
192 virtual void ImageUtil_Reserved3();
193 virtual void ImageUtil_Reserved4();
199 virtual void DoClose();
200 // From MMdaObjectStateChangeObserver
201 virtual void MoscoStateChangeEvent(CBase* aObject, TInt aPreviousState, TInt aCurrentState, TInt aErrorCode);
205 void SelfComplete(TInt aError);
211 /**@internalTechnology*/
212 CMdaImageUtilityPriv* iProperties;
217 class CMdaImageDataReadUtilityPriv;
223 Base class used in the derivation of
224 CMdaImageDescToBitmapUtility and
225 CMdaImageFileToBitmapUtility.
227 It has no user accessible functions.
229 Replaced by Image Conversion library - see CImageDecoder
234 class CMdaImageDataReadUtility : public CMdaImageUtility
236 friend class CMdaImageDataReadUtilityPriv;
239 virtual ~CMdaImageDataReadUtility();
240 // From CMdaImageUtility
241 IMPORT_C virtual void ConvertL(CFbsBitmap& aBitmap,TInt aFrameNumber = 0);
242 IMPORT_C virtual void ConvertL(CFbsBitmap& aBitmap,CFbsBitmap& aMaskBitmap,TInt aFrameNumber = 0);
243 IMPORT_C virtual void CancelConvertL();
246 virtual void DoCancel();
247 IMPORT_C virtual const TDesC& FrameCommentL(TInt aFrameNumber);
249 // Reserved functions - do not call
250 virtual void ImageReadUtil_Reserved2();
251 virtual void ImageReadUtil_Reserved3();
252 virtual void ImageReadUtil_Reserved4();
254 // Creates relevant iDecoder property - depending on subclass.
255 // Called by "background" AO processing.
262 // From CMdaImageUtility
263 virtual void DoClose();
265 inline CMdaImageDataReadUtilityPriv* Properties() const;
270 class CMdaImageDataWriteUtilityPriv;
274 @deprecated 7.0s - Replaced by Image Conversion library - see CImageEncoder
276 Base class used in the derivation of CMdaImageBitmapToDescUtility and CMdaImageBitmapToFileUtility.
278 It has no user accessible functions.
282 @see CMdaImageBitmapToDescUtility
283 @see CMdaImageBitmapToFileUtility
285 class CMdaImageDataWriteUtility : public CMdaImageUtility
287 friend class CMdaImageDataWriteUtilityPriv;
290 virtual ~CMdaImageDataWriteUtility();
291 // From CMdaImageUtility
292 IMPORT_C virtual void ConvertL(CFbsBitmap& aBitmap,TInt aFrameNumber = 0);
293 IMPORT_C virtual void ConvertL(CFbsBitmap& aBitmap,const TRect& aSourceRect,TInt aFrameNumber = 0);
294 IMPORT_C virtual void ConvertL(CFbsBitmap& aBitmap,CFbsBitmap& aMaskBitmap,TInt aFrameNumber = 0);
295 IMPORT_C virtual void CancelConvertL();
298 virtual void DoCancel();
300 virtual CImageEncoder* Encoder() const;
302 // Reserved functions - do not call
303 virtual void ImageWriteUtil_Reserved1();
304 virtual void ImageWriteUtil_Reserved2();
305 virtual void ImageWriteUtil_Reserved3();
307 // Creates relevant <code>iEncoder</code> property - depending on subclass.
308 // Called by "background" AO processing.
313 void DoCreateL(TBool aFullCreate=ETrue);
314 // From CMdaImageUtility
315 virtual void DoClose();
317 inline CMdaImageDataWriteUtilityPriv* Properties() const;
321 class CMdaImageFileToBitmapUtilityPriv;
324 @deprecated 7.0s - Replaced by Image Conversion library - use CImageDecoder::FileNewL()
326 Implements format conversion of a file based image to a bitmap.
328 This class has been deprecated in 7.0s, it's functionality is now part of the Image
329 Converter Library. For more information see CImageDecoder.
331 The class provides functions to create an instance of this conversion
332 utility and to open an existing image file. Conversion is performed
333 using the image conversion utility interface.
338 class CMdaImageFileToBitmapUtility : public CMdaImageDataReadUtility
341 IMPORT_C static CMdaImageFileToBitmapUtility* NewL(MMdaImageUtilObserver& aObserver,CMdaServer* aServer = NULL);
342 IMPORT_C void OpenL(const TDesC& aFileName,TMdaClipFormat* aFormat = NULL,TMdaPackage* aCodec = NULL,TMdaPackage* aExtra = NULL);
344 inline CMdaImageFileToBitmapUtilityPriv* Properties() const;
348 class CMdaImageDescToBitmapUtilityPriv;
352 @deprecated 7.0s - Replaced by Image Conversion library - use CImageDecoder::DataNewL()
354 Implements format conversion of a descriptor-based image to a bitmap.
356 This class has been deprecated in 7.0s, it's functionality is now part of the Image Converter
357 Library. For more information see CImageDecoder.
359 The class provides functions to create an instance of this conversion
360 utility and to open and prepare the image data.Conversion is performed
361 using the image conversion utility interface.
366 class CMdaImageDescToBitmapUtility : public CMdaImageDataReadUtility
369 IMPORT_C static CMdaImageDescToBitmapUtility* NewL(MMdaImageUtilObserver& aObserver,CMdaServer* aServer = NULL);
370 IMPORT_C void OpenL(const TDesC8& aDescriptor,TMdaClipFormat* aFormat = NULL,TMdaPackage* aCodec = NULL,TMdaPackage* aExtra = NULL);
372 inline CMdaImageDescToBitmapUtilityPriv* Properties() const;
376 class CMdaImageBitmapToFileUtilityPriv;
381 Implements format conversion of a bitmap to a file-based image.
383 Replaced by Image Conversion library - use CImageEncoder::FileNewL()
385 The class provides functions to create an instance of this conversion
386 utility and to create the file. Conversion is performed using the image
387 conversion utility interface.
390 @see CImageEncoder::FileNewL()
392 class CMdaImageBitmapToFileUtility : public CMdaImageDataWriteUtility
395 IMPORT_C static CMdaImageBitmapToFileUtility* NewL(MMdaImageUtilObserver& aObserver,CMdaServer* aServer = NULL);
396 IMPORT_C void CreateL(const TDesC& aFileName,TMdaClipFormat* aFormat,TMdaPackage* aCodec,TMdaPackage* aExtra);
398 inline CMdaImageBitmapToFileUtilityPriv* Properties() const;
402 class CMdaImageBitmapToDescUtilityPriv;
408 This class has been deprecated in 7.0s, it's functionality is now part of the
409 Image Converter Library. For more information see CImageEncoder.
411 @see CImageEncoder::DataNewL
413 class CMdaImageBitmapToDescUtility : public CMdaImageDataWriteUtility
416 IMPORT_C static CMdaImageBitmapToDescUtility* NewL(MMdaImageUtilObserver& aObserver,CMdaServer* aServer = NULL);
417 IMPORT_C void CreateL(TDes8& aDescriptor,TMdaClipFormat* aFormat,TMdaPackage* aCodec,TMdaPackage* aExtra);
419 inline CMdaImageBitmapToDescUtilityPriv* Properties() const;
423 class CMdaImageBitmapToBitmapUtilityPriv;
429 Implements bitmap to bitmap copying and colour depth conversion.
431 Replaced by Image Conversion library - use CImageEncoder::FileNewL()
434 @see CImageEncoder::FileNewL()
436 class CMdaImageBitmapToBitmapUtility : public CMdaImageUtility
438 friend class CMdaImageBitmapToBitmapUtilityPriv;
441 IMPORT_C static CMdaImageBitmapToBitmapUtility* NewL(MMdaImageUtilObserver& aObserver, CMdaServer* aServer = NULL);
442 IMPORT_C ~CMdaImageBitmapToBitmapUtility();
443 IMPORT_C void OpenL(CFbsBitmap& aBitmap);
444 // from CMdaImageUtility
445 IMPORT_C virtual void ConvertL(CFbsBitmap& aBitmap, TInt aFrameNumber = 0);
446 IMPORT_C virtual void ConvertL(CFbsBitmap& aBitmap, CFbsBitmap& aMaskBitmap, TInt aFrameNumber = 0);
447 IMPORT_C virtual void CancelConvertL();
450 virtual void DoCancel();
452 // from CMdaImageUtility
453 virtual void DoClose();
455 inline CMdaImageBitmapToBitmapUtilityPriv* Properties() const;
460 class CMdaBitmapRotatorPriv;
465 Replaced by Image Conversion library - see CBitmapRotator
469 The class offers a simple interface to perform bitmap rotations in
470 clockwise 90 degree increments. The target bitmap is resized as
478 class CMdaBitmapRotator : public CBase
485 /** A clockwise rotation through 90 degrees.
487 ERotation90DegreesClockwise,
488 /** A clockwise rotation through 180 degrees.
490 ERotation180DegreesClockwise,
491 /** A clockwise rotation through 270 degrees.
493 ERotation270DegreesClockwise,
494 /** The bitmap is mirrored about the horizontal axis.
496 EMirrorFlipHorizontal,
497 /** The bitmap is mirrored about the vertical axis.
502 IMPORT_C static CMdaBitmapRotator* NewL();
503 IMPORT_C virtual ~CMdaBitmapRotator();
504 IMPORT_C void RotateL(MMdaImageUtilObserver& aObserver,CFbsBitmap& aSrcBitmap,CFbsBitmap& aTgtBitmap,TRotationAngle aAngle);
505 IMPORT_C void RotateL(MMdaImageUtilObserver& aObserver,CFbsBitmap& aBitmap,TRotationAngle aAngle);
506 IMPORT_C void CancelRotation();
508 CMdaBitmapRotatorPriv* iProperties;
512 class CMdaBitmapScalerPriv;
520 Replaced by Image Conversion library - see CBitmapScaler
522 The class offers a simple interface to perform arbitrary re-scaling of
528 class CMdaBitmapScaler : public CBase
531 IMPORT_C static CMdaBitmapScaler* NewL();
532 IMPORT_C virtual ~CMdaBitmapScaler();
533 IMPORT_C void ScaleL(MMdaImageUtilObserver& aObserver,CFbsBitmap& aSrcBitmap,CFbsBitmap& aTgtBitmap,TBool aMaintainAspectRatio = ETrue);
534 IMPORT_C void ScaleL(MMdaImageUtilObserver& aObserver,CFbsBitmap& aBitmap,TSize aDestSize,TBool aMaintainAspectRatio = ETrue);
535 IMPORT_C void CancelScaling();
537 CMdaBitmapScalerPriv* iProperties;