williamr@2: // Copyright (c) 2007-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: // This is the public client API for the Image Transform Library williamr@2: // williamr@2: // williamr@4: williamr@2: /** williamr@2: @file williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: williamr@2: #ifndef __IMAGETRANSFORM_H__ williamr@2: #define __IMAGETRANSFORM_H__ williamr@2: williamr@2: #include williamr@2: #include williamr@2: // fwd refs williamr@2: class CImageTransformFramework; //fwd ref williamr@2: class CImageTransformPluginExtension; williamr@2: williamr@4: williamr@2: /** williamr@2: The public API for clients to call the Image Transform (scaling) library. williamr@2: This class provides functions to scale images held in files or descriptors. williamr@2: williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class CImageTransform : public CBase williamr@2: { williamr@2: public: williamr@2: /** williamr@2: Flags to control how the image is transformed. williamr@2: The EThumbnail and EIgnoreExifMetadataProcessing are mutually exclusive, williamr@2: and SHOULD NOT be used together. If they are, then EThumbnail is used. williamr@2: */ williamr@2: enum TOptions williamr@2: { williamr@2: /** No flag set. This is the default option*/ williamr@2: EOptionNone = 0x00, williamr@2: /** If set, the destination image will always have a thumbnail. williamr@2: If the source already has a thumbnail, then this is the one that will appear williamr@2: in the destination, otherwise one will be generated. */ williamr@2: EThumbnail = 0x01, williamr@2: /** If set, then the Exif data is not parsed and ExifMetaData() will always return NULL. If the source image is EXIF, williamr@2: then the EXIF information is copied without modification (i.e. without parsing) to the destination. In cases where williamr@2: the source is JFIF, the destination image is also JFIF. williamr@2: */ williamr@2: EIgnoreExifMetadataProcessing = 0x02, williamr@2: /** williamr@2: TOptions should not be set greater than or equal to this value. williamr@2: */ williamr@2: EEnumBoundary = 0x04 williamr@2: }; williamr@4: /** williamr@4: Flags to specify the desired transformations. williamr@4: If no flag or "EScale" flag is set then the framework will look for the plugins williamr@4: supporting scaling which includes all the plugins supporting williamr@4: version-1 opaque data and the plugins supporting version-2 opaque williamr@4: data with the scaling flag set. williamr@4: A plug-in supporting Squeeze, Orientation and Overlay in a single transform williamr@4: must perform these transformation in the order: Overlaying, Orientation and then williamr@4: Squeezing williamr@4: */ williamr@4: enum TTransformations williamr@4: { williamr@4: /** williamr@4: No transformation set williamr@4: */ williamr@4: ETransformationNone = 0x00, williamr@4: /** williamr@4: If set, the image is scaled based on the parameter passed in SetDestSizeInPixelsL(). williamr@4: */ williamr@4: EScale = 0x01, williamr@4: /** williamr@4: If set, the image is clipped based on the parameter passed in SetSourceRect(). williamr@4: */ williamr@4: ECrop = 0x02, williamr@4: /** williamr@4: If set, the image is squeezed williamr@4: */ williamr@4: ESqueeze = 0x04, williamr@4: /** williamr@4: If set, the image is oriented williamr@4: */ williamr@4: EOrientation = 0x08, williamr@4: /** williamr@4: If set, the image is blend with the overlay image williamr@4: */ williamr@4: EOverlay = 0x10, williamr@4: /** williamr@4: If set, the plugin having exif extension is looked for williamr@4: */ williamr@4: EExif = 0x20, williamr@4: /** williamr@4: TTransformations should not be set greater than or equal to this value williamr@4: */ williamr@4: ETransformEnumBoundary = 0x40 williamr@4: }; williamr@2: public: williamr@2: IMPORT_C static CImageTransform* NewL(RFs& aFs); williamr@2: IMPORT_C ~CImageTransform(); williamr@2: IMPORT_C void SetPluginUidL(TUid aPluginUid); williamr@2: IMPORT_C void SetSourceFilenameL(const TDesC& aFilename); williamr@2: IMPORT_C void SetSourceDataL(const TDesC8& aData); williamr@2: IMPORT_C void SetSourceMimeTypeL(const TDesC8& aMIMEType); williamr@2: IMPORT_C void SetSourceImageTypeL(TUid aImageType, TUid aImageSubType = KNullUid); williamr@2: IMPORT_C void SetSourceRect(const TRect& aRect); williamr@2: IMPORT_C void ClearSourceRect(); williamr@2: williamr@2: IMPORT_C void SetDestFilenameL(const TDesC& aFilename); williamr@2: IMPORT_C void SetDestDataL(HBufC8*& aData); williamr@2: IMPORT_C void SetDestSizeInPixelsL(const TSize& aDestinationSize, TBool aMaintainAspectRatio = ETrue); williamr@4: williamr@2: IMPORT_C void SetOptionsL(TUint aOptions); williamr@2: IMPORT_C void SetPreserveImageData(TBool aPreserveImageData); williamr@2: williamr@2: IMPORT_C void SetupL(); williamr@2: IMPORT_C void Transform(TRequestStatus& aStatus); williamr@2: IMPORT_C void CancelTransform(); williamr@2: IMPORT_C void Reset(); williamr@2: IMPORT_C CImageTransformPluginExtension* Extension() const; williamr@4: IMPORT_C CImageTransformPluginExtension* Extension(TUid aExtensionUid, TInt& aError) const; williamr@4: IMPORT_C void SetTransformationsL(TUint aTransformations); williamr@2: private: williamr@2: CImageTransform(); williamr@2: void ConstructL(RFs& aFs); williamr@2: williamr@2: private: williamr@2: CImageTransformFramework* iBody; williamr@2: }; williamr@2: williamr@2: #endif // __IMAGETRANSFORM_H__