1 // Copyright (c) 2008-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.
22 #ifndef __IMAGE_PROCESSOR_EFFECT_H__
23 #define __IMAGE_PROCESSOR_EFFECT_H__
26 #include <imageprocessor/imageprocessor_uids.hrh>
27 #include <imageprocessor/imageprocessor.h>
29 namespace ImageProcessor
31 class CImageProcessorImpl;
40 Uid used to gain access to the Sepia effect. @see ImageProcessor::CImgProcessor::EffectL
42 const TUid KEffectSepiaUid = {KEffectSepiaUidValue};
44 Uid used to gain access to the Grayscale effect. @see ImageProcessor::CImgProcessor::EffectL
46 const TUid KEffectGrayscaleUid = {KEffectGrayscaleUidValue};
48 Uid used to gain access to the Negative effect. @see ImageProcessor::CImgProcessor::EffectL
50 const TUid KEffectNegativeUid = {KEffectNegativeUidValue};
52 Uid used to gain access to the GrayscaleNegative effect. @see ImageProcessor::CImgProcessor::EffectL
54 const TUid KEffectGrayscaleNegativeUid = {KEffectGrayscaleNegativeUidValue};
56 Uid used to gain access to the Oily effect. @see ImageProcessor::CImgProcessor::EffectL
58 const TUid KEffectOilyUid = {KEffectOilyUidValue};
60 Uid used to gain access to the Paint effect. @see ImageProcessor::CImgProcessor::EffectL
62 const TUid KEffectPaintUid = {KEffectPaintUidValue};
64 Uid used to gain access to the Milky effect. @see ImageProcessor::CImgProcessor::EffectL
66 const TUid KEffectMilkyUid = {KEffectMilkyUidValue};
68 Uid used to gain access to the Fog effect. @see ImageProcessor::CImgProcessor::EffectL
70 const TUid KEffectFogUid = {KEffectFogUidValue};
72 Uid used to gain access to the MirrorLeftToRight effect. @see ImageProcessor::CImgProcessor::EffectL
74 const TUid KEffectMirrorLeftToRightUid = {KEffectMirrorLeftToRightUidValue};
76 Uid used to gain access to the MagicPen effect. @see ImageProcessor::CImgProcessor::EffectL
78 const TUid KEffectMagicPenUid = {KEffectMagicPenUidValue};
80 Uid used to gain access to the Brightness effect. @see ImageProcessor::CImgProcessor::EffectL
82 const TUid KEffectBrightnessUid = {KEffectBrightnessUidValue};
84 Uid used to gain access to the Sharpness effect. @see ImageProcessor::CImgProcessor::EffectL
86 const TUid KEffectSharpnessUid = {KEffectSharpnessUidValue};
88 Uid used to gain access to the Rotation effect. @see ImageProcessor::CImgProcessor::EffectL
90 const TUid KEffectRotationUid = {KEffectRotationUidValue};
92 Uid used to gain access to the Contrast effect. @see ImageProcessor::CImgProcessor::EffectL
94 const TUid KEffectContrastUid = {KEffectContrastUidValue};
96 Uid used to gain access to the RgbColorAdjust effect. @see ImageProcessor::CImgProcessor::EffectL
98 const TUid KEffectRgbColorAdjustUid = {KEffectRgbColorAdjustUidValue};
100 Uid used to gain access to the Emboss effect. @see ImageProcessor::CImgProcessor::EffectL
102 const TUid KEffectEmbossUid = {KEffectEmbossUidValue};
104 Uid used to gain access to the Solarize effect. @see ImageProcessor::CImgProcessor::EffectL
106 const TUid KEffectSolarizeUid = {KEffectSolarizeUidValue};
108 Uid used to gain access to the Posterize effect. @see ImageProcessor::CImgProcessor::EffectL
110 const TUid KEffectPosterizeUid = {KEffectPosterizeUidValue};
112 Uid used to gain access to the Stamp effect. @see ImageProcessor::CImgProcessor::EffectL
114 const TUid KEffectStampUid = {KEffectStampUidValue};
116 Uid used to gain access to the Sketch effect. @see ImageProcessor::CImgProcessor::EffectL
118 const TUid KEffectSketchUid = {KEffectSketchUidValue};
120 Uid used to gain access to the Noise effect. @see ImageProcessor::CImgProcessor::EffectL
122 const TUid KEffectNoiseUid = {KEffectNoiseUidValue};
124 Uid used to gain access to the Moonlight effect. @see ImageProcessor::CImgProcessor::EffectL
126 const TUid KEffectMoonlightUid = {KEffectMoonlightUidValue};
128 Uid used to gain access to the FrostedGlass effect. @see ImageProcessor::CImgProcessor::EffectL
130 const TUid KEffectFrostedGlassUid = {KEffectFrostedGlassUidValue};
132 Uid used to gain access to the Despeckle effect. @see ImageProcessor::CImgProcessor::EffectL
134 const TUid KEffectDespeckleUid = {KEffectDespeckleUidValue};
136 Uid used to gain access to the Blur effect. @see ImageProcessor::CImgProcessor::EffectL
138 const TUid KEffectBlurUid = {KEffectBlurUidValue};
140 Uid used to gain access to the Colorization effect. @see ImageProcessor::CImgProcessor::EffectL
142 const TUid KEffectColorizationUid = {KEffectColorizationUidValue};
144 Uid used to gain access to the Cartoon effect. @see ImageProcessor::CImgProcessor::EffectL
146 const TUid KEffectCartoonUid = {KEffectCartoonUidValue};
148 Uid used to gain access to the LocalBoost effect. @see ImageProcessor::CImgProcessor::EffectL
150 const TUid KEffectLocalBoostUid = {KEffectLocalBoostUidValue};
152 Uid used to gain access to the ColorBoost effect. @see ImageProcessor::CImgProcessor::EffectL
154 const TUid KEffectColorBoostUid = {KEffectColorBoostUidValue};
156 Uid used to gain access to the WhiteBalance effect. @see ImageProcessor::CImgProcessor::EffectL
158 const TUid KEffectWhiteBalanceUid = {KEffectWhiteBalanceUidValue};
160 Uid used to gain access to the AutoLevels effect. @see ImageProcessor::CImgProcessor::EffectL
162 const TUid KEffectAutoLevelsUid = {KEffectAutoLevelsUidValue};
164 Uid used to gain access to the Levels effect. @see ImageProcessor::CImgProcessor::EffectL
166 const TUid KEffectLevelsUid = {KEffectLevelsUidValue};
168 Uid used to gain access to the Exposure effect. @see ImageProcessor::CImgProcessor::EffectL
170 const TUid KEffectExposureUid = {KEffectExposureUidValue};
172 Uid used to gain access to the SpotLight effect. @see ImageProcessor::CImgProcessor::EffectL
174 const TUid KEffectSpotLightUid = {KEffectSpotLightUidValue};
176 Uid used to gain access to the CustomTransformation effect. @see ImageProcessor::CImgProcessor::EffectL
178 const TUid KEffectCustomTransformationUid = {KEffectCustomTransformationUidValue};
180 Uid used to gain access to the Antique effect. @see ImageProcessor::CImgProcessor::EffectL
182 const TUid KEffectAntiqueUid = {KEffectAntiqueUidValue};
186 Uid used to gain access to the GeometricalOperation effect. @see ImageProcessor::CImgProcessor::EffectL
188 const TUid KGeometricalOperationUid = {KGeometricalOperationUidValue};
190 Uid used to gain access to the Border effect. @see ImageProcessor::CImgProcessor::EffectL
192 const TUid KEffectBorderUid = {KEffectBorderUidValue};
195 The class is the parent class of all effects.
196 The extended class should implement three stages/functions: "begin -> set -> end"
204 /** Describes the type of the effect in terms of the type of parameter input to adjust levels. */
205 enum TEffectInputType
208 EEffectInputTypeReal32,
209 EEffectInputTypeCustom
213 inline TUid Type() const;
214 inline Plugin::MEffect& PluginEffect() const;
215 inline TBool IsActive() const;
217 IMPORT_C void BeginL();
218 IMPORT_C void EndL();
220 IMPORT_C TEffectInputType InputType() const;
222 IMPORT_C void SetLevelL(TInt aLevel);
223 IMPORT_C void LevelL(TInt& aLevel) const;
224 IMPORT_C void LevelSettings(TInt& aMinimumLevel, TInt& aMaximumLevel, TInt& aLevelStep) const;
226 IMPORT_C void SetLevelL(TReal32 aLevel);
227 IMPORT_C void LevelL(TReal32& aLevel) const ;
228 IMPORT_C void LevelSettings(TReal32& aMinimumLevel, TReal32& aMaximumLevel, TReal32& aLevelStep) const;
230 IMPORT_C void ResetL();
231 IMPORT_C TAny* Extension(TUid aExtension);
234 friend class CImageProcessorImpl;
238 TEffect(const TUid& aUid, Plugin::MEffect& aPluginEffect, CImageProcessorImpl& aImageProcessorImpl);
239 Plugin::MEffect& iPluginEffect;
242 CImageProcessorImpl& iImageProcessorImpl;
248 Gets the effect type.
250 @return The UID of the effect.
252 TUid TEffect::Type() const
258 Gets associated plugin of the effect.
260 @return A pointer to the related plugin effect instance.
262 Plugin::MEffect& TEffect::PluginEffect() const
264 return iPluginEffect;
268 Gets the state of the effect.
270 @return ETrue if the effect is active.
272 TBool TEffect::IsActive() const
278 The class provides functions to apply sepia effect to an image.
283 class TEffectSepia : public TEffect
286 friend class CImageProcessorImpl;
287 TEffectSepia(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl);
291 The class provides functions to convert an image to grayscale.
296 class TEffectGrayscale : public TEffect
299 friend class CImageProcessorImpl;
300 TEffectGrayscale(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl);
304 The class provides functions to convert an image similar to a photographic negative.
309 class TEffectNegative : public TEffect
312 friend class CImageProcessorImpl;
313 TEffectNegative(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl);
317 The class provides functions to convert an image to combined grayscale and negative. (Consider removing this effect)
322 class TEffectGrayscaleNegative : public TEffect
325 friend class CImageProcessorImpl;
326 TEffectGrayscaleNegative(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl);
330 The class provides functions to make an image look like an oil painting.
335 class TEffectOily : public TEffect
338 friend class CImageProcessorImpl;
339 TEffectOily(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl);
343 The class provides functions to make an image look like a painting (how is this distinct from an oil painting effect?).
348 class TEffectPaint : public TEffect
351 friend class CImageProcessorImpl;
352 TEffectPaint(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl);
356 The class provides functions to apply a "milky" surface effect to an image.
361 class TEffectMilky : public TEffect
364 friend class CImageProcessorImpl;
365 TEffectMilky(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl);
369 The class provides functions to apply a fog effect to an image.
374 class TEffectFog : public TEffect
377 friend class CImageProcessorImpl;
378 TEffectFog(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl);
382 The class provides functions to apply Antique effect to an image.
387 class TEffectAntique : public TEffect
390 friend class CImageProcessorImpl;
391 TEffectAntique(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl);
395 The class provides functions to apply a mirror effect to an image.
396 Mirrors the left side of the image on the right side of the image.
401 class TEffectMirrorLeftToRight : public TEffect
404 friend class CImageProcessorImpl;
405 TEffectMirrorLeftToRight(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl);
409 The class provides functions to apply a mix of edge distinction and color manipulation to an image.
414 class TEffectMagicPen : public TEffect
417 friend class CImageProcessorImpl;
418 TEffectMagicPen(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl);
422 The class provides functions to adjust the brightness level of an image.
427 class TEffectBrightness : public TEffect
430 friend class CImageProcessorImpl;
431 TEffectBrightness(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl);
435 The class provides functions to adjust the sharpness level of an image.
440 class TEffectSharpness : public TEffect
443 friend class CImageProcessorImpl;
444 TEffectSharpness(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl);
448 The class provides functions to rotate an image through an arbitrary angle.
453 class TEffectRotation : public TEffect
457 Parameters to control the scale of the image when rotation is applied
459 enum TRotationScaleMode
461 /** The image is not scaled when rotation is applied, which is the default mode*/
462 ERotationScaleModeIgnore,
463 /** The image will be rotated, and scaled to fit inside the margins of the original image*/
464 ERotationScaleModeFitInside,
465 /** The image will be rotated, and scaled to fully enclose the margins of the original image*/
466 ERotationScaleModeFitOutside
469 IMPORT_C TRotationScaleMode ScaleModeL() const;
470 IMPORT_C TReal32 AngleL() const;
471 IMPORT_C void SetRotationL(TRotationScaleMode aScaleMode, TReal32 aAngle);
474 friend class CImageProcessorImpl;
475 TEffectRotation(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl);
479 The class provides functions to apply contrast adjustment to an image.
484 class TEffectContrast : public TEffect
487 friend class CImageProcessorImpl;
488 TEffectContrast(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl);
492 The class provides functions to adjust the RGB color composition of an image
497 class TEffectRgbColorAdjust : public TEffect
500 IMPORT_C TReal32 RedLevelL() const;
501 IMPORT_C TReal32 GreenLevelL() const;
502 IMPORT_C TReal32 BlueLevelL() const;
503 IMPORT_C void SetRGBLevelL(TReal32 aRedLevel, TReal32 aGreenLevel, TReal32 aBlueLevel);
506 friend class CImageProcessorImpl;
507 TEffectRgbColorAdjust(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl);
511 The class provides functions to apply an emboss effect in grayscale to an image.
516 class TEffectEmboss : public TEffect
519 friend class CImageProcessorImpl;
520 TEffectEmboss(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl);
524 The class provides functions to apply a solarize look to an image.
529 class TEffectSolarize : public TEffect
532 friend class CImageProcessorImpl;
533 TEffectSolarize(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl);
537 The class provides functions to apply a posterize effect to an image. The number of colors is reduced.
542 class TEffectPosterize : public TEffect
545 friend class CImageProcessorImpl;
546 TEffectPosterize(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl);
550 The class provides functions to apply a rubber stamp effect. Result is a black/white image.
555 class TEffectStamp : public TEffect
558 IMPORT_C TInt SmoothnessLevelL() const;
559 IMPORT_C TInt ThresholdLevelL() const;
560 IMPORT_C void SetStampLevelL(TInt aSmoothnessLevel, TInt aThresholdLevel);
563 friend class CImageProcessorImpl;
564 TEffectStamp(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl);
567 The class provides functions to create a sketched representation of an image.
572 class TEffectSketch : public TEffect
576 Parameters to control the sketch mode.
580 /** Sketch the image in gray, which is the default mode*/
582 /** Sketch the image in color.*/
586 IMPORT_C TSketchMode SketchModeL() const;
587 IMPORT_C void SetSketchModeL(TSketchMode aLevel);
590 friend class CImageProcessorImpl;
591 TEffectSketch(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl);
595 The class provides functions to apply noise to an image
600 class TEffectNoise : public TEffect
603 friend class CImageProcessorImpl;
604 TEffectNoise(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl);
608 The class provides functions to apply a Moonlight effect to an image.
613 class TEffectMoonlight : public TEffect
616 void SetClockL(TInt16 aClock);
619 friend class CImageProcessorImpl;
620 TEffectMoonlight(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl);
624 The class provides functions to apply a "frosted glass" surface effect to an image.
629 class TEffectFrostedGlass : public TEffect
632 friend class CImageProcessorImpl;
633 TEffectFrostedGlass(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl);
637 The class provides functions to apply a "despeckle" surface effect to an image, which means to
638 remove noise from images without blurring edges.
643 class TEffectDespeckle : public TEffect
646 friend class CImageProcessorImpl;
647 TEffectDespeckle(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl);
651 The class provides functions to blur an area of the image.
656 class TEffectBlur : public TEffect
659 IMPORT_C TRect RectL() const;
660 IMPORT_C void SetRectL(TRect aRect);
663 friend class CImageProcessorImpl;
664 TEffectBlur(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl);
668 The class provides functions to adjust color tone and luminance/chrominance levels.
673 class TEffectColorization : public TEffect
676 IMPORT_C TRgb ReferenceColorL() const;
677 IMPORT_C TInt LuminanceStrengthL() const;
678 IMPORT_C TInt ChrominanceStrengthL() const;
679 IMPORT_C void SetColorizationL(TRgb aReferenceColor, TInt aLuminanceStrength, TInt aChrominanceStrength);
682 friend class CImageProcessorImpl;
683 TEffectColorization(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl);
687 The class provides functions to transform an image to typical cartoon graphics style.
692 class TEffectCartoon : public TEffect
695 IMPORT_C TBool DistinctEdgesL() const;
696 IMPORT_C void SetDistinctEdgesL(TBool aDistinctEdges);
699 friend class CImageProcessorImpl;
700 TEffectCartoon(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl);
704 The class provides functions to automatically boost and enhance images with unequal illumination.
709 class TEffectLocalBoost : public TEffect
712 friend class CImageProcessorImpl;
713 TEffectLocalBoost(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl);
717 The class provides functions to amplify the colors of an image.
722 class TEffectColorBoost : public TEffect
725 friend class CImageProcessorImpl;
726 TEffectColorBoost(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl);
730 The class provides functions to perform white balance adjustment on an image.
735 class TEffectWhiteBalance : public TEffect
739 Parameters to define the white balance modes.
741 enum TWhiteBalanceMode
743 /**Uses the estimated mean gray for the color correction, which is the default mode.*/
744 EWhiteBalanceMeanMode,
745 /**Uses the estimated maximum intensity color.*/
746 EWhiteBalanceMaxMode,
747 /**Uses a white reference color. */
748 EWhiteBalanceManualMode,
749 /**Calulates the reference from the mean value of the 256-bin distribution.*/
750 EWhiteBalanceClusterMode
754 IMPORT_C TWhiteBalanceMode WhiteBalanceModeL() const;
755 IMPORT_C TRgb ReferenceWhiteColorL() const;
756 IMPORT_C void SetWhiteBalanceL(TWhiteBalanceMode aWhiteBalanceMode, TRgb aReferenceWhiteColor);
759 friend class CImageProcessorImpl;
760 TEffectWhiteBalance(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl);
764 The class provides functions to apply auto level adjustment to an image.
765 Auto level adjustment balances the intensity level of the image, for example making dark images lighter and vice versa.
770 class TEffectAutoLevels : public TEffect
773 friend class CImageProcessorImpl;
774 TEffectAutoLevels(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl);
778 The class provides functions to apply white, gray and black level adjustment to an image.
783 class TEffectLevels : public TEffect
786 IMPORT_C TReal32 WhiteLevelL() const;
787 IMPORT_C TReal32 GrayLevelL() const;
788 IMPORT_C TReal32 BlackLevelL() const;
789 IMPORT_C void SetWGBLevelL(TReal32 aWhiteLevel, TReal32 aGrayLevel, TReal32 aBlackLevel);
792 friend class CImageProcessorImpl;
793 TEffectLevels(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl);
797 The class provides functions to control the exposure of an image.
802 class TEffectExposure : public TEffect
805 friend class CImageProcessorImpl;
806 TEffectExposure(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl);
810 The class provides functions to create a spotlight on an image.
815 class TEffectSpotLight : public TEffect
818 IMPORT_C void SpotLightOrientationL(TPoint &aPosition, TUint32& aRadius, TReal32& aTransitionSize) const;
819 IMPORT_C void SetSpotLightOrientationL(const TPoint& aPosition, TUint32 aRadius, TReal32 aTransitionSize);
822 friend class CImageProcessorImpl;
823 TEffectSpotLight(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl);
827 The class provides functions to make a custom transformation with an image.
832 class TEffectCustomTransformation : public TEffect
835 IMPORT_C void SetInputL(const TDesC& aFilename);
836 IMPORT_C void SetInputL(const TDesC8& aBuffer);
839 friend class CImageProcessorImpl;
840 TEffectCustomTransformation(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl);
844 The class provides functions to geometrically control an image.
849 class TGeometricalOperation : public TEffect
852 IMPORT_C CImgProcessor::TOperation Operation() const;
853 IMPORT_C void SetOperationL(CImgProcessor::TOperation aOperation);
856 friend class CImageProcessorImpl;
857 TGeometricalOperation(Plugin::MEffect& aEffect,CImageProcessorImpl& aImageProcessorImpl);
861 The class provides functions to insert a border to an image.
862 The border file can be input as File, Buffer or Bitmap.
867 class TEffectBorder : public TEffect
870 IMPORT_C void SetInputL(const TDesC& aFilename);
871 IMPORT_C void SetInputL(const TDesC8& aBuffer);
872 IMPORT_C void SetInputL(const CFbsBitmap& aBitmap);
875 friend class CImageProcessorImpl;
876 TEffectBorder(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl);
879 }//namespace ImageProcessor
881 #endif //__IMAGE_PROCESSOR_EFFECT_H__