epoc32/include/mdaimageconverter.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     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".
     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 
    19 /**
    20  @file
    21  @deprecated
    22 */
    23 
    24 #ifndef __MDAIMAGECONVERTER_H__
    25 #define __MDAIMAGECONVERTER_H__
    26 
    27 #include <fbs.h>
    28 
    29 #include <icl/imagedata.h>
    30 #include <mda/common/resource.h>
    31 #include <mda/client/utility.h>
    32 #include <mda/common/video.h>
    33 
    34 class CMdaServer;
    35 class REComSession;
    36 
    37 /**
    38 @publishedAll
    39 @deprecated 7.0s - Replaced by Image Conversion library - no direct equivalent
    40 
    41 This class has been deprecated in 7.0s.
    42 
    43 An interface to a set of image conversion utility callback functions.
    44 
    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.
    52 
    53 @since 5.0
    54 */
    55 class MMdaImageUtilObserver
    56 	{
    57 public:
    58 
    59 	/**
    60 	Defines required client behaviour when a create operation has
    61 	completed.
    62 	
    63 	@param  aError
    64 	        A value identifying the status of the create
    65 	        operation. KErrNone or one of the system
    66 	        wide error codes.
    67 	*/
    68 	virtual void MiuoCreateComplete(TInt aError) = 0;
    69 
    70 	/**
    71 	Defines required client behaviour when an open operation has
    72 	completed.
    73 
    74 	@param  aError
    75 	        A value identifying the status of the create
    76 	        operation. KErrNone or one of the system
    77 	        wide error codes.
    78 	*/
    79 	virtual void MiuoOpenComplete(TInt aError) = 0;
    80 
    81 	/**
    82 	Defines required client behaviour when a conversion, image rotation or
    83 	image re-scaling operation has completed.
    84 
    85 	@param  aError
    86 	        A value identifying the status of the operation.
    87 	        KErrNone or one of the system wide error
    88 	        codes.
    89 	*/
    90 	virtual void MiuoConvertComplete(TInt aError) = 0;
    91 	};
    92 
    93 // Note: TFrameInfo is now declared via ImageClientApi - was previously here
    94 
    95 
    96 class CMdaImageUtilityPriv;
    97 
    98 /**
    99 @publishedAll
   100 @deprecated 7.0s - Replaced by Image Conversion library - no direct equivalent
   101 
   102 Defines the public interface to image conversion.
   103 
   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.
   106 
   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.
   111 
   112 @since 5.0
   113 @see CImageEncoder
   114 @see CImageDecoder
   115 */
   116 class CMdaImageUtility : public CActive, private MMdaObjectStateChangeObserver
   117 	{
   118 friend class CMdaImageUtilityPriv;
   119 
   120 public:
   121 	virtual ~CMdaImageUtility();
   122 	IMPORT_C virtual void Close();
   123 
   124 	/**
   125 	Begins the image conversion operation for the specified frame
   126 	overloaded function.
   127 	
   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.
   140 	
   141 	@param	aBitmap
   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.
   145 	@param	aFrameNumber
   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.
   152 	*/
   153 	virtual void ConvertL(CFbsBitmap& aBitmap,TInt aFrameNumber = 0) = 0;
   154 
   155 	/**
   156 	Begins the image conversion operation for the specified frame overloaded function.
   157 
   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.
   165 
   166 	@param  aBitmap
   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.
   169 	@param	aMaskBitmap
   170 			A source or target mask bitmap, if present.
   171 	@param  aFrameNumber
   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.
   175 
   176 	@see    CMdaImageUtility::ConvertL(CFbsBitmap& aBitmap,TInt aFrameNumber = 0)
   177 	*/
   178 	virtual void ConvertL(CFbsBitmap& aBitmap,CFbsBitmap& aMaskBitmap,TInt aFrameNumber = 0) = 0;
   179 
   180 	/**
   181 	Cancels the conversion operation.
   182 
   183 	The callback function MMdaImageUtilObserver::MiuoConvertComplete() is not called.
   184 	*/
   185 	virtual void CancelConvertL() = 0;
   186 	IMPORT_C virtual void FrameInfo(TInt aFrame,TFrameInfo& aInfo) const;
   187 	IMPORT_C virtual TInt FrameCount() const;
   188 public:
   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();
   194 protected:
   195 	/**
   196 	@internalComponent
   197 	*/
   198 	CMdaImageUtility();
   199 	virtual void DoClose();
   200 	// From MMdaObjectStateChangeObserver
   201 	virtual void MoscoStateChangeEvent(CBase* aObject, TInt aPreviousState, TInt aCurrentState, TInt aErrorCode);
   202 	/**
   203 	@internalComponent
   204 	*/
   205 	void SelfComplete(TInt aError);
   206 	/**
   207 	@internalComponent
   208 	*/
   209 	void DoCancel();
   210 protected:
   211 	/**@internalTechnology*/
   212 	CMdaImageUtilityPriv* iProperties;
   213 	};
   214 
   215 
   216 class CImageDecoder;
   217 class CMdaImageDataReadUtilityPriv;
   218 
   219 /**
   220 @publishedAll
   221 @deprecated
   222 
   223 Base class used in the derivation of
   224 CMdaImageDescToBitmapUtility and
   225 CMdaImageFileToBitmapUtility.
   226 
   227 It has no user accessible functions.
   228 
   229 Replaced by Image Conversion library - see CImageDecoder
   230 
   231 @since 6.0
   232 @see CImageDecoder
   233 */
   234 class CMdaImageDataReadUtility : public CMdaImageUtility
   235 	{
   236 friend class CMdaImageDataReadUtilityPriv;
   237 
   238 public:
   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();
   244 	// from CActive
   245 	virtual void RunL();
   246 	virtual void DoCancel();
   247 	IMPORT_C virtual const TDesC& FrameCommentL(TInt aFrameNumber);
   248 public:
   249 	// Reserved functions - do not call
   250 	virtual void ImageReadUtil_Reserved2();
   251 	virtual void ImageReadUtil_Reserved3();
   252 	virtual void ImageReadUtil_Reserved4();
   253 protected:
   254 	// Creates relevant iDecoder property - depending on subclass.
   255 	// Called by "background" AO processing.
   256 	
   257 	/**
   258 	@internalComponent
   259 	*/
   260  	void DoOpenL();
   261 	
   262 	// From CMdaImageUtility
   263 	virtual void DoClose();
   264 private:
   265 	inline CMdaImageDataReadUtilityPriv* Properties() const;
   266 	};
   267 
   268 
   269 class CImageEncoder;
   270 class CMdaImageDataWriteUtilityPriv;
   271 
   272 /**
   273 @publishedAll
   274 @deprecated 7.0s - Replaced by Image Conversion library - see CImageEncoder
   275 
   276 Base class used in the derivation of CMdaImageBitmapToDescUtility and CMdaImageBitmapToFileUtility.
   277 
   278 It has no user accessible functions.
   279 
   280 @since 6.0
   281 
   282 @see CMdaImageBitmapToDescUtility
   283 @see CMdaImageBitmapToFileUtility
   284 */
   285 class CMdaImageDataWriteUtility : public CMdaImageUtility
   286 	{
   287 friend class CMdaImageDataWriteUtilityPriv;
   288 
   289 public:
   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();
   296 protected:
   297 	virtual void RunL();
   298 	virtual void DoCancel();
   299 protected:
   300 	virtual CImageEncoder* Encoder() const;
   301 public:
   302 	// Reserved functions - do not call
   303 	virtual void ImageWriteUtil_Reserved1();
   304 	virtual void ImageWriteUtil_Reserved2();
   305 	virtual void ImageWriteUtil_Reserved3();
   306 protected:
   307 	// Creates relevant <code>iEncoder</code> property - depending on subclass.
   308 	// Called by "background" AO processing.
   309 	
   310 	/**
   311 	@internalComponent
   312 	*/
   313 	void DoCreateL(TBool aFullCreate=ETrue);
   314 	// From CMdaImageUtility
   315 	virtual void DoClose();
   316 private:
   317 	inline CMdaImageDataWriteUtilityPriv* Properties() const;
   318 	};
   319 
   320 
   321 class CMdaImageFileToBitmapUtilityPriv;
   322 /**
   323 @publishedAll
   324 @deprecated 7.0s - Replaced by Image Conversion library - use CImageDecoder::FileNewL()
   325 
   326 Implements format conversion of a file based image to a bitmap.
   327 
   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.
   330 
   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.
   334 
   335 @since 5.0
   336 @see CImageDecoder
   337 */
   338 class CMdaImageFileToBitmapUtility : public CMdaImageDataReadUtility
   339 	{
   340 public:
   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);
   343 private:
   344 	inline CMdaImageFileToBitmapUtilityPriv* Properties() const;
   345 	};
   346 
   347 
   348 class CMdaImageDescToBitmapUtilityPriv;
   349 
   350 /**
   351 @publishedAll
   352 @deprecated 7.0s - Replaced by Image Conversion library - use CImageDecoder::DataNewL()
   353 
   354 Implements format conversion of a descriptor-based image to a bitmap.
   355 
   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.
   358 
   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.
   362 
   363 @since 5.0
   364 @see CImageDecoder
   365  */
   366 class CMdaImageDescToBitmapUtility : public CMdaImageDataReadUtility
   367 	{
   368 public:
   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);
   371 private:
   372 	inline CMdaImageDescToBitmapUtilityPriv* Properties() const;
   373 	};
   374 
   375 
   376 class CMdaImageBitmapToFileUtilityPriv;
   377 /**
   378 @publishedAll
   379 @deprecated
   380 
   381 Implements format conversion of a bitmap to a file-based image.
   382 
   383 Replaced by Image Conversion library - use CImageEncoder::FileNewL()
   384 
   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.
   388 
   389 @since 5.0
   390 @see CImageEncoder::FileNewL()
   391 */
   392 class CMdaImageBitmapToFileUtility : public CMdaImageDataWriteUtility
   393 	{
   394 public:
   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);
   397 private:
   398 	inline CMdaImageBitmapToFileUtilityPriv* Properties() const;
   399 	};
   400 
   401 
   402 class CMdaImageBitmapToDescUtilityPriv;
   403 
   404 /**
   405 @publishedAll
   406 @deprecated 
   407 
   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.
   410 
   411 @see CImageEncoder::DataNewL
   412 */
   413 class CMdaImageBitmapToDescUtility : public CMdaImageDataWriteUtility
   414 	{
   415 public:
   416 	IMPORT_C static CMdaImageBitmapToDescUtility* NewL(MMdaImageUtilObserver& aObserver,CMdaServer* aServer = NULL);
   417 	IMPORT_C void CreateL(TDes8& aDescriptor,TMdaClipFormat* aFormat,TMdaPackage* aCodec,TMdaPackage* aExtra);
   418 private:
   419 	inline CMdaImageBitmapToDescUtilityPriv* Properties() const;
   420 	};
   421 
   422 
   423 class CMdaImageBitmapToBitmapUtilityPriv;
   424 
   425 /**
   426 @publishedAll
   427 @deprecated
   428 
   429 Implements bitmap to bitmap copying and colour depth conversion.
   430 
   431 Replaced by Image Conversion library - use CImageEncoder::FileNewL()
   432 
   433 @since 5.0
   434 @see CImageEncoder::FileNewL()
   435 */
   436 class CMdaImageBitmapToBitmapUtility : public CMdaImageUtility
   437 	{
   438 friend class CMdaImageBitmapToBitmapUtilityPriv;
   439 
   440 public:
   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();
   448 	// From CActive
   449 	virtual void RunL();
   450 	virtual void DoCancel();
   451 protected:
   452 	// from CMdaImageUtility
   453 	virtual void DoClose();
   454 private:
   455 	inline CMdaImageBitmapToBitmapUtilityPriv* Properties() const;
   456 	};
   457 
   458 
   459 
   460 class CMdaBitmapRotatorPriv;
   461 /**
   462 @publishedAll
   463 @deprecated 
   464 
   465 Replaced by Image Conversion library - see CBitmapRotator
   466 
   467 Rotates a bitmap.
   468 
   469 The class offers a simple interface to perform bitmap rotations in
   470 clockwise 90 degree increments. The target bitmap is resized as
   471 necessary.
   472 
   473 @since 5.0
   474 
   475 @see
   476 CBitmapRotator
   477 */
   478 class CMdaBitmapRotator : public CBase
   479 	{
   480 public:
   481 	/** Rotation angle.
   482 	*/
   483 	enum TRotationAngle
   484 		{
   485 		/** A clockwise rotation through 90 degrees.
   486 		*/
   487 		ERotation90DegreesClockwise,
   488 		/** A clockwise rotation through 180 degrees.
   489 		*/
   490 		ERotation180DegreesClockwise,
   491 		/** A clockwise rotation through 270 degrees.
   492 		*/
   493 		ERotation270DegreesClockwise,
   494 		/** The bitmap is mirrored about the horizontal axis.
   495 		*/
   496 		EMirrorFlipHorizontal,
   497 		/** The bitmap is mirrored about the vertical axis.
   498 		*/
   499 		EMirrorFlipVertical
   500 		};
   501 public:
   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();
   507 private:
   508 	CMdaBitmapRotatorPriv* iProperties;
   509 	};
   510 
   511 
   512 class CMdaBitmapScalerPriv;
   513 
   514 /**
   515 @publishedAll
   516 @deprecated
   517 
   518 Re-scales a bitmap.
   519 
   520 Replaced by Image Conversion library - see CBitmapScaler
   521 
   522 The class offers a simple interface to perform arbitrary re-scaling of
   523 a bitmap.
   524 
   525 @since 5.0
   526 @see CBitmapScaler
   527 */
   528 class CMdaBitmapScaler : public CBase
   529 	{
   530 public:
   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();
   536 private:
   537 	CMdaBitmapScalerPriv* iProperties;
   538 	};
   539 
   540 #endif
   541