epoc32/include/mdaimageconverter.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 mdaimageconverter.h
     1 // Copyright (c) 2001-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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // BC Version that uses CImageDecode/Encode objects but is essentially source
       
    15 // compatible with the old MdaImageConverter calls
       
    16 // 
       
    17 /**
       
    18  @file
       
    19  @deprecated
       
    20 */
       
    21 
       
    22 #ifndef __MDAIMAGECONVERTER_H__
       
    23 #define __MDAIMAGECONVERTER_H__
       
    24 
       
    25 #include <fbs.h>
       
    26 
       
    27 #include <icl/imagedata.h>
       
    28 #include <mda/client/resource.h>
       
    29 #include <mda/client/utility.h>
       
    30 #include <mda/common/video.h>
       
    31 
       
    32 class CMdaServer;
       
    33 class REComSession;
       
    34 
       
    35 /**
       
    36 @publishedAll
       
    37 @deprecated 7.0s - Replaced by Image Conversion library - no direct equivalent
       
    38 
       
    39 This class has been deprecated in 7.0s.
       
    40 
       
    41 An interface to a set of image conversion utility callback functions.
       
    42 
       
    43 The class is a mixin and is intended to be inherited by the client
       
    44 classes which observe the image conversion operations. The functions
       
    45 encapsulated by this class are called when the open, create and
       
    46 conversion operations complete.The interface is also used by the
       
    47 bitmap image rotator and the bitmap image re-scaler. A reference to
       
    48 this object is passed as a parameter when constructing image
       
    49 conversion utility, image rotator and image re-scaler objects.
       
    50 
       
    51 @since 5.0
       
    52 */
       
    53 class MMdaImageUtilObserver
       
    54 	{
       
    55 public:
       
    56 
       
    57 	/**
       
    58 	Defines required client behaviour when a create operation has
       
    59 	completed.
       
    60 	
       
    61 	@param  aError
       
    62 	        A value identifying the status of the create
       
    63 	        operation. KErrNone or one of the system
       
    64 	        wide error codes.
       
    65 	*/
       
    66 	virtual void MiuoCreateComplete(TInt aError) = 0;
       
    67 
       
    68 	/**
       
    69 	Defines required client behaviour when an open operation has
       
    70 	completed.
       
    71 
       
    72 	@param  aError
       
    73 	        A value identifying the status of the create
       
    74 	        operation. KErrNone or one of the system
       
    75 	        wide error codes.
       
    76 	*/
       
    77 	virtual void MiuoOpenComplete(TInt aError) = 0;
       
    78 
       
    79 	/**
       
    80 	Defines required client behaviour when a conversion, image rotation or
       
    81 	image re-scaling operation has completed.
       
    82 
       
    83 	@param  aError
       
    84 	        A value identifying the status of the operation.
       
    85 	        KErrNone or one of the system wide error
       
    86 	        codes.
       
    87 	*/
       
    88 	virtual void MiuoConvertComplete(TInt aError) = 0;
       
    89 	};
       
    90 
       
    91 // Note: TFrameInfo is now declared via ImageClientApi - was previously here
       
    92 
       
    93 
       
    94 class CMdaImageUtilityPriv;
       
    95 
       
    96 /**
       
    97 @publishedAll
       
    98 @deprecated 7.0s - Replaced by Image Conversion library - no direct equivalent
       
    99 
       
   100 Defines the public interface to image conversion.
       
   101 
       
   102 This class has been deprecated in 7.0s, it's functionality is now part of the 
       
   103 Image Converter Library. For more information see CImageEncoder and CImageDecoder.
       
   104 
       
   105 Clients of the concrete conversion classes call the functions provided
       
   106 by this interface to perform the conversion. The implementation of
       
   107 these functions is provided either by the concrete conversion classes
       
   108 themselves or by private implementation classes.
       
   109 
       
   110 @since 5.0
       
   111 @see CImageEncoder
       
   112 @see CImageDecoder
       
   113 */
       
   114 class CMdaImageUtility : public CActive, private MMdaObjectStateChangeObserver
       
   115 	{
       
   116 friend class CMdaImageUtilityPriv;
       
   117 
       
   118 public:
       
   119 	virtual ~CMdaImageUtility();
       
   120 	IMPORT_C virtual void Close();
       
   121 
       
   122 	/**
       
   123 	Begins the image conversion operation for the specified frame
       
   124 	overloaded function.
       
   125 	
       
   126 	The operation is asynchronous. When the conversion operation is
       
   127 	complete, successfully or otherwise, the callback function
       
   128 	MMdaImageUtilObserver::MiuoConvertComplete() is
       
   129 	called.When converting from a file or descriptor to a bitmap, the
       
   130 	operation can complete with KErrUnderflow, if there is
       
   131 	insufficient information in the file or descriptor. Typically, this
       
   132 	occurs when using the file or descriptor as a cache. In this
       
   133 	situation, the conversion operation should be performed repeatedly
       
   134 	until the file or descriptor has accumulated enough information for
       
   135 	the operation to complete with KErrNone. As much of the
       
   136 	image as is present is converted and written to the target bitmap at
       
   137 	each call to this function.
       
   138 	
       
   139 	@param	aBitmap
       
   140 			A reference to a bitmap. This may be a source or a
       
   141 			target for the conversion process, depending on the
       
   142 			concrete conversion class utility being used.
       
   143 	@param	aFrameNumber
       
   144 			The frame number. This value is relative to zero. For
       
   145 			those concrete conversion classes which perform
       
   146 			conversion from a bitmap, this value must always be
       
   147 			zero. For those concrete conversion classes which
       
   148 			perform conversion to a bitmap, this value must be
       
   149 			less than the number of frames in the image.
       
   150 	*/
       
   151 	virtual void ConvertL(CFbsBitmap& aBitmap,TInt aFrameNumber = 0) = 0;
       
   152 
       
   153 	/**
       
   154 	Begins the image conversion operation for the specified frame overloaded function.
       
   155 
       
   156 	The operation is asynchronous. When the conversion operation is complete, successfully or otherwise, the
       
   157 	callback function MMdaImageUtilObserver::MiuoConvertComplete() is called.When converting from a file or
       
   158 	descriptor to a bitmap, the operation can complete with KErrUnderflow, if there is insufficient information
       
   159 	in the file or descriptor. Typically, this occurs when using the file or descriptor as a cache. In this
       
   160 	situation, the conversion operation should be performed repeatedly until the file or descriptor has accumulated
       
   161 	enough information for the operation to complete with KErrNone. As much of the image as is present is converted
       
   162 	and written to the target bitmap at each call to this function.
       
   163 
       
   164 	@param  aBitmap
       
   165 	        A reference to a bitmap. This may be a source or a target for the conversion process, depending on
       
   166             the concrete conversion class utility being used.
       
   167 	@param	aMaskBitmap
       
   168 			A source or target mask bitmap, if present.
       
   169 	@param  aFrameNumber
       
   170             The frame number. This value is relative to zero. For those concrete conversion classes which perform
       
   171             conversion from a bitmap, this value must always be zero. For those concrete conversion classes which
       
   172             perform conversion to a bitmap, this value must be less than the number of frames in the image.
       
   173 
       
   174 	@see    CMdaImageUtility::ConvertL(CFbsBitmap& aBitmap,TInt aFrameNumber = 0)
       
   175 	*/
       
   176 	virtual void ConvertL(CFbsBitmap& aBitmap,CFbsBitmap& aMaskBitmap,TInt aFrameNumber = 0) = 0;
       
   177 
       
   178 	/**
       
   179 	Cancels the conversion operation.
       
   180 
       
   181 	The callback function MMdaImageUtilObserver::MiuoConvertComplete() is not called.
       
   182 	*/
       
   183 	virtual void CancelConvertL() = 0;
       
   184 	IMPORT_C virtual void FrameInfo(TInt aFrame,TFrameInfo& aInfo) const;
       
   185 	IMPORT_C virtual TInt FrameCount() const;
       
   186 public:
       
   187 	// Reserved functions - do not call
       
   188 	virtual void ImageUtil_Reserved1();
       
   189 	virtual void ImageUtil_Reserved2();
       
   190 	virtual void ImageUtil_Reserved3();
       
   191 	virtual void ImageUtil_Reserved4();
       
   192 protected:
       
   193 	/**
       
   194 	@internalComponent
       
   195 	*/
       
   196 	CMdaImageUtility();
       
   197 	virtual void DoClose();
       
   198 	// From MMdaObjectStateChangeObserver
       
   199 	virtual void MoscoStateChangeEvent(CBase* aObject, TInt aPreviousState, TInt aCurrentState, TInt aErrorCode);
       
   200 	/**
       
   201 	@internalComponent
       
   202 	*/
       
   203 	void SelfComplete(TInt aError);
       
   204 	/**
       
   205 	@internalComponent
       
   206 	*/
       
   207 	void DoCancel();
       
   208 protected:
       
   209 	/**@internalTechnology*/
       
   210 	CMdaImageUtilityPriv* iProperties;
       
   211 	};
       
   212 
       
   213 
       
   214 class CImageDecoder;
       
   215 class CMdaImageDataReadUtilityPriv;
       
   216 
       
   217 /**
       
   218 @publishedAll
       
   219 @deprecated
       
   220 
       
   221 Base class used in the derivation of
       
   222 CMdaImageDescToBitmapUtility and
       
   223 CMdaImageFileToBitmapUtility.
       
   224 
       
   225 It has no user accessible functions.
       
   226 
       
   227 Replaced by Image Conversion library - see CImageDecoder
       
   228 
       
   229 @since 6.0
       
   230 @see CImageDecoder
       
   231 */
       
   232 class CMdaImageDataReadUtility : public CMdaImageUtility
       
   233 	{
       
   234 friend class CMdaImageDataReadUtilityPriv;
       
   235 
       
   236 public:
       
   237 	virtual ~CMdaImageDataReadUtility();
       
   238 	// From CMdaImageUtility
       
   239 	IMPORT_C virtual void ConvertL(CFbsBitmap& aBitmap,TInt aFrameNumber = 0);
       
   240 	IMPORT_C virtual void ConvertL(CFbsBitmap& aBitmap,CFbsBitmap& aMaskBitmap,TInt aFrameNumber = 0);
       
   241 	IMPORT_C virtual void CancelConvertL();
       
   242 	// from CActive
       
   243 	virtual void RunL();
       
   244 	virtual void DoCancel();
       
   245 	IMPORT_C virtual const TDesC& FrameCommentL(TInt aFrameNumber);
       
   246 public:
       
   247 	// Reserved functions - do not call
       
   248 	virtual void ImageReadUtil_Reserved2();
       
   249 	virtual void ImageReadUtil_Reserved3();
       
   250 	virtual void ImageReadUtil_Reserved4();
       
   251 protected:
       
   252 	// Creates relevant iDecoder property - depending on subclass.
       
   253 	// Called by "background" AO processing.
       
   254 	/**
       
   255 	@internalComponent
       
   256 	*/
       
   257  	void DoOpenL();
       
   258 	// From CMdaImageUtility
       
   259 	virtual void DoClose();
       
   260 private:
       
   261 	inline CMdaImageDataReadUtilityPriv* Properties() const;
       
   262 	};
       
   263 
       
   264 
       
   265 class CImageEncoder;
       
   266 class CMdaImageDataWriteUtilityPriv;
       
   267 
       
   268 /**
       
   269 @publishedAll
       
   270 @deprecated 7.0s - Replaced by Image Conversion library - see CImageEncoder
       
   271 
       
   272 Base class used in the derivation of CMdaImageBitmapToDescUtility and CMdaImageBitmapToFileUtility.
       
   273 
       
   274 It has no user accessible functions.
       
   275 
       
   276 @since 6.0
       
   277 
       
   278 @see CMdaImageBitmapToDescUtility
       
   279 @see CMdaImageBitmapToFileUtility
       
   280 */
       
   281 class CMdaImageDataWriteUtility : public CMdaImageUtility
       
   282 	{
       
   283 friend class CMdaImageDataWriteUtilityPriv;
       
   284 
       
   285 public:
       
   286 	virtual ~CMdaImageDataWriteUtility();
       
   287 	// From CMdaImageUtility
       
   288 	IMPORT_C virtual void ConvertL(CFbsBitmap& aBitmap,TInt aFrameNumber = 0);
       
   289 	IMPORT_C virtual void ConvertL(CFbsBitmap& aBitmap,const TRect& aSourceRect,TInt aFrameNumber = 0);
       
   290 	IMPORT_C virtual void ConvertL(CFbsBitmap& aBitmap,CFbsBitmap& aMaskBitmap,TInt aFrameNumber = 0);
       
   291 	IMPORT_C virtual void CancelConvertL();
       
   292 protected:
       
   293 	virtual void RunL();
       
   294 	virtual void DoCancel();
       
   295 protected:
       
   296 	virtual CImageEncoder* Encoder() const;
       
   297 public:
       
   298 	// Reserved functions - do not call
       
   299 	virtual void ImageWriteUtil_Reserved1();
       
   300 	virtual void ImageWriteUtil_Reserved2();
       
   301 	virtual void ImageWriteUtil_Reserved3();
       
   302 protected:
       
   303 	// Creates relevant <code>iEncoder</code> property - depending on subclass.
       
   304 	// Called by "background" AO processing.
       
   305 	/**
       
   306 	@internalComponent
       
   307 	*/
       
   308 	void DoCreateL(TBool aFullCreate=ETrue);
       
   309 	// From CMdaImageUtility
       
   310 	virtual void DoClose();
       
   311 private:
       
   312 	inline CMdaImageDataWriteUtilityPriv* Properties() const;
       
   313 	};
       
   314 
       
   315 
       
   316 class CMdaImageFileToBitmapUtilityPriv;
       
   317 /**
       
   318 @publishedAll
       
   319 @deprecated 7.0s - Replaced by Image Conversion library - use CImageDecoder::FileNewL()
       
   320 
       
   321 Implements format conversion of a file based image to a bitmap.
       
   322 
       
   323 This class has been deprecated in 7.0s, it's functionality is now part of the Image 
       
   324 Converter Library. For more information see CImageDecoder.
       
   325 
       
   326 The class provides functions to create an instance of this conversion
       
   327 utility and to open an existing image file. Conversion is performed
       
   328 using the image conversion utility interface.
       
   329 
       
   330 @since 5.0
       
   331 @see CImageDecoder
       
   332 */
       
   333 class CMdaImageFileToBitmapUtility : public CMdaImageDataReadUtility
       
   334 	{
       
   335 public:
       
   336 	IMPORT_C static CMdaImageFileToBitmapUtility* NewL(MMdaImageUtilObserver& aObserver,CMdaServer* aServer = NULL);
       
   337 	IMPORT_C void OpenL(const TDesC& aFileName,TMdaClipFormat* aFormat = NULL,TMdaPackage* aCodec = NULL,TMdaPackage* aExtra = NULL);
       
   338 private:
       
   339 	inline CMdaImageFileToBitmapUtilityPriv* Properties() const;
       
   340 	};
       
   341 
       
   342 
       
   343 class CMdaImageDescToBitmapUtilityPriv;
       
   344 
       
   345 /**
       
   346 @publishedAll
       
   347 @deprecated 7.0s - Replaced by Image Conversion library - use CImageDecoder::DataNewL()
       
   348 
       
   349 Implements format conversion of a descriptor-based image to a bitmap.
       
   350 
       
   351 This class has been deprecated in 7.0s, it's functionality is now part of the Image Converter 
       
   352 Library. For more information see CImageDecoder.
       
   353 
       
   354 The class provides functions to create an instance of this conversion
       
   355 utility and to open and prepare the image data.Conversion is performed
       
   356 using the image conversion utility interface.
       
   357 
       
   358 @since 5.0
       
   359 @see CImageDecoder
       
   360  */
       
   361 class CMdaImageDescToBitmapUtility : public CMdaImageDataReadUtility
       
   362 	{
       
   363 public:
       
   364 	IMPORT_C static CMdaImageDescToBitmapUtility* NewL(MMdaImageUtilObserver& aObserver,CMdaServer* aServer = NULL);
       
   365 	IMPORT_C void OpenL(const TDesC8& aDescriptor,TMdaClipFormat* aFormat = NULL,TMdaPackage* aCodec = NULL,TMdaPackage* aExtra = NULL);
       
   366 private:
       
   367 	inline CMdaImageDescToBitmapUtilityPriv* Properties() const;
       
   368 	};
       
   369 
       
   370 
       
   371 class CMdaImageBitmapToFileUtilityPriv;
       
   372 /**
       
   373 @publishedAll
       
   374 @deprecated
       
   375 
       
   376 Implements format conversion of a bitmap to a file-based image.
       
   377 
       
   378 Replaced by Image Conversion library - use CImageEncoder::FileNewL()
       
   379 
       
   380 The class provides functions to create an instance of this conversion
       
   381 utility and to create the file. Conversion is performed using the image
       
   382 conversion utility interface.
       
   383 
       
   384 @since 5.0
       
   385 @see CImageEncoder::FileNewL()
       
   386 */
       
   387 class CMdaImageBitmapToFileUtility : public CMdaImageDataWriteUtility
       
   388 	{
       
   389 public:
       
   390 	IMPORT_C static CMdaImageBitmapToFileUtility* NewL(MMdaImageUtilObserver& aObserver,CMdaServer* aServer = NULL);
       
   391 	IMPORT_C void CreateL(const TDesC& aFileName,TMdaClipFormat* aFormat,TMdaPackage* aCodec,TMdaPackage* aExtra);
       
   392 private:
       
   393 	inline CMdaImageBitmapToFileUtilityPriv* Properties() const;
       
   394 	};
       
   395 
       
   396 
       
   397 class CMdaImageBitmapToDescUtilityPriv;
       
   398 
       
   399 /**
       
   400 @publishedAll
       
   401 @deprecated 
       
   402 
       
   403 This class has been deprecated in 7.0s, it's functionality is now part of the 
       
   404 Image Converter Library. For more information see CImageEncoder.
       
   405 
       
   406 @see CImageEncoder::DataNewL
       
   407 */
       
   408 class CMdaImageBitmapToDescUtility : public CMdaImageDataWriteUtility
       
   409 	{
       
   410 public:
       
   411 	IMPORT_C static CMdaImageBitmapToDescUtility* NewL(MMdaImageUtilObserver& aObserver,CMdaServer* aServer = NULL);
       
   412 	IMPORT_C void CreateL(TDes8& aDescriptor,TMdaClipFormat* aFormat,TMdaPackage* aCodec,TMdaPackage* aExtra);
       
   413 private:
       
   414 	inline CMdaImageBitmapToDescUtilityPriv* Properties() const;
       
   415 	};
       
   416 
       
   417 
       
   418 class CMdaImageBitmapToBitmapUtilityPriv;
       
   419 
       
   420 /**
       
   421 @publishedAll
       
   422 @deprecated
       
   423 
       
   424 Implements bitmap to bitmap copying and colour depth conversion.
       
   425 
       
   426 Replaced by Image Conversion library - use CImageEncoder::FileNewL()
       
   427 
       
   428 @since 5.0
       
   429 @see CImageEncoder::FileNewL()
       
   430 */
       
   431 class CMdaImageBitmapToBitmapUtility : public CMdaImageUtility
       
   432 	{
       
   433 friend class CMdaImageBitmapToBitmapUtilityPriv;
       
   434 
       
   435 public:
       
   436 	IMPORT_C static CMdaImageBitmapToBitmapUtility* NewL(MMdaImageUtilObserver& aObserver, CMdaServer* aServer = NULL);
       
   437 	IMPORT_C ~CMdaImageBitmapToBitmapUtility();
       
   438 	IMPORT_C void OpenL(CFbsBitmap& aBitmap);
       
   439 	// from CMdaImageUtility
       
   440 	IMPORT_C virtual void ConvertL(CFbsBitmap& aBitmap, TInt aFrameNumber = 0);
       
   441 	IMPORT_C virtual void ConvertL(CFbsBitmap& aBitmap, CFbsBitmap& aMaskBitmap, TInt aFrameNumber = 0);
       
   442 	IMPORT_C virtual void CancelConvertL();
       
   443 	// From CActive
       
   444 	virtual void RunL();
       
   445 	virtual void DoCancel();
       
   446 protected:
       
   447 	// from CMdaImageUtility
       
   448 	virtual void DoClose();
       
   449 private:
       
   450 	inline CMdaImageBitmapToBitmapUtilityPriv* Properties() const;
       
   451 	};
       
   452 
       
   453 
       
   454 
       
   455 class CMdaBitmapRotatorPriv;
       
   456 /**
       
   457 @publishedAll
       
   458 @deprecated 
       
   459 
       
   460 Replaced by Image Conversion library - see CBitmapRotator
       
   461 
       
   462 Rotates a bitmap.
       
   463 
       
   464 The class offers a simple interface to perform bitmap rotations in
       
   465 clockwise 90 degree increments. The target bitmap is resized as
       
   466 necessary.
       
   467 
       
   468 @since 5.0
       
   469 
       
   470 @see
       
   471 CBitmapRotator
       
   472 */
       
   473 class CMdaBitmapRotator : public CBase
       
   474 	{
       
   475 public:
       
   476 	/** Rotation angle.
       
   477 	*/
       
   478 	enum TRotationAngle
       
   479 		{
       
   480 		/** A clockwise rotation through 90 degrees.
       
   481 		*/
       
   482 		ERotation90DegreesClockwise,
       
   483 		/** A clockwise rotation through 180 degrees.
       
   484 		*/
       
   485 		ERotation180DegreesClockwise,
       
   486 		/** A clockwise rotation through 270 degrees.
       
   487 		*/
       
   488 		ERotation270DegreesClockwise,
       
   489 		/** The bitmap is mirrored about the horizontal axis.
       
   490 		*/
       
   491 		EMirrorFlipHorizontal,
       
   492 		/** The bitmap is mirrored about the vertical axis.
       
   493 		*/
       
   494 		EMirrorFlipVertical
       
   495 		};
       
   496 public:
       
   497 	IMPORT_C static CMdaBitmapRotator* NewL();
       
   498 	IMPORT_C virtual ~CMdaBitmapRotator();
       
   499 	IMPORT_C void RotateL(MMdaImageUtilObserver& aObserver,CFbsBitmap& aSrcBitmap,CFbsBitmap& aTgtBitmap,TRotationAngle aAngle);
       
   500 	IMPORT_C void RotateL(MMdaImageUtilObserver& aObserver,CFbsBitmap& aBitmap,TRotationAngle aAngle);
       
   501 	IMPORT_C void CancelRotation();
       
   502 private:
       
   503 	CMdaBitmapRotatorPriv* iProperties;
       
   504 	};
       
   505 
       
   506 
       
   507 class CMdaBitmapScalerPriv;
       
   508 
       
   509 /**
       
   510 @publishedAll
       
   511 @deprecated
       
   512 
       
   513 Re-scales a bitmap.
       
   514 
       
   515 Replaced by Image Conversion library - see CBitmapScaler
       
   516 
       
   517 The class offers a simple interface to perform arbitrary re-scaling of
       
   518 a bitmap.
       
   519 
       
   520 @since 5.0
       
   521 @see CBitmapScaler
       
   522 */
       
   523 class CMdaBitmapScaler : public CBase
       
   524 	{
       
   525 public:
       
   526 	IMPORT_C static CMdaBitmapScaler* NewL();
       
   527 	IMPORT_C virtual ~CMdaBitmapScaler();
       
   528 	IMPORT_C void ScaleL(MMdaImageUtilObserver& aObserver,CFbsBitmap& aSrcBitmap,CFbsBitmap& aTgtBitmap,TBool aMaintainAspectRatio = ETrue);
       
   529 	IMPORT_C void ScaleL(MMdaImageUtilObserver& aObserver,CFbsBitmap& aBitmap,TSize aDestSize,TBool aMaintainAspectRatio = ETrue);
       
   530 	IMPORT_C void CancelScaling();
       
   531 private:
       
   532 	CMdaBitmapScalerPriv* iProperties;
       
   533 	};
       
   534 
       
   535 #endif