diff -r 000000000000 -r 5752a19fdefe imaging/imagingfws/BitmapTransform/src/BitmapScalingBody.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imaging/imagingfws/BitmapTransform/src/BitmapScalingBody.cpp Wed Aug 25 12:29:52 2010 +0300 @@ -0,0 +1,124 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// BitmapScaling.cpp +// +// + +#include "BitmapTransformsBody.h" +#include "BitmapTransformsMain.h" +#include "BitmapTransforms.h" +#include +#include + +#include +#include + +/* +*The function NewL constructs a CBitmapScalerBody +* +*@return CBitmapScalerBody* +*/ +CBitmapScalerBody* CBitmapScalerBody::NewL() + { + CBitmapScalerBody* self = new(ELeave) CBitmapScalerBody(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/* +* +*CBitmapScalerBody() +*Constructor for this class. +*/ +CBitmapScalerBody::CBitmapScalerBody() + { + } + +/* +* +*ConstructL() +*Performs second phase of construction. +*/ +void CBitmapScalerBody::ConstructL() + { + TUid interfaceUid = {KUidBitmapScalerPlugin}; + iPlugin = + static_cast + (MmPluginUtils::CreateImplementationL(interfaceUid, iDestructorKey, KBitmTransPluginMatchString, KRomOnlyResolverUid)); + } + + +/* +* +*~CBitmapScalerBody +*This is the destructor for the CBitmapScalerBody +*and is resposible for deallocating all resources +*allocated by the CBitmapScalerBody. +*/ +CBitmapScalerBody::~CBitmapScalerBody() + { + delete iPlugin; + REComSession::DestroyedImplementation(iDestructorKey); + REComSession::FinalClose(); + } + +/* + * + * Begins the bitmap re-scaling operation. + * + * The scaling factor is based on the relative sizes of the source + * and target bitmaps. The operation is asynchronous. When it is + * complete, successfully or otherwise, the TRequestStatus & + * aStatus is set, passing the state of the operation. + * + * @param TRequestStatus* aRequestStatus + * + * @param "CFbsBitmap& aSrcBitmap" + * The bitmap to be re-scaled. + * @param "CFbsBitmap& aTgtBitmap" + * The target location for the re-scaled bitmap. + * @param "TBool aMaintainAspectRatio = ETrue" + * ETrue - the aspect ratio is retained; + * this is the default. The same scaling factor is + * applied in both the horizontal and vertical + * directions. This is the smaller of the horizontal + * scaling factor and the vertical scaling factor. + * EFalse - the aspect ratio need not be + * retained. + * + * + */ +void CBitmapScalerBody::Scale(TRequestStatus* aRequestStatus, + CFbsBitmap& aSrcBitmap, + CFbsBitmap& aTgtBitmap, + TBool aMaintainAspectRatio) + { + iPlugin->Scale(aRequestStatus, aSrcBitmap, aTgtBitmap, aMaintainAspectRatio); + } + +/* +* +* CustomCommand +* @param aUid +* @param aParam +* @return 'TInt' an error code indicating success or failure of the +* command +* +*/ +TInt CBitmapScalerBody::CustomCommand(TUid aUid, TAny* aParam) + { + return iPlugin->CustomCommand(aUid, aParam); + }