imaging/imagingfws/BitmapTransform/src/BitmapRotation.cpp
changeset 0 5752a19fdefe
equal deleted inserted replaced
-1:000000000000 0:5752a19fdefe
       
     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 "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 //
       
    15 
       
    16 #include "BitmapTransforms.h"
       
    17 #include "BitmapTransformsMain.h"
       
    18 #include "BitmapTransformsBody.h"
       
    19 
       
    20 /**
       
    21 Constructs a CBitmapRotator object.
       
    22 
       
    23 If any errors are encountered this function leaves with an appropriate leave code.
       
    24 
       
    25 @return A pointer to a CBitmapRotator object.
       
    26 */
       
    27 
       
    28 EXPORT_C CBitmapRotator* CBitmapRotator::NewL()
       
    29 	{
       
    30 	CBitmapRotator* self = new(ELeave) CBitmapRotator();
       
    31 	CleanupStack::PushL(self);
       
    32 	self->ConstructL();
       
    33 	CleanupStack::Pop(self);
       
    34 	return self;
       
    35 	}
       
    36 
       
    37 /*
       
    38 Constructor for this class.
       
    39 
       
    40 @internalTechnology
       
    41 */
       
    42 CBitmapRotator::CBitmapRotator()
       
    43 	{
       
    44 	}
       
    45 
       
    46 /*
       
    47 Performs second phase of contruction.
       
    48 
       
    49 @internalTechnology
       
    50 */
       
    51 void CBitmapRotator::ConstructL()
       
    52 	{
       
    53 	iBody = CBitmapRotatorBody::NewL();
       
    54 	}
       
    55 
       
    56 /**
       
    57 Default destructor for this class.
       
    58 
       
    59 Frees all resources owned by the object prior to its destruction.
       
    60 */
       
    61 
       
    62 EXPORT_C CBitmapRotator::~CBitmapRotator()
       
    63 	{
       
    64 	Cancel();
       
    65 
       
    66 	delete iBody;
       
    67 	}
       
    68 
       
    69 /**
       
    70 Cancels any outstanding action.
       
    71 */
       
    72 
       
    73 EXPORT_C void CBitmapRotator::Cancel()
       
    74 	{
       
    75 	if (iBody)
       
    76 		{
       
    77 		iBody->Cancel();
       
    78 		}
       
    79 	}
       
    80 
       
    81 /**
       
    82 Schedules a rotate/mirror operation on a bitmap supplied in the aSrcBitmap paramter and
       
    83 produces the output pointed to by aTgtBitmap.
       
    84 The CBitmapRotator is an active object and as such provides asynchronous operations. The result of the
       
    85 operation is pointed to by aRequestStatus.
       
    86 
       
    87 @pre
       
    88 - aRequestStatus is not a NULL pointer.
       
    89 - aSrcBitmap is a fully constructed bitmap of unknown size including zero dimension
       
    90 - aTgtBitmap is a fully constructed bitmap of unknown size including zero dimension
       
    91 - aAngle is a member of the enumeration TRotationAngle.
       
    92 
       
    93 @post
       
    94 If successful aTgtBitmap contains the rotated bitmap and aRequestStatus points to the value KErrNone.
       
    95 If unsuccessful the bitmap supplied in aSrcBitmap will remain unaltered.
       
    96 
       
    97 @param	aRequestStatus
       
    98 		A pointer to the completion status of the asynchronous operation.
       
    99 @param	aSrcBitmap
       
   100 		This bitmap should have been created
       
   101 @param	aTgtBitmap
       
   102 		This bitmap should have been created
       
   103 @param	aAngle
       
   104 		A member of the enumeration TRotationAngle that specifies the rotation mirror operation.
       
   105 
       
   106 @panic	ENoSourceBitmap
       
   107         This function panics with TBitmapTransformsMain::ENoSourceBitmap when the aSrcBitmap has not 
       
   108         been constructed ie. its handle is zero.
       
   109 */
       
   110 
       
   111 EXPORT_C void CBitmapRotator::Rotate(TRequestStatus* aRequestStatus, CFbsBitmap& aSrcBitmap, CFbsBitmap& aTgtBitmap, TRotationAngle aAngle)
       
   112 	{
       
   113 	ASSERT(iBody);
       
   114 	iBody->Rotate(aRequestStatus, aSrcBitmap, aTgtBitmap, aAngle);
       
   115 	}
       
   116 
       
   117 /**
       
   118 The function Rotate schedules a rotate/mirror operation on a bitmap supplied in the
       
   119 aBitmap whose output overwrites aBitmap. The result of the
       
   120 operation is pointed to by aRequestStatus.
       
   121 
       
   122 @pre
       
   123 - aRequestStatus is not a NULL pointer.
       
   124 - aBitmap is a fully constructed bitmap of unknown size including zero dimension.
       
   125 - aAngle is a member of the enumeration TRotationAngle.
       
   126 
       
   127 @param	aRequestStatus
       
   128 		A pointer to the completion status of the asynchronous operation.
       
   129 @param	aBitmap
       
   130 		A reference to a CFbsBitmap. This bitmap should have been created
       
   131 		and is also an output.
       
   132 @param	aAngle
       
   133 		A member of the enumeration TRotationAngle that specifies the rotation mirror operation.
       
   134 
       
   135 @panic	ENoSourceBitmap
       
   136         This function panics with TBitmapTransformsMain::ENoSourceBitmap when the aSrcBitmap has not 
       
   137         been constructed ie. its handle is 0.
       
   138 
       
   139 @post
       
   140 - aBitmap contains the rotated bitmap.
       
   141 - aRequestStatus points to the value KErrorNone.
       
   142 */
       
   143 
       
   144 EXPORT_C void CBitmapRotator::Rotate(TRequestStatus* aRequestStatus, CFbsBitmap& aBitmap, TRotationAngle aAngle)
       
   145 	{
       
   146 	ASSERT(iBody);
       
   147 	iBody->Rotate(aRequestStatus, aBitmap, aAngle);
       
   148 	}
       
   149 /**
       
   150 Provides custom command capabilties on CBitmapRotator. The command is dispatched on aUid and if 
       
   151 the command is not known KErrNotSupported will be returned. This function is synchronous.
       
   152 
       
   153 @pre
       
   154 When a command requires parameters aParam is not NULL.
       
   155 
       
   156 @param	aUid
       
   157 		The ID of the command.
       
   158 @param 	aParam
       
   159 		The command specific information.
       
   160 */
       
   161 EXPORT_C TInt CBitmapRotator::CustomCommand(TUid aUid, TAny* aParam)
       
   162 		{
       
   163 		ASSERT(iBody);
       
   164 		return iBody->CustomCommand( aUid, aParam );
       
   165 		}