CImageTransform Class Reference

#include <imagetransform.h>

Link against: imagetransform.lib

class CImageTransform : public CBase, public CBase

Inherits from

Detailed Description

The public API for clients to call the Image Transform (scaling) library. This class provides functions to scale images held in files or descriptors.

Member Enumeration Documentation

Enum TOptions

Flags to control how the image is transformed. The EThumbnail and EIgnoreExifMetadataProcessing are mutually exclusive, and SHOULD NOT be used together. If they are, then EThumbnail is used.

EnumeratorValueDescription
EOptionNone0x00

No flag set. This is the default option

EThumbnail0x01

If set, the destination image will always have a thumbnail. If the source already has a thumbnail, then this is the one that will appear in the destination, otherwise one will be generated.

EIgnoreExifMetadataProcessing0x02

If set, then the Exif data is not parsed and ExifMetaData() will always return NULL. If the source image is EXIF, then the EXIF information is copied without modification (i.e. without parsing) to the destination. In cases where the source is JFIF, the destination image is also JFIF.

EEnumBoundary0x04

TOptions should not be set greater than or equal to this value.

Enum TTransformations

Flags to specify the desired transformations. If no flag or "EScale" flag is set then the framework will look for the plugins supporting scaling which includes all the plugins supporting version-1 opaque data and the plugins supporting version-2 opaque data with the scaling flag set. A plug-in supporting Squeeze, Orientation and Overlay in a single transform must perform these transformation in the order: Overlaying, Orientation and then Squeezing

EnumeratorValueDescription
ETransformationNone0x00

No transformation set

EScale0x01

If set, the image is scaled based on the parameter passed in SetDestSizeInPixelsL().

ECrop0x02

If set, the image is clipped based on the parameter passed in SetSourceRect().

ESqueeze0x04

If set, the image is squeezed

EOrientation0x08

If set, the image is oriented

EOverlay0x10

If set, the image is blend with the overlay image

EExif0x20

If set, the plugin having exif extension is looked for

ETransformEnumBoundary0x40

TTransformations should not be set greater than or equal to this value

Constructor & Destructor Documentation

~CImageTransform ( )

IMPORT_C~CImageTransform()

This is the destructor for this class and is responsible for deallocating all resources

Member Function Documentation

CancelTransform ( )

IMPORT_C voidCancelTransform()

Cancels any asynchronous image transform operation currently in progress.

ClearSourceRect ( )

IMPORT_C voidClearSourceRect()

Clears the clipping region.

Extension ( )

IMPORT_C CImageTransformPluginExtension *Extension()const
Gets a pointer to a plugin extension
Return Value
A pointer to a fully constructed CImageTransformPluginExtension NULL, if there is no extension to the plugin
Panic Codes
EIllegalCallSequenceNo plugin loaded.

Extension ( TUid, TInt & )

IMPORT_C CImageTransformPluginExtension *Extension(TUidaExtensionUid,
TInt &aError
)const
Gets a pointer to a plugin extension
Parameters
aExtensionUidUid of the required extension
aErrorSystem wide error
Return Value
A pointer to a fully constructed CImageTransformPluginExtension NULL, if there is no extension to the plugin
Panic Codes
EIllegalCallSequenceNo plugin loaded.

NewL ( RFs & )

IMPORT_C CImageTransform *NewL(RFs &aFs)[static]

Constructs a CImageTransform object.

Parameters
aFsA reference to a file server session for the transform API to use.
Return Value
A pointer to a fully constructed CImageTransform.

Reset ( )

IMPORT_C voidReset()

Resets all SetXXX() calls so that the state is the same as that immediately after a call to NewL(). Deletes the plugin if one is loaded.

SetDestDataL ( HBufC8 *& )

IMPORT_C voidSetDestDataL(HBufC8 *&aData)

Defines the destination descriptor. This is a reference to a pointer that is owned by the client app. The pointer should be NULL; the plugin will take responsibility for allocating (and potentially growing) the descriptor.

Parameters
aDataThe destination descriptor.
Leave Codes
KErrArgumentThe pointer is not NULL

SetDestFilenameL ( const TDesC & )

IMPORT_C voidSetDestFilenameL(const TDesC &aFilename)

Specifies the name of the destination file where the transformed image is to be written to.

Parameters
aFilenameThe destination filename
Leave Codes
KArgumentThe length is zero

SetDestSizeInPixelsL ( const TSize &, TBool )

IMPORT_C voidSetDestSizeInPixelsL(const TSize &aDestinationSize,
TBoolaMaintainAspectRatio = ETrue
)

Specifies the requested destination image size.

Parameters
aDestinationSizeThe requested size of the destination size in pixels.
aMaintainAspectRatioRequests that the aspect ratio be maintained as far as possible. Defaults to ETrue.
Leave Codes
KErrArgumentThe destination size is zero.

SetOptionsL ( TUint )

IMPORT_C voidSetOptionsL(TUintaOptions)

Defines the options for the image transformation. The specified option must be one of the options supported or a combination of them, see CImageTransform::TOptions.

Parameters
aOptionsThe required option or combination of options from CImageTransform::TOptions
Leave Codes
KErrArgumentOne or more of the specified option flags is invalid

SetPluginUidL ( TUid )

IMPORT_C voidSetPluginUidL(TUidaPluginUid)

Specifies the UID of the image transform plugin to load

Parameters
aPluginUidThe plugin's implementation UID
Leave Codes
KErrArgumentThe UID is KNullUid

SetPreserveImageData ( TBool )

IMPORT_C voidSetPreserveImageData(TBoolaPreserveImageData)

Specifies that either the original image data is to preserved, as far as possible, or that the image data should be re-encoded to produce a more size-efficient image.

Parameters
aPreserveImageDataRequests that the aspect ratio be preserved Defaults to false

SetSourceDataL ( const TDesC8 & )

IMPORT_C voidSetSourceDataL(const TDesC8 &aData)

Specifies the source descriptor containing the image to transform. Note that this descriptor must persist while the the image is transformed. i.e. the transformation operation does not make a copy of the data. Special care must be taken when passing a TPtrC8 or TPtr8 to this function: The TPtrC8/TPtr8 itself (as well as the data it points to) must be persistent.

Parameters
aDataThe source descriptor
Leave Codes
KErrArgumentThe length is zero

SetSourceFilenameL ( const TDesC & )

IMPORT_C voidSetSourceFilenameL(const TDesC &aFilename)

Specifies the name of the source file containing the image to transform

Parameters
aFilenameThe source filename
Leave Codes
KNotFoundThe file does not exist

SetSourceImageTypeL ( TUid, TUid )

IMPORT_C voidSetSourceImageTypeL(TUidaImageType,
TUidaImageSubType = TUid::Null()
)

Specifies the source image's type and (optionally) its subtype

Parameters
aImageTypeThe UID of the source image's type
aImageSubTypeThe UID of the source image's subtype
Leave Codes
KErrArgumentaImageType is KNullUid

SetSourceMimeTypeL ( const TDesC8 & )

IMPORT_C voidSetSourceMimeTypeL(const TDesC8 &aMIMEType)

Specifies the MIME type of the source image.

Parameters
aMIMETypeThe MIME type of the source image
Leave Codes
KErrArgumentThe length is zero

SetSourceRect ( const TRect & )

IMPORT_C voidSetSourceRect(const TRect &aRect)

Defines a clipping region. Only the specified region will be converted. It is not supported by the Symbian Jpeg ImageTransform Plugin.

Parameters
aRectThe coordinates of the clipping region

SetTransformationsL ( TUint )

IMPORT_C voidSetTransformationsL(TUintaTransformations)

Defines the transformations to be supported by the desired plug-in. The specified transformation must be one of the transformations specified in CImageTransform::TTransformations or combination of them, see CImageTransform::TTransformations.

Parameters
aTransformationsThe required transformation or combination of transformations from CImageTransform::TTransformations.
Leave Codes
KErrArgumentOne or more of the specified transformation flags is invalid.

SetupL ( )

IMPORT_C voidSetupL()

Requests that a suitable plugin be selected and instantiated.

Leave Codes
KErrNotFoundNo suitable plugin was found
KErrNotReadyA required parameter was not set before this call.
KErrArgumentA parameter incompatible with the transformation options was previously set.

Transform ( TRequestStatus & )

IMPORT_C voidTransform(TRequestStatus &aStatus)

Initiates an asynchronous image transform operation. The framework will panic if no plugin has been instantiated already.

Parameters
aStatusRequest status to signal when scaling is complete.
Panic Codes
EIllegalCallSequenceNo plugin loaded.