1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
21 #ifndef ECAMIMAGEPROCESSING_H
22 #define ECAMIMAGEPROCESSING_H
27 #include <ecamadvsettingsuids.hrh>
28 #include <ecam/ecamconstants.h>
30 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
31 #include <ecamimageprocessingconst.h>
32 #include <ecamimageprocessingdef.h>
36 class MCameraImageProcessing;
37 class MCameraImageProcessing2;
38 class MCameraImageProcessing3;
40 class MImplementationFactory;
43 The current Version of the TColorOperationCapabilities class.
46 static const TUint KECamColorOperationCapabilitiesCurrentVersion = 1;
49 The current Version of the TBitsIgnore class.
52 static const TUint KECamBitsIgnoreCurrentVersion = 1;
55 The current Version of the TColorOperationEntry class.
58 static const TUint KECamColorOperationEntryCurrentVersion = 1;
61 /* General purpose constants */
64 Uid used to identify the CCamera Post Processing API.
65 Such image operations are performed on the acquired image by the camera itself.
66 @see CCamera::CCameraPresets
68 static const TUid KECamImageProcessingUid = {KECamImageProcessingUidValue};
70 /** Transformations */
72 /** Brightness adjustment - recognized range [-100:100] */
73 static const TUid KUidECamEventImageProcessingAdjustBrightness = {KUidECamEventImageProcessingAdjustBrightnessUidValue};
74 /** Contrast adjustment - recognized range [-100:100] */
75 static const TUid KUidECamEventImageProcessingAdjustContrast = {KUidECamEventImageProcessingAdjustContrastUidValue};
76 /** Gamma adjustment - recognized range [0:1000] */
77 static const TUid KUidECamEventImageProcessingAdjustGamma = {KUidECamEventImageProcessingAdjustGammaUidValue};
78 /** Sharpness adjustment - recognized range [-100:100] */
79 static const TUid KUidECamEventImageProcessingAdjustSharpness = {KUidECamEventImageProcessingAdjustSharpnessUidValue};
80 /** Saturation adjustment - recognized range [-100:100] */
81 static const TUid KUidECamEventtImageProcessingAdjustSaturation = {KUidECamEventtImageProcessingAdjustSaturationUidValue};
82 static const TUid KUidECamEventImageProcessingAdjustSaturation = {KUidECamEventtImageProcessingAdjustSaturationUidValue};
83 /** Hue adjustment - recognized range [-100:100] */
84 static const TUid KUidECamEventtImageProcessingAdjustHue = {KUidECamEventtImageProcessingAdjustHueUidValue};
85 static const TUid KUidECamEventImageProcessingAdjustHue = {KUidECamEventtImageProcessingAdjustHueUidValue};
89 static const TUid KUidECamEventImageProcessingEffect = {KUidECamEventImageProcessingEffectUidValue};
93 static const TUid KUidECamEventImageProcessingTransformCrop = {KUidECamEventImageProcessingTransformCropUidValue};
95 static const TUid KUidECamEventImageProcessingTransformRotate = {KUidECamEventImageProcessingTransformRotateUidValue};
97 static const TUid KUidECamEventImageProcessingTransformMirror = {KUidECamEventImageProcessingTransformMirrorUidValue};
99 static const TUid KUidECamEventImageProcessingTransformScale = {KUidECamEventImageProcessingTransformScaleUidValue};
101 static const TUid KUidECamEventImageProcessingSourceRect = {KUidECamEventImageProcessingSourceRectUidValue};
102 /** Noise reduction */
103 static const TUid KUidECamEventImageProcessingNoiseReduction = {KUidECamEventImageProcessingNoiseReductionUidValue};
105 static const TUid KUidECamEventImageProcessingGlareRemoval = {KUidECamEventImageProcessingGlareRemovalUidValue};
107 /** Default value for image processing */
108 static const TInt KECamImageProcessingDefaultValue = 0;
111 Uid used to indicate completion of StartColorSwap
114 static const TUid KUidECamEventCIPStartColorSwap = {KUidECamEventCIPStartColorSwapUidValue};
117 Uid used to indicate completion of StartColorAccent
120 static const TUid KUidECamEventCIPStartColorAccent = {KUidECamEventCIPStartColorAccentUidValue};
124 This class is used to perform image processing operations on the camera.
125 These include brightness, contrast, gamma, hue, sharpness and saturation adjustments. The client is also
126 able to perform simple image transformations like cropping, rotation, mirroring, scaling, noise reduction and glare reduction. .
127 When an operation selection is complete, all clients are notified with the respective event UID.
129 As often cameras may support only a subset of discrete values of the allowed range,
130 the API allows the client to retrieve those and use them explicitly.
132 @note This class is not intended for sub-classing and used to standardise existing
133 varieties of implementations.
135 @note it is assumed that setting a new value for a transformations(transform, adjust, effect) effectively
136 activates the transformations. Whilst for effects and adjustments there is always a value, transforms
137 may have a dependency on other parameters and
138 crop - requires setting of source rectangle.
139 scale - will use setting of source rectangle, and the magnification factor is
140 determined by the source rectangle and the output size. This is always magnification.
141 if a value is set, it is assumed to be a scaling factor multiplied by KECamFineResolutionFactor
143 mirror - values of TMirror type.
144 rotation - the angle in degrees.
145 noise reduction - TNoiseReduction.
146 glare removal - TGlareReduction.
151 // Lets assume that an application would need to check whether gamma correction is
152 // supported on a particular platform. After obtaining a valid pointer to the interface,
153 // it would call GetSupportedTransformationsL() to obtain the list of the supported
154 // transformations and check whether KUidECamEventImageProcessingAdjustGamma
155 // is in the list. If it is then call SetTranformationValue(KUidECamEventImageProcessingAdjustGamma, 200);
156 // to set the new value. A notification will be generated to the client to indicate success.
158 RArray<TUid> suppTransforms; // array of supported transformations
159 CleanupClosePushL(suppTransforms);
161 imageProcess->GetSupportedTransformationsL(suppTransfUids);
163 // if the gamma is supported
164 TInt gammaCorrection = 200; // gamma correction of 2.0
165 imageProcess->SetTranformationValue(KUidECamEventImageProcessingAdjustGamma, gammaCorrection);
167 // pop stack to close the RArray
170 @note If the class methods leave, the output type parameter value is not guaranteed to be valid.
175 class CCamera::CCameraImageProcessing : public CBase
178 // so can use internal factory functions etc.
179 friend class CCamera;
183 /** Gamma settings */
186 /** Sets the gamma adjustment automatically. */
187 EGammaAuto = KMinTInt
189 /** Sharpness Settings */
192 /** Sets the sharpness adjustment automatically. */
193 ESharpnessAuto = KMinTInt
195 /** Saturation Settings */
198 /** Sets the saturation adjustment automatically. */
199 ESaturationAuto = KMinTInt
204 /** Sets the hue adjustment automatically. */
208 /** Settings for the supported effects */
211 /** Effects off is default, always supported */
212 EEffectNone = 0x00000000,
213 /** Negative visual effect. */
214 EEffectNegative = 0x00000001,
215 /** Black and white visual effect. */
216 EEffectMonochrome = 0x00000002,
217 /** Solarization visual effect. */
218 EEffectSolarize = 0x00000004,
219 /** Sepia visual effect. */
220 EEffectSepia = 0x00000008,
221 /** Emboss visual effect. */
222 EEffectEmboss = 0x00000010,
223 /** Red eye glare reduction visual effect. */
224 EEffectRedEyeReduction = 0x00000020,
225 /** Vivid colour visual effect. */
226 EEffectVivid = 0x00000040,
227 /** Neutral colour visual effect. */
228 EEffectNeutral = 0x00000080,
229 /** Selective sharpening visual effect. */
230 EEffectLowSharpening = 0x00000100,
232 Natural visual effect.
234 This enum value is available from the 'supported' or 'getter' methods only to the API clients using CCamera::New2L() or
235 CCamera::NewDuplicate2L().
238 EEffectNatural = 0x00000200,
242 This enum value is available from the 'supported' or 'getter' methods only to the API clients using CCamera::New2L() or
243 CCamera::NewDuplicate2L().
246 EEffectCine = 0x00000400,
248 Old film visual effect.
250 This enum value is available from the 'supported' or 'getter' methods only to the API clients using CCamera::New2L() or
251 CCamera::NewDuplicate2L().
254 EEffectOldFilm = 0x00000800,
256 Color swap visual effect.
258 This enum value is available from the 'supported' or 'getter' methods only to the API clients using CCamera::New2L() or
259 CCamera::NewDuplicate2L().
262 EEffectColorSwap = 0x00001000,
264 Where a list of color can be kept as they are and the rest converted to gray.
266 This enum value is available from the 'supported' or 'getter' methods only to the API clients using CCamera::New2L() or
267 CCamera::NewDuplicate2L().
270 EEffectColorAccent = 0x00002000
273 /** Mirror settings */
276 /** Default value. Mirroring is disabled. */
277 EMirrorNone = 0x00000000,
278 /** Mirror along horizontal axis. */
279 EMirrorHorizontal = 0x00000001,
280 /** Mirror along vertical axis. */
281 EMirrorVertical = 0x00000002,
282 /** Mirror along horizontal and vertical axis. */
283 EMirrorBoth = 0x00000003
286 /** Noise filter settings */
289 /** Default value. Noise reduction disabled. */
290 ENoiseReductionNone = 0x0000,
291 /** most basic noise reduction. */
292 ENoiseReductionBasic = 0x0001
295 /** Glare reduction settings */
298 /** Default value. Glare reduction disabled. */
299 EGlareReductionNone = 0x0000,
300 /** most basic glare reduction. */
301 EGlareReductionBasic = 0x0001
305 Used for color swap and color accent feature in TEffect. It describes whether the given source
306 or target color represents itself or a group of color.
309 enum TColorOperationRepresentation
311 /** Feature is not supported */
312 ERepresentationNone = 0x00,
313 /** The given color is uniquely represented */
314 ERepresentationSingle = 0x01,
315 /** The given color represents a group of colors */
316 ERepresentationMultiple = 0x02
320 Used for color swap and color accent feature in TEffect. It describes the type of grouping for
321 source and target colors when they represent a group of color.
324 enum TColorOperationRgbGroupingMode
326 /** Feature is not supported */
327 ERgbGroupingNone = 0x00,
328 /** This means no neighbourhood colors are considered */
329 ERgbGroupingFixed = 0x01,
330 /** This means neighbourhood colors are to be automatically decided by the implementation or hardware */
331 ERgbGroupingAutomatic = 0x02,
332 /** This means neighbourhood colors for source have to be decided by ignoring few starting bits. Used for source only */
333 ERgbGroupingSignificantBits = 0x04,
334 /** This means colors in target are obtained as some uniform proportion using source. Used for target only */
335 ERgbGroupingUniform = 0x08
339 Used to provide different types of references for orientation of images retrieved. These references are the various
340 means by the orientation of an image can be defined. Client needs to choose a particular TOrientationReference and
341 specify any relative rotation, mirroring and flipping on top of it.
343 This enumeration has nothing to do with absolute rotation. Uid KUidECamEventImageProcessingTransformRotate is used
344 for absolute rotation purposes.
346 The enumeration list may be extended in future.
351 enum TOrientationReference
353 /** The retrieved images will follow the camera sensor orientation. This orientation would be relative
354 to the current screen mode as given by the reference screen. */
355 EOrientationReferenceCameraSensorOrientation,
357 /** The retrieved images will get oriented as per the tilt sensor information.
358 So,the orientation would be relative to the current screen mode as given by the reference screen. */
359 EOrientationReferenceTiltOrientation
363 Used to describe the various relative rotation. The term 'relative' means that the rotation is applied after the
364 image undergoes orientation as given by TOrientationReference.
366 The enumeration list may be extended in future.
371 enum TRelativeRotation
373 /** Zero degree Rotation applied on top of orientation reference and is relative to current reference screen. */
374 ERelativeRotation0Degrees = 0x00,
375 /** 90 degree clockwise Rotation applied on top of orientation reference and is relative to current reference screen. */
376 ERelativeRotation90DegreesClockwise = 0x01,
377 /** 180 degree clockwise Rotation applied on top of orientation reference and is relative to current reference screen. */
378 ERelativeRotation180DegreesClockwise = 0x02,
379 /** 270 degree clockwise Rotation applied on top of orientation reference and is relative to current reference screen. */
380 ERelativeRotation270DegreesClockwise = 0x04
384 Used to describe the various relative mirroring. The term 'relative' means that the mirroring is applied after the
385 image undergoes orientation as given by TOrientationReference.
387 The enumeration list may be extended in future.
395 ERelativeMirrorNone = 0x00,
396 /** Used to mirror an image about the horizontal axis. This is applied on top of orientation reference and is
397 relative to current reference screen. */
398 ERelativeMirrorHorizontalAxis = 0x10,
399 /** Used to mirror an image about the vertical axis. This is applied on top of orientation reference and is
400 relative to current reference screen. */
401 ERelativeMirrorVerticalAxis = 0x20
405 Used to describe the various relative flipping. The term 'relative' means that the flipping is applied after the
406 image undergoes orientation as given by TOrientationReference.
408 The enumeration list may be extended in future.
413 enum TRelativeFlipping
416 ERelativeFlippingNone = 0x00,
417 /** Used to flip an image horizontally. This is applied on top of orientation reference and is relative to current
419 ERelativeFlippingHorizontal = 0x10,
420 /** Used to flip an image vertically. This is applied on top of orientation reference and is relative to current
422 ERelativeFlippingVertical = 0x20
426 Different types of contrast enhancement options.
427 The enumeration list may be extended in future.
432 enum TContrastEnhancement
434 /** Not Supported. */
435 EContrastEnhancementNone =0x00,
436 /** Contrast Enhancement switched off. */
437 EContrastEnhancementSwitchOff =0x01,
438 /** Contrast Enhacement switched On manually. */
439 EContrastEnhancementManualSwitchOn =0x02,
440 /** Contrast Enhancement in auto mode. */
441 EContrastEnhancementSwitchAuto =0x04
445 Different types of software-based red eye reduction options.
446 The enumeration list may be extended in future.
451 enum TRedEyeReduction
453 /** Not Supported. */
454 ERedEyeReductionNone =0x00,
455 /** Software based Red Eye Reduction can be switched off(disabled). */
456 ERedEyeReductionSwitchOff =0x01,
457 /** Software based Red Eye Reduction can be switched on (enabled). */
458 ERedEyeReductionManualSwitchOn =0x02,
459 /** Software based Red Eye Reduction can be put to auto mode. */
460 ERedEyeReductionSwitchAuto =0x04
464 Color operation capabilities characterizing both color swap and color accent feature
467 class TColorOperationCapabilities
472 Sets the size of this class in iSize.
474 IMPORT_C TColorOperationCapabilities();
476 IMPORT_C TInt Size() const;
477 IMPORT_C TUint Version() const;
480 //for future expansion
484 // reserved for future expansion
488 /** The source color representation that the server supports.
489 The supported representations are held as a bitwise logical OR of the relevant individual modes
490 defined in CCamera::CCameraImageProcessing:: TColorOperationRepresentation. */
491 TUint iSupportedSourceRepresentation;
493 /** The target color representation that the server supports.
494 The supported representations are held as a bitwise logical OR of the relevant individual modes
495 defined in CCamera::CCameraImageProcessing:: TColorOperationRepresentation.
496 Not applicable for color accent */
497 TUint iSupportedTargetRepresentation;
499 /** The source color Rgb grouping modes that the server supports.
500 The modes are held as a bitwise logical OR of the relevant individual modes
501 defined in CCamera::CCameraImageProcessing:: TColorOperationRgbGroupingMode. */
502 TUint iSupportedSourceRgbGroupingMode;
504 /** The target color Rgb grouping modes that the server supports.
505 The modes are held as a bitwise logical OR of the relevant individual modes
506 defined in CCamera::CCameraImageProcessing:: TColorOperationRgbGroupingMode.
507 Not applicable for color accent */
508 TUint iSupportedTargetRgbGroupingMode;
510 /** This indicates whether the mapping mode and Rgb grouping mode uniform for every color entry */
511 TBool iIsCapabilityUniform;
515 Class used to control the number of bits to ignore for Red, Green, Blue or Alpha.
516 This may be used when deciding for neighbourhood for source color in case of color swap and color accent feature
524 Sets the size of this class in iSize.
526 IMPORT_C TBitsIgnore();
528 IMPORT_C TInt Size() const;
529 IMPORT_C TUint Version() const;
532 //for future expansion
537 TUint iReservedBits:16;
540 /** This gives the no. of bits to ignore for Red color. Varies from 0 to 8.
541 Any other value should be an error */
542 TUint iRedBitsIgnore:4;
544 /** This gives the no. of bits to ignore for Green color. Varies from 0 to 8.
545 Any other value should be an error */
546 TUint iGreenBitsIgnore:4;
548 /** This gives the no. of bits to ignore for Blue color. Varies from 0 to 8.
549 Any other value should be an error */
550 TUint iBlueBitsIgnore:4;
552 /** This gives the no. of bits to ignore for Alpha. Varies from 0 to 8.
553 Any other value should be an error */
554 TUint iAlphaBitsIgnore:4;
558 Color operation parameters characterizing both color swap and color accent feature; and for a particular entry.
561 class TColorOperationEntry
566 Sets the size of this class in iSize.
568 IMPORT_C TColorOperationEntry();
570 IMPORT_C TInt Size() const;
571 IMPORT_C TUint Version() const;
574 //for future expansion
578 // reserved for future expansion
582 /** The source color (rgb triplet) which is changed to target color in case of Color Swap operation
583 and remains unaffected in case of Color Accent operation */
586 /** The target color (rgb triplet) which replaces the source color in case of Color Swap operation.
587 Redundant for Color Accent operation */
590 /** This defines whether the given source color represents itself or a group of colors */
591 TColorOperationRepresentation iSourceColorRepresentation;
593 /** This defines whether the given target color represents itself or a group of colors in case of
594 Color Swap operation. Redundant for Color Accent operation */
595 TColorOperationRepresentation iTargetColorRepresentation;
597 /** This defines the type of grouping for multiple representation of source color */
598 TColorOperationRgbGroupingMode iColorOperationSourceRgbGroupingMode;
600 /** This defines the type of grouping for multiple representation of target color in case of
601 Color Swap operation. Redundant for Color Accent operation */
602 TColorOperationRgbGroupingMode iColorOperationTargetRgbGroupingMode;
604 /** This gives the number of bits to ignore in case ERgbGroupingSignificantBits is used for
605 multiple representation of source color. For any other case, no. of bits ignored for red, green,
606 blue or alpha should be 0 */
607 TBitsIgnore iNumBitsIgnored;
609 /** This gives the entry status of every color operation entry. If entry is not set or removed,
610 this is ENotActive. And if entry is set, then this is EDiscreteSteps */
611 TValueInfo iEntryStatus;
616 IMPORT_C static CCameraImageProcessing* NewL(CCamera& aCamera);
618 IMPORT_C static CCameraImageProcessing* CreateL(CCamera& aCamera, MImplementationFactory& aImplFactory);
620 IMPORT_C void GetSupportedTransformationsL(RArray<TUid>& aTransformations) const;
622 IMPORT_C void GetActiveTransformationsL(RArray<TUid>& aTransformations) const;
624 IMPORT_C void GetTransformationSupportedValuesL(TUid aTransformation, RArray<TInt>& aValues, TValueInfo& aInfo) const;
626 IMPORT_C TInt TransformationValue(TUid aTransformation) const;
628 IMPORT_C TInt GetTransformationValue(TUid aTransformation, TInt& aTransformationValue) const;
630 IMPORT_C void SetTransformationValue(TUid aTransformation, TInt aValue);
632 IMPORT_C void GetActiveTransformSequenceL(RArray<TUid>& aTransformSequence) const;
634 IMPORT_C void SetActiveTransformSequenceL(RArray<TUid>& aTransformSequence);
636 IMPORT_C void SetSourceRect(const TRect& aRect);
638 IMPORT_C void GetSourceRect(TRect& aRect) const;
640 IMPORT_C ~CCameraImageProcessing();
642 IMPORT_C void GetConcurrentColorSwappingsSupportedL(TInt& aConcurrentColorSwappingSupported) const;
644 IMPORT_C void GetColorSwapCapabilitiesL(TInt aIndex, TColorOperationCapabilities& aColorSwapCapabilities) const;
646 IMPORT_C void SetColorSwapEntryL(TInt aIndex, const TColorOperationEntry& aColorSwapParameters);
648 IMPORT_C void RemoveColorSwapEntryL(TInt aIndex);
650 IMPORT_C void GetColorSwapEntryL(TInt aIndex, TColorOperationEntry& aColorSwapParameters) const;
652 IMPORT_C void StartColorSwappingL();
654 IMPORT_C void CancelColorSwappingL();
656 IMPORT_C void GetConcurrentColorAccentSupportedL(TInt& aConcurrentColorAccentSupported) const;
658 IMPORT_C void GetColorAccentCapabilitiesL(TInt aIndex, TColorOperationCapabilities& aColorAccentCapabilities) const;
660 IMPORT_C void SetColorAccentEntryL(TInt aIndex, const TColorOperationEntry& aColorAccentParameters);
662 IMPORT_C void RemoveColorAccentEntryL(TInt aIndex);
664 IMPORT_C void GetColorAccentEntryL(TInt aIndex, TColorOperationEntry& aColorAccentParameters) const;
666 IMPORT_C void StartColorAccentL();
668 IMPORT_C void CancelColorAccentL();
670 IMPORT_C void GetSupportedRelativeOrientationOptionsL(TOrientationReference aOrientationReference,
671 TUint& aSupportedRelativeRotation, TUint& aSupportedRelativeMirroring, TUint& aSupportedRelativeFlipping) const;
673 IMPORT_C void GetCurrentRelativeOrientationOptionsL(TOrientationReference& aOrientationReference,
674 TRelativeRotation& aRelativeRotation, TRelativeMirror& aRelativeMirror, TRelativeFlipping& aRelativeFlipping) const;
676 IMPORT_C void SetRelativeOrientationOptionsL(TOrientationReference aOrientationReference,
677 TRelativeRotation aRelativeRotation, TRelativeMirror aRelativeMirror, TRelativeFlipping aRelativeFlipping);
680 CCameraImageProcessing(CCamera& aOwner);
682 void ConstructL(const MImplementationFactory& aImplFactory);
686 MCameraImageProcessing* iImpl; // not owned
687 MCameraImageProcessing2* iImpl2; //not owned
688 MCameraImageProcessing3* iImpl3; //not owned
690 #endif//ECAMIMAGEPROCESSING_H