CImageTransform Class Reference

class CImageTransform : public CBase

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

Inherits from

Public Member Functions
~CImageTransform ()
IMPORT_C void CancelTransform ()
IMPORT_C void ClearSourceRect ()
IMPORT_C CImageTransformPluginExtension * Extension ()
IMPORT_C CImageTransformPluginExtension * Extension ( TUid , TInt &)
IMPORT_C CImageTransform * NewL ( RFs &)
IMPORT_C void Reset ()
IMPORT_C void SetDestDataL ( HBufC8 *&)
IMPORT_C void SetDestFilenameL (const TDesC &)
IMPORT_C void SetDestSizeInPixelsL (const TSize &, TBool )
IMPORT_C void SetOptionsL ( TUint )
IMPORT_C void SetPluginUidL ( TUid )
IMPORT_C void SetPreserveImageData ( TBool )
IMPORT_C void SetSourceDataL (const TDesC8 &)
IMPORT_C void SetSourceFilenameL (const TDesC &)
IMPORT_C void SetSourceImageTypeL ( TUid , TUid )
IMPORT_C void SetSourceMimeTypeL (const TDesC8 &)
IMPORT_C void SetSourceRect (const TRect &)
IMPORT_C void SetTransformationsL ( TUint )
IMPORT_C void SetupL ()
IMPORT_C void Transform ( TRequestStatus &)
Private Member Functions
CImageTransform ()
void ConstructL ( RFs &)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Public Member Enumerations
enum TOptions { EOptionNone  = 0x00, EThumbnail  = 0x01, EIgnoreExifMetadataProcessing  = 0x02, EEnumBoundary  = 0x04 }
enum TTransformations {
ETransformationNone  = 0x00, EScale  = 0x01, ECrop  = 0x02, ESqueeze  = 0x04, EOrientation  = 0x08, EOverlay  = 0x10, EExif  = 0x20, ETransformEnumBoundary  = 0x40
}
Private Attributes
CImageTransformFramework * iBody

Constructor & Destructor Documentation

CImageTransform()

CImageTransform ( ) [private]

Constructor for this class.

~CImageTransform()

IMPORT_C ~CImageTransform ( )

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

Member Functions Documentation

CancelTransform()

IMPORT_C void CancelTransform ( )

Cancels any asynchronous image transform operation currently in progress.

ClearSourceRect()

IMPORT_C void ClearSourceRect ( )

Clears the clipping region.

ConstructL(RFs &)

void ConstructL ( RFs & aFs ) [private]

Performs second phase of contruction

Parameters

RFs & aFs A reference to a file server session for the transform API to use.

Extension()

IMPORT_C CImageTransformPluginExtension * Extension ( ) const
Gets a pointer to a plugin extension
panic
EIllegalCallSequence No plugin loaded.

Extension(TUid, TInt &)

IMPORT_C CImageTransformPluginExtension * Extension ( TUid aExtensionUid,
TInt & aError
) const
Gets a pointer to a plugin extension
panic
EIllegalCallSequence No plugin loaded.

Parameters

TUid aExtensionUid Uid of the required extension
TInt & aError System wide error

NewL(RFs &)

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

Constructs a CImageTransform object.

Parameters

RFs & aFs A reference to a file server session for the transform API to use.

Reset()

IMPORT_C void Reset ( )

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 void SetDestDataL ( 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.

leave
KErrArgument The pointer is not NULL

Parameters

HBufC8 *& aData The destination descriptor.

SetDestFilenameL(const TDesC &)

IMPORT_C void SetDestFilenameL ( const TDesC & aFilename )

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

leave
KArgument The length is zero

Parameters

const TDesC & aFilename The destination filename

SetDestSizeInPixelsL(const TSize &, TBool)

IMPORT_C void SetDestSizeInPixelsL ( const TSize & aDestinationSize,
TBool aMaintainAspectRatio = ETrue
)

Specifies the requested destination image size.

leave
KErrArgument The destination size is zero.

Parameters

const TSize & aDestinationSize The requested size of the destination size in pixels.
TBool aMaintainAspectRatio = ETrue Requests that the aspect ratio be maintained as far as possible. Defaults to ETrue.

SetOptionsL(TUint)

IMPORT_C void SetOptionsL ( TUint aOptions )

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 .

leave
KErrArgument One or more of the specified option flags is invalid

Parameters

TUint aOptions The required option or combination of options from CImageTransform::TOptions

SetPluginUidL(TUid)

IMPORT_C void SetPluginUidL ( TUid aPluginUid )

Specifies the UID of the image transform plugin to load

leave
KErrArgument The UID is KNullUid

Parameters

TUid aPluginUid The plugin's implementation UID

SetPreserveImageData(TBool)

IMPORT_C void SetPreserveImageData ( TBool aPreserveImageData )

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

TBool aPreserveImageData Requests that the aspect ratio be preserved Defaults to false

SetSourceDataL(const TDesC8 &)

IMPORT_C void SetSourceDataL ( 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.

leave
KErrArgument The length is zero

Parameters

const TDesC8 & aData The source descriptor

SetSourceFilenameL(const TDesC &)

IMPORT_C void SetSourceFilenameL ( const TDesC & aFilename )

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

leave
KNotFound The file does not exist

Parameters

const TDesC & aFilename The source filename

SetSourceImageTypeL(TUid, TUid)

IMPORT_C void SetSourceImageTypeL ( TUid aImageType,
TUid aImageSubType = KNullUid
)

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

leave
KErrArgument aImageType is KNullUid

Parameters

TUid aImageType The UID of the source image's type
TUid aImageSubType = KNullUid The UID of the source image's subtype

SetSourceMimeTypeL(const TDesC8 &)

IMPORT_C void SetSourceMimeTypeL ( const TDesC8 & aMIMEType )

Specifies the MIME type of the source image.

leave
KErrArgument The length is zero

Parameters

const TDesC8 & aMIMEType The MIME type of the source image

SetSourceRect(const TRect &)

IMPORT_C void SetSourceRect ( 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

const TRect & aRect The coordinates of the clipping region

SetTransformationsL(TUint)

IMPORT_C void SetTransformationsL ( TUint aTransformations )

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 .

leave
KErrArgument One or more of the specified transformation flags is invalid.

Parameters

TUint aTransformations The required transformation or combination of transformations from CImageTransform::TTransformations.

SetupL()

IMPORT_C void SetupL ( )

Requests that a suitable plugin be selected and instantiated.

leave
KErrNotFound No suitable plugin was found
leave
KErrNotReady A required parameter was not set before this call.
leave
KErrArgument A parameter incompatible with the transformation options was previously set.

Transform(TRequestStatus &)

IMPORT_C void Transform ( TRequestStatus & aStatus )

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

panic
EIllegalCallSequence No plugin loaded.

Parameters

TRequestStatus & aStatus Request status to signal when scaling is complete.

Member Enumerations 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.

Enumerators

EOptionNone = 0x00

No flag set. This is the default option

EThumbnail = 0x01

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.

EIgnoreExifMetadataProcessing = 0x02

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.

EEnumBoundary = 0x04

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

Enumerators

ETransformationNone = 0x00

No transformation set

EScale = 0x01

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

ECrop = 0x02

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

ESqueeze = 0x04

If set, the image is squeezed

EOrientation = 0x08

If set, the image is oriented

EOverlay = 0x10

If set, the image is blend with the overlay image

EExif = 0x20

If set, the plugin having exif extension is looked for

ETransformEnumBoundary = 0x40

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

Member Data Documentation

CImageTransformFramework * iBody

CImageTransformFramework * iBody [private]