williamr@4: // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@4: // under the terms of "Eclipse Public License v1.0" williamr@2: // which accompanies this distribution, and is available williamr@4: // at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // BC Version that uses CImageDecode/Encode objects but is essentially source williamr@2: // compatible with the old MdaImageConverter calls williamr@2: // williamr@4: // williamr@4: williamr@2: /** williamr@2: @file williamr@2: @deprecated williamr@2: */ williamr@2: williamr@2: #ifndef __MDAIMAGECONVERTER_H__ williamr@2: #define __MDAIMAGECONVERTER_H__ williamr@2: williamr@2: #include williamr@2: williamr@2: #include williamr@4: #include williamr@2: #include williamr@2: #include williamr@2: williamr@2: class CMdaServer; williamr@2: class REComSession; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @deprecated 7.0s - Replaced by Image Conversion library - no direct equivalent williamr@2: williamr@2: This class has been deprecated in 7.0s. williamr@2: williamr@2: An interface to a set of image conversion utility callback functions. williamr@2: williamr@2: The class is a mixin and is intended to be inherited by the client williamr@2: classes which observe the image conversion operations. The functions williamr@2: encapsulated by this class are called when the open, create and williamr@2: conversion operations complete.The interface is also used by the williamr@2: bitmap image rotator and the bitmap image re-scaler. A reference to williamr@2: this object is passed as a parameter when constructing image williamr@2: conversion utility, image rotator and image re-scaler objects. williamr@2: williamr@2: @since 5.0 williamr@2: */ williamr@2: class MMdaImageUtilObserver williamr@2: { williamr@2: public: williamr@2: williamr@2: /** williamr@2: Defines required client behaviour when a create operation has williamr@2: completed. williamr@2: williamr@2: @param aError williamr@2: A value identifying the status of the create williamr@2: operation. KErrNone or one of the system williamr@2: wide error codes. williamr@2: */ williamr@2: virtual void MiuoCreateComplete(TInt aError) = 0; williamr@2: williamr@2: /** williamr@2: Defines required client behaviour when an open operation has williamr@2: completed. williamr@2: williamr@2: @param aError williamr@2: A value identifying the status of the create williamr@2: operation. KErrNone or one of the system williamr@2: wide error codes. williamr@2: */ williamr@2: virtual void MiuoOpenComplete(TInt aError) = 0; williamr@2: williamr@2: /** williamr@2: Defines required client behaviour when a conversion, image rotation or williamr@2: image re-scaling operation has completed. williamr@2: williamr@2: @param aError williamr@2: A value identifying the status of the operation. williamr@2: KErrNone or one of the system wide error williamr@2: codes. williamr@2: */ williamr@2: virtual void MiuoConvertComplete(TInt aError) = 0; williamr@2: }; williamr@2: williamr@2: // Note: TFrameInfo is now declared via ImageClientApi - was previously here williamr@2: williamr@2: williamr@2: class CMdaImageUtilityPriv; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @deprecated 7.0s - Replaced by Image Conversion library - no direct equivalent williamr@2: williamr@2: Defines the public interface to image conversion. williamr@2: williamr@2: This class has been deprecated in 7.0s, it's functionality is now part of the williamr@2: Image Converter Library. For more information see CImageEncoder and CImageDecoder. williamr@2: williamr@2: Clients of the concrete conversion classes call the functions provided williamr@2: by this interface to perform the conversion. The implementation of williamr@2: these functions is provided either by the concrete conversion classes williamr@2: themselves or by private implementation classes. williamr@2: williamr@2: @since 5.0 williamr@2: @see CImageEncoder williamr@2: @see CImageDecoder williamr@2: */ williamr@2: class CMdaImageUtility : public CActive, private MMdaObjectStateChangeObserver williamr@2: { williamr@2: friend class CMdaImageUtilityPriv; williamr@2: williamr@2: public: williamr@2: virtual ~CMdaImageUtility(); williamr@2: IMPORT_C virtual void Close(); williamr@2: williamr@2: /** williamr@2: Begins the image conversion operation for the specified frame williamr@2: overloaded function. williamr@2: williamr@2: The operation is asynchronous. When the conversion operation is williamr@2: complete, successfully or otherwise, the callback function williamr@2: MMdaImageUtilObserver::MiuoConvertComplete() is williamr@2: called.When converting from a file or descriptor to a bitmap, the williamr@2: operation can complete with KErrUnderflow, if there is williamr@2: insufficient information in the file or descriptor. Typically, this williamr@2: occurs when using the file or descriptor as a cache. In this williamr@2: situation, the conversion operation should be performed repeatedly williamr@2: until the file or descriptor has accumulated enough information for williamr@2: the operation to complete with KErrNone. As much of the williamr@2: image as is present is converted and written to the target bitmap at williamr@2: each call to this function. williamr@2: williamr@2: @param aBitmap williamr@2: A reference to a bitmap. This may be a source or a williamr@2: target for the conversion process, depending on the williamr@2: concrete conversion class utility being used. williamr@2: @param aFrameNumber williamr@2: The frame number. This value is relative to zero. For williamr@2: those concrete conversion classes which perform williamr@2: conversion from a bitmap, this value must always be williamr@2: zero. For those concrete conversion classes which williamr@2: perform conversion to a bitmap, this value must be williamr@2: less than the number of frames in the image. williamr@2: */ williamr@2: virtual void ConvertL(CFbsBitmap& aBitmap,TInt aFrameNumber = 0) = 0; williamr@2: williamr@2: /** williamr@2: Begins the image conversion operation for the specified frame overloaded function. williamr@2: williamr@2: The operation is asynchronous. When the conversion operation is complete, successfully or otherwise, the williamr@2: callback function MMdaImageUtilObserver::MiuoConvertComplete() is called.When converting from a file or williamr@2: descriptor to a bitmap, the operation can complete with KErrUnderflow, if there is insufficient information williamr@2: in the file or descriptor. Typically, this occurs when using the file or descriptor as a cache. In this williamr@2: situation, the conversion operation should be performed repeatedly until the file or descriptor has accumulated williamr@2: enough information for the operation to complete with KErrNone. As much of the image as is present is converted williamr@2: and written to the target bitmap at each call to this function. williamr@2: williamr@2: @param aBitmap williamr@2: A reference to a bitmap. This may be a source or a target for the conversion process, depending on williamr@2: the concrete conversion class utility being used. williamr@2: @param aMaskBitmap williamr@2: A source or target mask bitmap, if present. williamr@2: @param aFrameNumber williamr@2: The frame number. This value is relative to zero. For those concrete conversion classes which perform williamr@2: conversion from a bitmap, this value must always be zero. For those concrete conversion classes which williamr@2: perform conversion to a bitmap, this value must be less than the number of frames in the image. williamr@2: williamr@2: @see CMdaImageUtility::ConvertL(CFbsBitmap& aBitmap,TInt aFrameNumber = 0) williamr@2: */ williamr@2: virtual void ConvertL(CFbsBitmap& aBitmap,CFbsBitmap& aMaskBitmap,TInt aFrameNumber = 0) = 0; williamr@2: williamr@2: /** williamr@2: Cancels the conversion operation. williamr@2: williamr@2: The callback function MMdaImageUtilObserver::MiuoConvertComplete() is not called. williamr@2: */ williamr@2: virtual void CancelConvertL() = 0; williamr@2: IMPORT_C virtual void FrameInfo(TInt aFrame,TFrameInfo& aInfo) const; williamr@2: IMPORT_C virtual TInt FrameCount() const; williamr@2: public: williamr@2: // Reserved functions - do not call williamr@2: virtual void ImageUtil_Reserved1(); williamr@2: virtual void ImageUtil_Reserved2(); williamr@2: virtual void ImageUtil_Reserved3(); williamr@2: virtual void ImageUtil_Reserved4(); williamr@2: protected: williamr@2: /** williamr@2: @internalComponent williamr@2: */ williamr@2: CMdaImageUtility(); williamr@2: virtual void DoClose(); williamr@2: // From MMdaObjectStateChangeObserver williamr@2: virtual void MoscoStateChangeEvent(CBase* aObject, TInt aPreviousState, TInt aCurrentState, TInt aErrorCode); williamr@2: /** williamr@2: @internalComponent williamr@2: */ williamr@2: void SelfComplete(TInt aError); williamr@2: /** williamr@2: @internalComponent williamr@2: */ williamr@2: void DoCancel(); williamr@2: protected: williamr@2: /**@internalTechnology*/ williamr@2: CMdaImageUtilityPriv* iProperties; williamr@2: }; williamr@2: williamr@2: williamr@2: class CImageDecoder; williamr@2: class CMdaImageDataReadUtilityPriv; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @deprecated williamr@2: williamr@2: Base class used in the derivation of williamr@2: CMdaImageDescToBitmapUtility and williamr@2: CMdaImageFileToBitmapUtility. williamr@2: williamr@2: It has no user accessible functions. williamr@2: williamr@2: Replaced by Image Conversion library - see CImageDecoder williamr@2: williamr@2: @since 6.0 williamr@2: @see CImageDecoder williamr@2: */ williamr@2: class CMdaImageDataReadUtility : public CMdaImageUtility williamr@2: { williamr@2: friend class CMdaImageDataReadUtilityPriv; williamr@2: williamr@2: public: williamr@2: virtual ~CMdaImageDataReadUtility(); williamr@2: // From CMdaImageUtility williamr@2: IMPORT_C virtual void ConvertL(CFbsBitmap& aBitmap,TInt aFrameNumber = 0); williamr@2: IMPORT_C virtual void ConvertL(CFbsBitmap& aBitmap,CFbsBitmap& aMaskBitmap,TInt aFrameNumber = 0); williamr@2: IMPORT_C virtual void CancelConvertL(); williamr@2: // from CActive williamr@2: virtual void RunL(); williamr@2: virtual void DoCancel(); williamr@2: IMPORT_C virtual const TDesC& FrameCommentL(TInt aFrameNumber); williamr@2: public: williamr@2: // Reserved functions - do not call williamr@2: virtual void ImageReadUtil_Reserved2(); williamr@2: virtual void ImageReadUtil_Reserved3(); williamr@2: virtual void ImageReadUtil_Reserved4(); williamr@2: protected: williamr@2: // Creates relevant iDecoder property - depending on subclass. williamr@2: // Called by "background" AO processing. williamr@4: williamr@2: /** williamr@2: @internalComponent williamr@2: */ williamr@2: void DoOpenL(); williamr@4: williamr@2: // From CMdaImageUtility williamr@2: virtual void DoClose(); williamr@2: private: williamr@2: inline CMdaImageDataReadUtilityPriv* Properties() const; williamr@2: }; williamr@2: williamr@2: williamr@2: class CImageEncoder; williamr@2: class CMdaImageDataWriteUtilityPriv; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @deprecated 7.0s - Replaced by Image Conversion library - see CImageEncoder williamr@2: williamr@2: Base class used in the derivation of CMdaImageBitmapToDescUtility and CMdaImageBitmapToFileUtility. williamr@2: williamr@2: It has no user accessible functions. williamr@2: williamr@2: @since 6.0 williamr@2: williamr@2: @see CMdaImageBitmapToDescUtility williamr@2: @see CMdaImageBitmapToFileUtility williamr@2: */ williamr@2: class CMdaImageDataWriteUtility : public CMdaImageUtility williamr@2: { williamr@2: friend class CMdaImageDataWriteUtilityPriv; williamr@2: williamr@2: public: williamr@2: virtual ~CMdaImageDataWriteUtility(); williamr@2: // From CMdaImageUtility williamr@2: IMPORT_C virtual void ConvertL(CFbsBitmap& aBitmap,TInt aFrameNumber = 0); williamr@2: IMPORT_C virtual void ConvertL(CFbsBitmap& aBitmap,const TRect& aSourceRect,TInt aFrameNumber = 0); williamr@2: IMPORT_C virtual void ConvertL(CFbsBitmap& aBitmap,CFbsBitmap& aMaskBitmap,TInt aFrameNumber = 0); williamr@2: IMPORT_C virtual void CancelConvertL(); williamr@2: protected: williamr@2: virtual void RunL(); williamr@2: virtual void DoCancel(); williamr@2: protected: williamr@2: virtual CImageEncoder* Encoder() const; williamr@2: public: williamr@2: // Reserved functions - do not call williamr@2: virtual void ImageWriteUtil_Reserved1(); williamr@2: virtual void ImageWriteUtil_Reserved2(); williamr@2: virtual void ImageWriteUtil_Reserved3(); williamr@2: protected: williamr@2: // Creates relevant iEncoder property - depending on subclass. williamr@2: // Called by "background" AO processing. williamr@4: williamr@2: /** williamr@2: @internalComponent williamr@2: */ williamr@2: void DoCreateL(TBool aFullCreate=ETrue); williamr@2: // From CMdaImageUtility williamr@2: virtual void DoClose(); williamr@2: private: williamr@2: inline CMdaImageDataWriteUtilityPriv* Properties() const; williamr@2: }; williamr@2: williamr@2: williamr@2: class CMdaImageFileToBitmapUtilityPriv; williamr@2: /** williamr@2: @publishedAll williamr@2: @deprecated 7.0s - Replaced by Image Conversion library - use CImageDecoder::FileNewL() williamr@2: williamr@2: Implements format conversion of a file based image to a bitmap. williamr@2: williamr@2: This class has been deprecated in 7.0s, it's functionality is now part of the Image williamr@2: Converter Library. For more information see CImageDecoder. williamr@2: williamr@2: The class provides functions to create an instance of this conversion williamr@2: utility and to open an existing image file. Conversion is performed williamr@2: using the image conversion utility interface. williamr@2: williamr@2: @since 5.0 williamr@2: @see CImageDecoder williamr@2: */ williamr@2: class CMdaImageFileToBitmapUtility : public CMdaImageDataReadUtility williamr@2: { williamr@2: public: williamr@2: IMPORT_C static CMdaImageFileToBitmapUtility* NewL(MMdaImageUtilObserver& aObserver,CMdaServer* aServer = NULL); williamr@2: IMPORT_C void OpenL(const TDesC& aFileName,TMdaClipFormat* aFormat = NULL,TMdaPackage* aCodec = NULL,TMdaPackage* aExtra = NULL); williamr@2: private: williamr@2: inline CMdaImageFileToBitmapUtilityPriv* Properties() const; williamr@2: }; williamr@2: williamr@2: williamr@2: class CMdaImageDescToBitmapUtilityPriv; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @deprecated 7.0s - Replaced by Image Conversion library - use CImageDecoder::DataNewL() williamr@2: williamr@2: Implements format conversion of a descriptor-based image to a bitmap. williamr@2: williamr@2: This class has been deprecated in 7.0s, it's functionality is now part of the Image Converter williamr@2: Library. For more information see CImageDecoder. williamr@2: williamr@2: The class provides functions to create an instance of this conversion williamr@2: utility and to open and prepare the image data.Conversion is performed williamr@2: using the image conversion utility interface. williamr@2: williamr@2: @since 5.0 williamr@2: @see CImageDecoder williamr@2: */ williamr@2: class CMdaImageDescToBitmapUtility : public CMdaImageDataReadUtility williamr@2: { williamr@2: public: williamr@2: IMPORT_C static CMdaImageDescToBitmapUtility* NewL(MMdaImageUtilObserver& aObserver,CMdaServer* aServer = NULL); williamr@2: IMPORT_C void OpenL(const TDesC8& aDescriptor,TMdaClipFormat* aFormat = NULL,TMdaPackage* aCodec = NULL,TMdaPackage* aExtra = NULL); williamr@2: private: williamr@2: inline CMdaImageDescToBitmapUtilityPriv* Properties() const; williamr@2: }; williamr@2: williamr@2: williamr@2: class CMdaImageBitmapToFileUtilityPriv; williamr@2: /** williamr@2: @publishedAll williamr@2: @deprecated williamr@2: williamr@2: Implements format conversion of a bitmap to a file-based image. williamr@2: williamr@2: Replaced by Image Conversion library - use CImageEncoder::FileNewL() williamr@2: williamr@2: The class provides functions to create an instance of this conversion williamr@2: utility and to create the file. Conversion is performed using the image williamr@2: conversion utility interface. williamr@2: williamr@2: @since 5.0 williamr@2: @see CImageEncoder::FileNewL() williamr@2: */ williamr@2: class CMdaImageBitmapToFileUtility : public CMdaImageDataWriteUtility williamr@2: { williamr@2: public: williamr@2: IMPORT_C static CMdaImageBitmapToFileUtility* NewL(MMdaImageUtilObserver& aObserver,CMdaServer* aServer = NULL); williamr@2: IMPORT_C void CreateL(const TDesC& aFileName,TMdaClipFormat* aFormat,TMdaPackage* aCodec,TMdaPackage* aExtra); williamr@2: private: williamr@2: inline CMdaImageBitmapToFileUtilityPriv* Properties() const; williamr@2: }; williamr@2: williamr@2: williamr@2: class CMdaImageBitmapToDescUtilityPriv; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @deprecated williamr@2: williamr@2: This class has been deprecated in 7.0s, it's functionality is now part of the williamr@2: Image Converter Library. For more information see CImageEncoder. williamr@2: williamr@2: @see CImageEncoder::DataNewL williamr@2: */ williamr@2: class CMdaImageBitmapToDescUtility : public CMdaImageDataWriteUtility williamr@2: { williamr@2: public: williamr@2: IMPORT_C static CMdaImageBitmapToDescUtility* NewL(MMdaImageUtilObserver& aObserver,CMdaServer* aServer = NULL); williamr@2: IMPORT_C void CreateL(TDes8& aDescriptor,TMdaClipFormat* aFormat,TMdaPackage* aCodec,TMdaPackage* aExtra); williamr@2: private: williamr@2: inline CMdaImageBitmapToDescUtilityPriv* Properties() const; williamr@2: }; williamr@2: williamr@2: williamr@2: class CMdaImageBitmapToBitmapUtilityPriv; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @deprecated williamr@2: williamr@2: Implements bitmap to bitmap copying and colour depth conversion. williamr@2: williamr@2: Replaced by Image Conversion library - use CImageEncoder::FileNewL() williamr@2: williamr@2: @since 5.0 williamr@2: @see CImageEncoder::FileNewL() williamr@2: */ williamr@2: class CMdaImageBitmapToBitmapUtility : public CMdaImageUtility williamr@2: { williamr@2: friend class CMdaImageBitmapToBitmapUtilityPriv; williamr@2: williamr@2: public: williamr@2: IMPORT_C static CMdaImageBitmapToBitmapUtility* NewL(MMdaImageUtilObserver& aObserver, CMdaServer* aServer = NULL); williamr@2: IMPORT_C ~CMdaImageBitmapToBitmapUtility(); williamr@2: IMPORT_C void OpenL(CFbsBitmap& aBitmap); williamr@2: // from CMdaImageUtility williamr@2: IMPORT_C virtual void ConvertL(CFbsBitmap& aBitmap, TInt aFrameNumber = 0); williamr@2: IMPORT_C virtual void ConvertL(CFbsBitmap& aBitmap, CFbsBitmap& aMaskBitmap, TInt aFrameNumber = 0); williamr@2: IMPORT_C virtual void CancelConvertL(); williamr@2: // From CActive williamr@2: virtual void RunL(); williamr@2: virtual void DoCancel(); williamr@2: protected: williamr@2: // from CMdaImageUtility williamr@2: virtual void DoClose(); williamr@2: private: williamr@2: inline CMdaImageBitmapToBitmapUtilityPriv* Properties() const; williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: class CMdaBitmapRotatorPriv; williamr@2: /** williamr@2: @publishedAll williamr@2: @deprecated williamr@2: williamr@2: Replaced by Image Conversion library - see CBitmapRotator williamr@2: williamr@2: Rotates a bitmap. williamr@2: williamr@2: The class offers a simple interface to perform bitmap rotations in williamr@2: clockwise 90 degree increments. The target bitmap is resized as williamr@2: necessary. williamr@2: williamr@2: @since 5.0 williamr@2: williamr@2: @see williamr@2: CBitmapRotator williamr@2: */ williamr@2: class CMdaBitmapRotator : public CBase williamr@2: { williamr@2: public: williamr@2: /** Rotation angle. williamr@2: */ williamr@2: enum TRotationAngle williamr@2: { williamr@2: /** A clockwise rotation through 90 degrees. williamr@2: */ williamr@2: ERotation90DegreesClockwise, williamr@2: /** A clockwise rotation through 180 degrees. williamr@2: */ williamr@2: ERotation180DegreesClockwise, williamr@2: /** A clockwise rotation through 270 degrees. williamr@2: */ williamr@2: ERotation270DegreesClockwise, williamr@2: /** The bitmap is mirrored about the horizontal axis. williamr@2: */ williamr@2: EMirrorFlipHorizontal, williamr@2: /** The bitmap is mirrored about the vertical axis. williamr@2: */ williamr@2: EMirrorFlipVertical williamr@2: }; williamr@2: public: williamr@2: IMPORT_C static CMdaBitmapRotator* NewL(); williamr@2: IMPORT_C virtual ~CMdaBitmapRotator(); williamr@2: IMPORT_C void RotateL(MMdaImageUtilObserver& aObserver,CFbsBitmap& aSrcBitmap,CFbsBitmap& aTgtBitmap,TRotationAngle aAngle); williamr@2: IMPORT_C void RotateL(MMdaImageUtilObserver& aObserver,CFbsBitmap& aBitmap,TRotationAngle aAngle); williamr@2: IMPORT_C void CancelRotation(); williamr@2: private: williamr@2: CMdaBitmapRotatorPriv* iProperties; williamr@2: }; williamr@2: williamr@2: williamr@2: class CMdaBitmapScalerPriv; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @deprecated williamr@2: williamr@2: Re-scales a bitmap. williamr@2: williamr@2: Replaced by Image Conversion library - see CBitmapScaler williamr@2: williamr@2: The class offers a simple interface to perform arbitrary re-scaling of williamr@2: a bitmap. williamr@2: williamr@2: @since 5.0 williamr@2: @see CBitmapScaler williamr@2: */ williamr@2: class CMdaBitmapScaler : public CBase williamr@2: { williamr@2: public: williamr@2: IMPORT_C static CMdaBitmapScaler* NewL(); williamr@2: IMPORT_C virtual ~CMdaBitmapScaler(); williamr@2: IMPORT_C void ScaleL(MMdaImageUtilObserver& aObserver,CFbsBitmap& aSrcBitmap,CFbsBitmap& aTgtBitmap,TBool aMaintainAspectRatio = ETrue); williamr@2: IMPORT_C void ScaleL(MMdaImageUtilObserver& aObserver,CFbsBitmap& aBitmap,TSize aDestSize,TBool aMaintainAspectRatio = ETrue); williamr@2: IMPORT_C void CancelScaling(); williamr@2: private: williamr@2: CMdaBitmapScalerPriv* iProperties; williamr@2: }; williamr@2: williamr@2: #endif williamr@4: