author | William Roberts <williamr@symbian.org> |
Wed, 31 Mar 2010 12:33:34 +0100 | |
branch | Symbian3 |
changeset 4 | 837f303aceeb |
permissions | -rw-r--r-- |
williamr@4 | 1 |
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
williamr@4 | 2 |
// All rights reserved. |
williamr@4 | 3 |
// This component and the accompanying materials are made available |
williamr@4 | 4 |
// under the terms of "Eclipse Public License v1.0" |
williamr@4 | 5 |
// which accompanies this distribution, and is available |
williamr@4 | 6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
williamr@4 | 7 |
// |
williamr@4 | 8 |
// Initial Contributors: |
williamr@4 | 9 |
// Nokia Corporation - initial contribution. |
williamr@4 | 10 |
// |
williamr@4 | 11 |
// Contributors: |
williamr@4 | 12 |
// |
williamr@4 | 13 |
// Description: |
williamr@4 | 14 |
// This is Image Transform extension for Squeeze Transformation |
williamr@4 | 15 |
// |
williamr@4 | 16 |
// |
williamr@4 | 17 |
|
williamr@4 | 18 |
/** |
williamr@4 | 19 |
@file |
williamr@4 | 20 |
@publishedAll |
williamr@4 | 21 |
@released |
williamr@4 | 22 |
*/ |
williamr@4 | 23 |
|
williamr@4 | 24 |
#ifndef __SQUEEZETRANFORMEEXTENSION_H__ |
williamr@4 | 25 |
#define __SQUEEZETRANFORMEEXTENSION_H__ |
williamr@4 | 26 |
|
williamr@4 | 27 |
#include <e32base.h> |
williamr@4 | 28 |
#include <icl/imagetransformpluginext.h> |
williamr@4 | 29 |
#include <imageframeconst.h> |
williamr@4 | 30 |
|
williamr@4 | 31 |
/** |
williamr@4 | 32 |
@publishedAll |
williamr@4 | 33 |
@released |
williamr@4 | 34 |
|
williamr@4 | 35 |
This class provides advanced parameters for squeezing |
williamr@4 | 36 |
*/ |
williamr@4 | 37 |
class TAdvancedSqueezeParams |
williamr@4 | 38 |
{ |
williamr@4 | 39 |
public: |
williamr@4 | 40 |
/** |
williamr@4 | 41 |
The different behaviours of auto resize |
williamr@4 | 42 |
*/ |
williamr@4 | 43 |
enum TAutoResizeAction |
williamr@4 | 44 |
{ |
williamr@4 | 45 |
/** |
williamr@4 | 46 |
Preserves the source encoding quality while shrinking the width and height of the image |
williamr@4 | 47 |
*/ |
williamr@4 | 48 |
EAutoResizeActionPreserveSourceEncodingQuality, |
williamr@4 | 49 |
/** |
williamr@4 | 50 |
Tries to preserve the max image size while lowering the encoding quality |
williamr@4 | 51 |
*/ |
williamr@4 | 52 |
EAutoResizeActionPrioritizeLargeImageSize, |
williamr@4 | 53 |
/** |
williamr@4 | 54 |
Tries to preserve the highest possible encoding quality while shrinking the width and height of the image |
williamr@4 | 55 |
*/ |
williamr@4 | 56 |
EAutoResizeActionResizePrioritizeHighEncodingQuality, |
williamr@4 | 57 |
/** |
williamr@4 | 58 |
Simultaneously lower the encoding quality and shrink the width and height of the image |
williamr@4 | 59 |
*/ |
williamr@4 | 60 |
EAutoResizeActionMiddleCourse |
williamr@4 | 61 |
}; |
williamr@4 | 62 |
|
williamr@4 | 63 |
IMPORT_C TAdvancedSqueezeParams(); |
williamr@4 | 64 |
|
williamr@4 | 65 |
/** |
williamr@4 | 66 |
The desired max size of the transformed image in bytes. |
williamr@4 | 67 |
*/ |
williamr@4 | 68 |
TUint iMaxDestSizeInBytes; |
williamr@4 | 69 |
|
williamr@4 | 70 |
/** |
williamr@4 | 71 |
The transformed image must not be smaller than this. The |
williamr@4 | 72 |
size must be smaller than the iMaxImageSize |
williamr@4 | 73 |
*/ |
williamr@4 | 74 |
TSize iMinImageSize; |
williamr@4 | 75 |
|
williamr@4 | 76 |
/** |
williamr@4 | 77 |
The transformed image must not be bigger than this. The size |
williamr@4 | 78 |
must be bigger than the iMinImageSize |
williamr@4 | 79 |
*/ |
williamr@4 | 80 |
TSize iMaxImageSize; |
williamr@4 | 81 |
|
williamr@4 | 82 |
/** |
williamr@4 | 83 |
The desired behaviour of the auto resize |
williamr@4 | 84 |
*/ |
williamr@4 | 85 |
TInt iResizeAction; |
williamr@4 | 86 |
|
williamr@4 | 87 |
/** |
williamr@4 | 88 |
The lowest desired encoding quality. |
williamr@4 | 89 |
Must be in the range (0.0) to (1.0) |
williamr@4 | 90 |
*/ |
williamr@4 | 91 |
TReal32 iMinEncodingQuality; |
williamr@4 | 92 |
|
williamr@4 | 93 |
/** |
williamr@4 | 94 |
The color spacing of the transformed image |
williamr@4 | 95 |
*/ |
williamr@4 | 96 |
TUid iSamplingUid; |
williamr@4 | 97 |
private: |
williamr@4 | 98 |
// Future proof |
williamr@4 | 99 |
TAny* iPad1; |
williamr@4 | 100 |
TAny* iPad2; |
williamr@4 | 101 |
TAny* iPad3; |
williamr@4 | 102 |
TAny* iPad4; |
williamr@4 | 103 |
}; |
williamr@4 | 104 |
|
williamr@4 | 105 |
/** |
williamr@4 | 106 |
@publishedAll |
williamr@4 | 107 |
@released |
williamr@4 | 108 |
|
williamr@4 | 109 |
Squeeze Extension to the ImageTransform plugin |
williamr@4 | 110 |
|
williamr@4 | 111 |
The class provides the methods to set the squeeze parameters and is intended to be implemented |
williamr@4 | 112 |
by the plugins supporting the squeezing of the images. The client can set the desired max size |
williamr@4 | 113 |
(in bytes) of the squeezed image and it can also enable auto resizing of the image by setting the |
williamr@4 | 114 |
advanced squeeze parameters. The plugin supporting this extension must use the opaque_data v2 format |
williamr@4 | 115 |
in RSS file and also the squeeze flag must be set in the opaque_data. The client must |
williamr@4 | 116 |
retrieve this extension implementation from the plugin using its extension UID. |
williamr@4 | 117 |
|
williamr@4 | 118 |
In the case where the client's desired size cannot be met the operation will squeeze to the |
williamr@4 | 119 |
smallest file possible and the transform operation will leave with KErrGeneral. The output file |
williamr@4 | 120 |
must be examined by the client to determine its suitability. The client must clean up if the |
williamr@4 | 121 |
output is not acceptable. |
williamr@4 | 122 |
*/ |
williamr@4 | 123 |
class CSqueezeTransformExtension : public CImageTransformPluginExtension |
williamr@4 | 124 |
{ |
williamr@4 | 125 |
public: |
williamr@4 | 126 |
IMPORT_C void SetDestSizeInBytes(TUint aMaxDestDataSize ) ; |
williamr@4 | 127 |
IMPORT_C void SetAdvancedSqueezeModeL(TAdvancedSqueezeParams* aSqueezeAutoResizeParams ) ; |
williamr@4 | 128 |
|
williamr@4 | 129 |
protected: |
williamr@4 | 130 |
virtual void DoSetDestSizeInBytes(TUint aMaxDestDataSize ) = 0; |
williamr@4 | 131 |
virtual void DoSetAdvancedSqueezeModeL(TAdvancedSqueezeParams* aSqueezeAutoResizeParams ) = 0; |
williamr@4 | 132 |
|
williamr@4 | 133 |
private: |
williamr@4 | 134 |
IMPORT_C virtual void ReservedVirtual5(); |
williamr@4 | 135 |
|
williamr@4 | 136 |
private: |
williamr@4 | 137 |
// Future proofing |
williamr@4 | 138 |
TAny* iPad; |
williamr@4 | 139 |
}; |
williamr@4 | 140 |
|
williamr@4 | 141 |
#endif // __SQUEEZETRANFORMEEXTENSION_H__ |