|
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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 |
|
17 #include <imageprocessor/imageprocessoreffect.h> |
|
18 #include <imageprocessor/imageprocessorplugineffect.h> |
|
19 #include "imageprocessorimpl.h" |
|
20 #include <imageprocessor/imageprocessor.h> |
|
21 |
|
22 namespace ImageProcessor |
|
23 { |
|
24 |
|
25 /** |
|
26 Constructor. |
|
27 |
|
28 @param aUid The uid of the effect. |
|
29 @param aPluginEffect The effect plugin. |
|
30 @param aImageProcessorImpl The image processor implementation. |
|
31 */ |
|
32 TEffect::TEffect(const TUid& aUid, Plugin::MEffect& aPluginEffect, CImageProcessorImpl& aImageProcessorImpl): |
|
33 iPluginEffect(aPluginEffect), |
|
34 iUid(aUid), |
|
35 iIsActive(EFalse), |
|
36 iImageProcessorImpl(aImageProcessorImpl), |
|
37 iReserved(0) |
|
38 { |
|
39 } |
|
40 |
|
41 /** |
|
42 The begin function of effects, which is first part of the three stages/functions: "begin -> set -> end". . |
|
43 */ |
|
44 EXPORT_C void TEffect::BeginL() |
|
45 { |
|
46 __ASSERT_ALWAYS(iImageProcessorImpl.IsInputSet(), User::Leave(KErrNotReady)); |
|
47 __ASSERT_ALWAYS(!iIsActive, User::Leave(KErrNotReady)); |
|
48 iImageProcessorImpl.SetStateL(CImgProcessor::EEffectActive); |
|
49 |
|
50 TRAPD(err, iPluginEffect.BeginL()); |
|
51 |
|
52 if (err != KErrNone) |
|
53 { |
|
54 iImageProcessorImpl.RestoreStateL(); |
|
55 User::Leave(err); |
|
56 } |
|
57 |
|
58 iIsActive = ETrue; |
|
59 } |
|
60 |
|
61 /** |
|
62 The end function of effects, which is last part of the three stages/functions: "begin -> set -> end". . |
|
63 */ |
|
64 EXPORT_C void TEffect::EndL() |
|
65 { |
|
66 __ASSERT_ALWAYS(iIsActive, User::Leave(KErrNotReady)); |
|
67 iImageProcessorImpl.CheckStateL(CImgProcessor::EEffectActive); |
|
68 |
|
69 TRAPD(err, iPluginEffect.EndL()); |
|
70 |
|
71 if (err != KErrNone) |
|
72 { |
|
73 iImageProcessorImpl.SetStateL(CImgProcessor::EInitialized); |
|
74 iIsActive = EFalse; |
|
75 User::Leave(err); |
|
76 } |
|
77 |
|
78 iIsActive = EFalse; |
|
79 iImageProcessorImpl.SetStateL(CImgProcessor::EInitialized); |
|
80 } |
|
81 |
|
82 /** |
|
83 Retrieves the input type for the effect. |
|
84 |
|
85 @return TEffectInputType corresponding to the level type. |
|
86 */ |
|
87 EXPORT_C TEffect::TEffectInputType TEffect::InputType() const |
|
88 { |
|
89 { |
|
90 TInt minimumLevel = 0; |
|
91 TInt maximumLevel = 0; |
|
92 TInt levelStep = 0; |
|
93 |
|
94 LevelSettings(minimumLevel, maximumLevel, levelStep); |
|
95 if (minimumLevel != maximumLevel) |
|
96 { |
|
97 return EEffectInputTypeInt; |
|
98 } |
|
99 } |
|
100 { |
|
101 TReal32 minimumLevel = 0.0f; |
|
102 TReal32 maximumLevel = 0.0f; |
|
103 TReal32 levelStep = 0.0f; |
|
104 |
|
105 LevelSettings(minimumLevel, maximumLevel, levelStep); |
|
106 if (minimumLevel != maximumLevel)// 0.0f == 0.0f - it is always true |
|
107 { |
|
108 return EEffectInputTypeReal32; |
|
109 } |
|
110 } |
|
111 |
|
112 return EEffectInputTypeCustom; |
|
113 } |
|
114 |
|
115 /** |
|
116 Sets the level to the effect. |
|
117 |
|
118 @param aLevel |
|
119 The level value to be set. |
|
120 |
|
121 @leave KErrNotReady |
|
122 The effect is not active. The effect should be set active by calling TEffect::BeginL() function. |
|
123 @see TEffect::BeginL() |
|
124 |
|
125 @leave KErrArgument |
|
126 The level is not in the level range. The range can be queried by calling TEffect::LevelSettings(TInt& aMinimumLevel, TInt& aMaximumLevel, TInt& aLevelStep) function. |
|
127 @see TEffect::LevelSettings(TInt& aMinimumLevel, TInt& aMaximumLevel, TInt& aLevelStep) |
|
128 |
|
129 @leave KErrNotSupported |
|
130 The input type is not supported by the effect. The supported input type can be queried by calling TEffect::InputType function. |
|
131 @see TEffect::InputType() |
|
132 */ |
|
133 EXPORT_C void TEffect::SetLevelL(TInt aLevel) |
|
134 { |
|
135 __ASSERT_ALWAYS(iIsActive, User::Leave(KErrNotReady)); |
|
136 TInt minimumLevel = 0; |
|
137 TInt maximumLevel = 0; |
|
138 TInt levelStep = 0; |
|
139 |
|
140 LevelSettings(minimumLevel, maximumLevel, levelStep); |
|
141 |
|
142 if (minimumLevel != maximumLevel) |
|
143 { |
|
144 __ASSERT_ALWAYS((minimumLevel <= aLevel) && (maximumLevel >= aLevel), User::Leave(KErrArgument)); |
|
145 iPluginEffect.SetLevelL(aLevel); |
|
146 } |
|
147 else |
|
148 { |
|
149 User::Leave(KErrNotSupported); |
|
150 } |
|
151 } |
|
152 |
|
153 /** |
|
154 Retrieves the effect level. |
|
155 |
|
156 @param aLevel |
|
157 The level value. |
|
158 |
|
159 @leave KErrNotSupported |
|
160 The input type is not supported by the effect. The supported input type can be queried by calling TEffect::InputType function. |
|
161 @see TEffect::InputType() |
|
162 */ |
|
163 EXPORT_C void TEffect::LevelL(TInt& aLevel) const |
|
164 { |
|
165 iPluginEffect.LevelL(aLevel); |
|
166 } |
|
167 |
|
168 /** |
|
169 Retrieves the effect level range. If minimum level equals the maximum level the particular input type is not supported. |
|
170 |
|
171 @param aMinimumLevel |
|
172 The minimum value of the level. |
|
173 |
|
174 @param aMaximumLevel |
|
175 The maximum value of the level. |
|
176 |
|
177 @param aLevelStep |
|
178 The value of the level step. The level step defines the level range resolution between minimim and maximum |
|
179 levels. |
|
180 */ |
|
181 EXPORT_C void TEffect::LevelSettings(TInt& aMinimumLevel, TInt& aMaximumLevel, TInt& aLevelStep) const |
|
182 { |
|
183 iPluginEffect.LevelSettings(aMinimumLevel, aMaximumLevel, aLevelStep); |
|
184 } |
|
185 |
|
186 /** |
|
187 Sets the level to the effect. |
|
188 |
|
189 @param aLevel |
|
190 The level value to be set. |
|
191 |
|
192 @leave KErrNotReady |
|
193 The effect is not active. The effect should be set active by calling TEffect::BeginL() function. |
|
194 @see TEffect::BeginL() |
|
195 |
|
196 @leave KErrArgument |
|
197 The level is not in the level range. The range can be queried by calling TEffect::LevelSettings(TReal32& aMinimumLevel, TReal32& aMaximumLevel, TReal32& aLevelStep) function. |
|
198 @see TEffect::LevelSettings(TReal32& aMinimumLevel, TReal32& aMaximumLevel, TReal32& aLevelStep) |
|
199 |
|
200 @leave KErrNotSupported |
|
201 The input type is not supported for the effect. The supported input type can be queried by calling TEffect::InputType function. |
|
202 @see TEffect::InputType() |
|
203 */ |
|
204 EXPORT_C void TEffect::SetLevelL(TReal32 aLevel) |
|
205 { |
|
206 __ASSERT_ALWAYS(iIsActive, User::Leave(KErrNotReady)); |
|
207 TReal32 minimumLevel = 0.0f; |
|
208 TReal32 maximumLevel = 0.0f; |
|
209 TReal32 levelStep = 0.0f; |
|
210 |
|
211 LevelSettings(minimumLevel, maximumLevel, levelStep); |
|
212 |
|
213 if (minimumLevel != maximumLevel) |
|
214 { |
|
215 __ASSERT_ALWAYS((minimumLevel <= aLevel) && (maximumLevel >= aLevel), User::Leave(KErrArgument)); |
|
216 iPluginEffect.SetLevelL(aLevel); |
|
217 } |
|
218 else |
|
219 { |
|
220 User::Leave(KErrNotSupported); |
|
221 } |
|
222 iPluginEffect.SetLevelL(aLevel); |
|
223 } |
|
224 |
|
225 /** |
|
226 Retrieves the effect level. |
|
227 |
|
228 @param aLevel |
|
229 The level value. |
|
230 |
|
231 @leave KErrNotSupported |
|
232 The input type is not supported by the effect. The supported input type can be queried by calling TEffect::InputType function. |
|
233 @see TEffect::InputType() |
|
234 */ |
|
235 EXPORT_C void TEffect::LevelL(TReal32& aLevel) const |
|
236 { |
|
237 iPluginEffect.LevelL(aLevel); |
|
238 } |
|
239 |
|
240 /** |
|
241 Retrieves the effect level range. If minimum level equals the maximum level the particular input type is not supported. |
|
242 |
|
243 @param aMinimumLevel |
|
244 The minimum value of the level. |
|
245 |
|
246 @param aMaximumLevel |
|
247 The maximum value of the level. |
|
248 |
|
249 @param aLevelStep |
|
250 The value of the level step. The level step defines the level range resolution between minimim and maximum |
|
251 levels. |
|
252 */ |
|
253 EXPORT_C void TEffect::LevelSettings(TReal32& aMinimumLevel, TReal32& aMaximumLevel, TReal32& aLevelStep) const |
|
254 { |
|
255 iPluginEffect.LevelSettings(aMinimumLevel, aMaximumLevel, aLevelStep); |
|
256 } |
|
257 |
|
258 /** |
|
259 The reset function of effects, which resets the effect parameters and state. |
|
260 */ |
|
261 EXPORT_C void TEffect::ResetL() |
|
262 { |
|
263 TInt err = KErrNone; |
|
264 if (iIsActive) |
|
265 { |
|
266 EndL(); |
|
267 //try to undo the effect as it was reset. |
|
268 TRAP(err, iImageProcessorImpl.UndoL()); |
|
269 } |
|
270 |
|
271 iPluginEffect.ResetL(); |
|
272 } |
|
273 |
|
274 /** |
|
275 Retrieves access to a custom extension. |
|
276 |
|
277 @param aExtension |
|
278 The UID of the extension to be retrieved |
|
279 |
|
280 @return Extension corresponding to the UID given as a parameter. |
|
281 */ |
|
282 EXPORT_C TAny* TEffect::Extension(TUid /*aExtension*/) |
|
283 { |
|
284 return NULL; |
|
285 } |
|
286 |
|
287 TEffectSepia::TEffectSepia(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl) : |
|
288 TEffect(KEffectSepiaUid, aEffect, aImageProcessorImpl) |
|
289 { |
|
290 } |
|
291 |
|
292 TEffectGrayscale::TEffectGrayscale(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl) : |
|
293 TEffect(KEffectGrayscaleUid, aEffect, aImageProcessorImpl) |
|
294 { |
|
295 } |
|
296 |
|
297 TEffectNegative::TEffectNegative(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl) : |
|
298 TEffect(KEffectNegativeUid, aEffect, aImageProcessorImpl) |
|
299 { |
|
300 } |
|
301 |
|
302 TEffectGrayscaleNegative::TEffectGrayscaleNegative(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl) : |
|
303 TEffect(KEffectGrayscaleNegativeUid, aEffect, aImageProcessorImpl) |
|
304 { |
|
305 } |
|
306 |
|
307 TEffectOily::TEffectOily(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl) : |
|
308 TEffect(KEffectOilyUid, aEffect, aImageProcessorImpl) |
|
309 { |
|
310 } |
|
311 |
|
312 TEffectPaint::TEffectPaint(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl) : |
|
313 TEffect(KEffectPaintUid, aEffect, aImageProcessorImpl) |
|
314 { |
|
315 } |
|
316 |
|
317 TEffectMilky::TEffectMilky(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl) : |
|
318 TEffect(KEffectMilkyUid, aEffect, aImageProcessorImpl) |
|
319 { |
|
320 } |
|
321 |
|
322 TEffectFog::TEffectFog(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl) : |
|
323 TEffect(KEffectFogUid, aEffect, aImageProcessorImpl) |
|
324 { |
|
325 } |
|
326 |
|
327 TEffectAntique::TEffectAntique(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl) : |
|
328 TEffect(KEffectAntiqueUid, aEffect, aImageProcessorImpl) |
|
329 { |
|
330 } |
|
331 |
|
332 TEffectMirrorLeftToRight::TEffectMirrorLeftToRight(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl) : |
|
333 TEffect(KEffectMirrorLeftToRightUid, aEffect, aImageProcessorImpl) |
|
334 { |
|
335 } |
|
336 |
|
337 TEffectMagicPen::TEffectMagicPen(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl) : |
|
338 TEffect(KEffectMagicPenUid, aEffect, aImageProcessorImpl) |
|
339 { |
|
340 } |
|
341 |
|
342 TEffectBrightness::TEffectBrightness(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl) : |
|
343 TEffect(KEffectBrightnessUid, aEffect, aImageProcessorImpl) |
|
344 { |
|
345 } |
|
346 |
|
347 TEffectSharpness::TEffectSharpness(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl) : |
|
348 TEffect(KEffectSharpnessUid, aEffect, aImageProcessorImpl) |
|
349 { |
|
350 } |
|
351 |
|
352 TEffectRotation::TEffectRotation(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl) : |
|
353 TEffect(KEffectRotationUid, aEffect, aImageProcessorImpl) |
|
354 { |
|
355 } |
|
356 |
|
357 /** |
|
358 Gets the current rotation scale mode |
|
359 |
|
360 @return The rotation scale mode |
|
361 */ |
|
362 EXPORT_C TEffectRotation::TRotationScaleMode TEffectRotation::ScaleModeL() const |
|
363 { |
|
364 return (reinterpret_cast<Plugin::MEffectRotation&>(iPluginEffect)).ScaleModeL(); |
|
365 } |
|
366 |
|
367 /** |
|
368 Gets the current rotation angle |
|
369 |
|
370 @return The rotation angle |
|
371 */ |
|
372 EXPORT_C TReal32 TEffectRotation::AngleL() const |
|
373 { |
|
374 return (reinterpret_cast<Plugin::MEffectRotation&>(iPluginEffect)).AngleL(); |
|
375 } |
|
376 |
|
377 /** |
|
378 Specifies the rotation scale mode and angle for the current rotation effect |
|
379 |
|
380 @param aScaleMode |
|
381 The rotation scale mode. Range (1) - (3). |
|
382 |
|
383 @param aAngle |
|
384 The rotation amgle. Range (0.0f) - (360.0f). |
|
385 |
|
386 @leave KErrNotReady |
|
387 The effect is not active. |
|
388 @leave KErrArgument |
|
389 The level is not in the TRotationScaleMode enumeration or angle is not in the acceptable range. |
|
390 */ |
|
391 EXPORT_C void TEffectRotation::SetRotationL(TEffectRotation::TRotationScaleMode aScaleMode, TReal32 aAngle) |
|
392 { |
|
393 __ASSERT_ALWAYS(iIsActive, User::Leave(KErrNotReady)); |
|
394 (reinterpret_cast<Plugin::MEffectRotation&>(iPluginEffect)).SetRotationL(aScaleMode, aAngle); |
|
395 } |
|
396 |
|
397 TEffectContrast::TEffectContrast(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl) : |
|
398 TEffect(KEffectContrastUid, aEffect, aImageProcessorImpl) |
|
399 { |
|
400 } |
|
401 |
|
402 TEffectRgbColorAdjust::TEffectRgbColorAdjust(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl) : |
|
403 TEffect(KEffectRgbColorAdjustUid, aEffect, aImageProcessorImpl) |
|
404 { |
|
405 } |
|
406 |
|
407 /** |
|
408 Gets the current red level of RgbColorAdjust effect |
|
409 |
|
410 @return The red level |
|
411 */ |
|
412 EXPORT_C TReal32 TEffectRgbColorAdjust::RedLevelL() const |
|
413 { |
|
414 return (reinterpret_cast<Plugin::MEffectRgbColorAdjust&>(iPluginEffect)).RedLevelL(); |
|
415 } |
|
416 |
|
417 /** |
|
418 Gets the current green level of RgbColorAdjust effect |
|
419 |
|
420 @return The green level |
|
421 */ |
|
422 EXPORT_C TReal32 TEffectRgbColorAdjust::GreenLevelL() const |
|
423 { |
|
424 return (reinterpret_cast<Plugin::MEffectRgbColorAdjust&>(iPluginEffect)).GreenLevelL(); |
|
425 } |
|
426 |
|
427 /** |
|
428 Gets the current blue level of RgbColorAdjust effect |
|
429 |
|
430 @return The blue level |
|
431 */ |
|
432 EXPORT_C TReal32 TEffectRgbColorAdjust::BlueLevelL() const |
|
433 { |
|
434 return (reinterpret_cast<Plugin::MEffectRgbColorAdjust&>(iPluginEffect)).BlueLevelL(); |
|
435 } |
|
436 /** |
|
437 Specifies the red, green and blue level for the current RgbColorAdjust effect |
|
438 |
|
439 @param aRedLevel |
|
440 The red channel adjustment. Range (-1.0) - (1.0), where 0.0 implies no adjustment. |
|
441 @param aGreenLevel |
|
442 The green channel adjustment. Range (-1.0) - (1.0), where 0.0 implies no adjustment. |
|
443 @param aBlueLevel |
|
444 The blue channel adjustment. Range (-1.0) - (1.0), where 0.0 implies no adjustment. |
|
445 |
|
446 @leave KErrNotReady |
|
447 The effect is not active. |
|
448 @leave KErrArgument |
|
449 The red level, or green level, or blue level is not in the acceptable range. |
|
450 */ |
|
451 EXPORT_C void TEffectRgbColorAdjust::SetRGBLevelL(TReal32 aRedLevel, TReal32 aGreenLevel, TReal32 aBlueLevel) |
|
452 { |
|
453 __ASSERT_ALWAYS(iIsActive, User::Leave(KErrNotReady)); |
|
454 (reinterpret_cast<Plugin::MEffectRgbColorAdjust&>(iPluginEffect)).SetRGBLevelL(aRedLevel, aGreenLevel, aBlueLevel); |
|
455 } |
|
456 |
|
457 TEffectEmboss::TEffectEmboss(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl) : |
|
458 TEffect(KEffectEmbossUid, aEffect, aImageProcessorImpl) |
|
459 { |
|
460 } |
|
461 |
|
462 TEffectSolarize::TEffectSolarize(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl) : |
|
463 TEffect(KEffectSolarizeUid, aEffect, aImageProcessorImpl) |
|
464 { |
|
465 } |
|
466 |
|
467 TEffectPosterize::TEffectPosterize(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl) : |
|
468 TEffect(KEffectPosterizeUid, aEffect, aImageProcessorImpl) |
|
469 { |
|
470 } |
|
471 |
|
472 TEffectStamp::TEffectStamp(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl) : |
|
473 TEffect(KEffectStampUid, aEffect, aImageProcessorImpl) |
|
474 { |
|
475 } |
|
476 |
|
477 /** |
|
478 Gets the smoothness level for the current stamp effect |
|
479 |
|
480 @return The smoothness level |
|
481 */ |
|
482 EXPORT_C TInt TEffectStamp::SmoothnessLevelL() const |
|
483 { |
|
484 return (reinterpret_cast<Plugin::MEffectStamp&>(iPluginEffect)).SmoothnessLevelL(); |
|
485 } |
|
486 |
|
487 /** |
|
488 Gets the threshold level for the current stamp effect |
|
489 |
|
490 @return The threshold level |
|
491 */ |
|
492 EXPORT_C TInt TEffectStamp::ThresholdLevelL() const |
|
493 { |
|
494 return (reinterpret_cast<Plugin::MEffectStamp&>(iPluginEffect)).ThresholdLevelL(); |
|
495 } |
|
496 |
|
497 /** |
|
498 Specifies the smoothness and threshold level for the current stamp effect |
|
499 |
|
500 @param aSmoothnessLevel |
|
501 The smoothness level. Range (0) - (6), where 0.0 implies no adjustment. |
|
502 @param aThresholdLevel |
|
503 The threshold level. Range (0) - (255), where 0.0 implies no adjustment. |
|
504 |
|
505 @leave KErrNotReady |
|
506 The effect is not active. |
|
507 @leave KErrArgument |
|
508 The smoothness or threshold level is not in the acceptable range. |
|
509 */ |
|
510 EXPORT_C void TEffectStamp::SetStampLevelL(TInt aSmoothnessLevel, TInt aThresholdLevel) |
|
511 { |
|
512 __ASSERT_ALWAYS(iIsActive, User::Leave(KErrNotReady)); |
|
513 (reinterpret_cast<Plugin::MEffectStamp&>(iPluginEffect)).SetStampLevelL(aSmoothnessLevel, aThresholdLevel); |
|
514 } |
|
515 |
|
516 TEffectSketch::TEffectSketch(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl) : |
|
517 TEffect(KEffectSketchUid, aEffect, aImageProcessorImpl) |
|
518 { |
|
519 } |
|
520 |
|
521 /** |
|
522 Get the current sketch mode |
|
523 |
|
524 @return The sketch mode |
|
525 */ |
|
526 EXPORT_C TEffectSketch::TSketchMode TEffectSketch::SketchModeL() const |
|
527 { |
|
528 return (TEffectSketch::TSketchMode)(reinterpret_cast<Plugin::MEffectSketch&>(iPluginEffect)).SketchModeL(); |
|
529 } |
|
530 |
|
531 /** |
|
532 Set the sketch mode. |
|
533 |
|
534 @param aSketchMode |
|
535 The sketch mode, ESketchModeGray or ESketchColor. |
|
536 |
|
537 @leave KErrNotReady |
|
538 The effect is not active. |
|
539 @leave KErrArgument |
|
540 The mode is not in the TSketchMode enumeration. |
|
541 */ |
|
542 EXPORT_C void TEffectSketch::SetSketchModeL(TEffectSketch::TSketchMode aSketchMode) |
|
543 { |
|
544 __ASSERT_ALWAYS(iIsActive, User::Leave(KErrNotReady)); |
|
545 __ASSERT_ALWAYS((ESketchModeGray <= aSketchMode) && (ESketchColor >= aSketchMode),User::Leave(KErrArgument)); |
|
546 (reinterpret_cast<Plugin::MEffectSketch&>(iPluginEffect)).SetSketchModeL(aSketchMode); |
|
547 } |
|
548 |
|
549 TEffectNoise::TEffectNoise(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl) : |
|
550 TEffect(KEffectNoiseUid, aEffect, aImageProcessorImpl) |
|
551 { |
|
552 } |
|
553 |
|
554 TEffectMoonlight::TEffectMoonlight(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl) : |
|
555 TEffect(KEffectMoonlightUid, aEffect, aImageProcessorImpl) |
|
556 { |
|
557 } |
|
558 |
|
559 TEffectFrostedGlass::TEffectFrostedGlass(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl) : |
|
560 TEffect(KEffectFrostedGlassUid, aEffect, aImageProcessorImpl) |
|
561 { |
|
562 } |
|
563 |
|
564 TEffectDespeckle::TEffectDespeckle(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl) : |
|
565 TEffect(KEffectDespeckleUid, aEffect, aImageProcessorImpl) |
|
566 { |
|
567 } |
|
568 |
|
569 TEffectBlur::TEffectBlur(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl) : |
|
570 TEffect(KEffectBlurUid, aEffect, aImageProcessorImpl) |
|
571 { |
|
572 } |
|
573 |
|
574 /** |
|
575 Gets the current blur effect rectangle |
|
576 |
|
577 @return The rectangle to apply blur effect |
|
578 */ |
|
579 EXPORT_C TRect TEffectBlur::RectL() const |
|
580 { |
|
581 return (reinterpret_cast<Plugin::MEffectBlur&>(iPluginEffect)).RectL(); |
|
582 } |
|
583 |
|
584 /** |
|
585 Specifies the rectangle for the current blur effect |
|
586 |
|
587 @param aRect |
|
588 The blur effect rectangle. Set this parameter to NULL if the effect should be applied to the entire image. |
|
589 |
|
590 @leave KErrNotReady |
|
591 The effect is not active. |
|
592 @leave KErrArgument |
|
593 The level is not in the TBlurLevel enumeration. |
|
594 */ |
|
595 EXPORT_C void TEffectBlur::SetRectL(TRect aRect) |
|
596 { |
|
597 __ASSERT_ALWAYS(iIsActive, User::Leave(KErrNotReady)); |
|
598 (reinterpret_cast<Plugin::MEffectBlur&>(iPluginEffect)).SetRectL(aRect); |
|
599 } |
|
600 |
|
601 TEffectColorization::TEffectColorization(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl) : |
|
602 TEffect(KEffectColorizationUid, aEffect, aImageProcessorImpl) |
|
603 { |
|
604 } |
|
605 |
|
606 /** |
|
607 Gets the current rgb value of the reference color |
|
608 |
|
609 @return The rgb value of the reference color |
|
610 */ |
|
611 EXPORT_C TRgb TEffectColorization::ReferenceColorL() const |
|
612 { |
|
613 return (reinterpret_cast<Plugin::MEffectColorization&>(iPluginEffect)).ReferenceColorL(); |
|
614 } |
|
615 |
|
616 /** |
|
617 Gets the current luminance level of colorization effect |
|
618 |
|
619 @return Strength of luminance |
|
620 */ |
|
621 EXPORT_C TInt TEffectColorization::LuminanceStrengthL() const |
|
622 { |
|
623 return (reinterpret_cast<Plugin::MEffectColorization&>(iPluginEffect)).LuminanceStrengthL(); |
|
624 } |
|
625 |
|
626 /** |
|
627 Gets the current chrominance level of colorization effect |
|
628 |
|
629 @return Strength of chrominance |
|
630 */ |
|
631 EXPORT_C TInt TEffectColorization::ChrominanceStrengthL() const |
|
632 { |
|
633 return (reinterpret_cast<Plugin::MEffectColorization&>(iPluginEffect)).ChrominanceStrengthL(); |
|
634 } |
|
635 |
|
636 /** |
|
637 Specifies the rgb value of reference color and specifies luminance, chrominance level for |
|
638 the colorization effect. |
|
639 |
|
640 @param aReferenceColor |
|
641 The rgb value of the reference color. |
|
642 @param aLuminanceStrength |
|
643 The strength of luminance. Range (-100) - (200), where 0.0 implies no adjustment. |
|
644 @param aChrominanceStrength |
|
645 The strength of chrominance. Range (-100) - (200), where 0.0 implies no adjustment. |
|
646 |
|
647 @leave KErrNotReady |
|
648 The effect is not active. |
|
649 @leave KErrArgument |
|
650 The luminance or chrominance strength is not in the acceptable range. |
|
651 */ |
|
652 EXPORT_C void TEffectColorization::SetColorizationL(TRgb aReferenceColor, TInt aLuminanceStrength, TInt aChrominanceStrength) |
|
653 { |
|
654 __ASSERT_ALWAYS(iIsActive, User::Leave(KErrNotReady)); |
|
655 (reinterpret_cast<Plugin::MEffectColorization&>(iPluginEffect)).SetColorizationL(aReferenceColor, aLuminanceStrength, aChrominanceStrength); |
|
656 } |
|
657 |
|
658 TEffectCartoon::TEffectCartoon(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl) : |
|
659 TEffect(KEffectCartoonUid, aEffect, aImageProcessorImpl) |
|
660 { |
|
661 } |
|
662 |
|
663 /** |
|
664 Return whether the cartoon effect has distinct edges. |
|
665 |
|
666 @return ETrue if all detected edges in the image are rendered distinctively |
|
667 */ |
|
668 EXPORT_C TBool TEffectCartoon::DistinctEdgesL() const |
|
669 { |
|
670 return (reinterpret_cast<Plugin::MEffectCartoon&>(iPluginEffect)).DistinctEdgesL(); |
|
671 } |
|
672 |
|
673 /** |
|
674 Specifies if the current cartoon effect should have distinct edges. |
|
675 |
|
676 @param aDistinctEdges |
|
677 If set to ETrue all detected edges in the image are rendered distinctively, if EFalse edges are ignored. |
|
678 @leave KErrNotReady |
|
679 The effect is not active. |
|
680 */ |
|
681 EXPORT_C void TEffectCartoon::SetDistinctEdgesL(TBool aDistinctEdges) |
|
682 { |
|
683 __ASSERT_ALWAYS(iIsActive, User::Leave(KErrNotReady)); |
|
684 (reinterpret_cast<Plugin::MEffectCartoon&>(iPluginEffect)).SetDistinctEdgesL(aDistinctEdges); |
|
685 } |
|
686 |
|
687 TEffectLocalBoost::TEffectLocalBoost(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl) : |
|
688 TEffect(KEffectLocalBoostUid, aEffect, aImageProcessorImpl) |
|
689 { |
|
690 } |
|
691 |
|
692 TEffectColorBoost::TEffectColorBoost(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl) : |
|
693 TEffect(KEffectColorBoostUid, aEffect, aImageProcessorImpl) |
|
694 { |
|
695 } |
|
696 |
|
697 TEffectWhiteBalance::TEffectWhiteBalance(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl) : |
|
698 TEffect(KEffectWhiteBalanceUid, aEffect, aImageProcessorImpl) |
|
699 { |
|
700 } |
|
701 |
|
702 /** |
|
703 Gets the white balance mode |
|
704 |
|
705 @return The value of the white balance mode |
|
706 */ |
|
707 EXPORT_C TEffectWhiteBalance::TWhiteBalanceMode TEffectWhiteBalance::WhiteBalanceModeL() const |
|
708 { |
|
709 return (reinterpret_cast<Plugin::MEffectWhiteBalance&>(iPluginEffect)).WhiteBalanceModeL(); |
|
710 } |
|
711 |
|
712 /** |
|
713 Gets the current rgb value of the reference white color |
|
714 |
|
715 @return The rgb value of the reference white color |
|
716 */ |
|
717 EXPORT_C TRgb TEffectWhiteBalance::ReferenceWhiteColorL() const |
|
718 { |
|
719 return (reinterpret_cast<Plugin::MEffectWhiteBalance&>(iPluginEffect)).ReferenceWhiteColorL(); |
|
720 } |
|
721 /** |
|
722 Specifies the white balance mode and the value of reference white color. |
|
723 |
|
724 @param aWhiteBalanceMode |
|
725 The white balance mode. |
|
726 @param aReferenceWhiteColor |
|
727 The rgb value of the reference white color. |
|
728 @leave KErrNotReady |
|
729 The effect is not active. |
|
730 @leave KErrArgument |
|
731 The whitebalance mode is not in the TWhiteBalanceMode enumeration |
|
732 */ |
|
733 EXPORT_C void TEffectWhiteBalance::SetWhiteBalanceL(TWhiteBalanceMode aWhiteBalanceMode, TRgb aReferenceWhiteColor) |
|
734 { |
|
735 __ASSERT_ALWAYS(iIsActive, User::Leave(KErrNotReady)); |
|
736 (reinterpret_cast<Plugin::MEffectWhiteBalance&>(iPluginEffect)).SetWhiteBalanceL(aWhiteBalanceMode, aReferenceWhiteColor); |
|
737 } |
|
738 |
|
739 TEffectAutoLevels::TEffectAutoLevels(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl) : |
|
740 TEffect(KEffectAutoLevelsUid, aEffect, aImageProcessorImpl) |
|
741 { |
|
742 } |
|
743 |
|
744 TEffectLevels::TEffectLevels(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl) : |
|
745 TEffect(KEffectLevelsUid, aEffect, aImageProcessorImpl) |
|
746 { |
|
747 } |
|
748 |
|
749 /** |
|
750 Gets the current bright saturating value. |
|
751 |
|
752 @return The bright saturating value |
|
753 */ |
|
754 EXPORT_C TReal32 TEffectLevels::WhiteLevelL() const |
|
755 { |
|
756 return (reinterpret_cast<Plugin::MEffectLevels&>(iPluginEffect)).WhiteLevelL(); |
|
757 } |
|
758 |
|
759 /** |
|
760 Gets the current middle gray value. |
|
761 |
|
762 @return The middle gray value |
|
763 */ |
|
764 EXPORT_C TReal32 TEffectLevels::GrayLevelL() const |
|
765 { |
|
766 return (reinterpret_cast<Plugin::MEffectLevels&>(iPluginEffect)).GrayLevelL(); |
|
767 } |
|
768 |
|
769 /** |
|
770 Gets the current dark saturating value. |
|
771 |
|
772 @return The dark saturating value |
|
773 */ |
|
774 EXPORT_C TReal32 TEffectLevels::BlackLevelL() const |
|
775 { |
|
776 return (reinterpret_cast<Plugin::MEffectLevels&>(iPluginEffect)).BlackLevelL(); |
|
777 } |
|
778 |
|
779 /** |
|
780 Specifies the white/gray/black level. |
|
781 |
|
782 @param aWhiteLevel |
|
783 The position of the bright saturating point. Range (0.0) - (1.0). |
|
784 @param aGrayLevel |
|
785 The relative position of the middle gray point. Range (0.0) - (1.0). |
|
786 @param aBlackLevel |
|
787 The position of the dark saturating point. Range (0.0) - (1.0). |
|
788 @leave KErrNotReady |
|
789 The effect is not active. |
|
790 @leave KErrArgument |
|
791 The aWhiteLevel or aGrayLevel or aBlackLevel mode is not in the acceptable range. |
|
792 */ |
|
793 EXPORT_C void TEffectLevels::SetWGBLevelL(TReal32 aWhiteLevel, TReal32 aGrayLevel, TReal32 aBlackLevel) |
|
794 { |
|
795 __ASSERT_ALWAYS(iIsActive, User::Leave(KErrNotReady)); |
|
796 (reinterpret_cast<Plugin::MEffectLevels&>(iPluginEffect)).SetWGBLevelL(aWhiteLevel, aGrayLevel, aBlackLevel); |
|
797 } |
|
798 |
|
799 TEffectExposure::TEffectExposure(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl) : |
|
800 TEffect(KEffectExposureUid, aEffect, aImageProcessorImpl) |
|
801 { |
|
802 } |
|
803 |
|
804 TEffectSpotLight::TEffectSpotLight(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl) : |
|
805 TEffect(KEffectSpotLightUid, aEffect, aImageProcessorImpl) |
|
806 { |
|
807 } |
|
808 |
|
809 /** |
|
810 Gets the current spotlight orientation. |
|
811 |
|
812 @param aPosition |
|
813 The center of the spotlight circle. |
|
814 @param aRadius |
|
815 The radius of the spotlight circle in pixels. |
|
816 @param aTransitionSize |
|
817 The size of the transition region given in fraction of the radius. |
|
818 @leave KErrNotReady |
|
819 The effect is not active. |
|
820 */ |
|
821 EXPORT_C void TEffectSpotLight::SpotLightOrientationL(TPoint &aPosition, TUint32& aRadius, TReal32& aTransitionSize) const |
|
822 { |
|
823 (reinterpret_cast<Plugin::MEffectSpotLight&>(iPluginEffect)).SpotLightOrientationL(aPosition, aRadius, aTransitionSize); |
|
824 } |
|
825 |
|
826 /** |
|
827 Specifies the current spotlight orientation. |
|
828 |
|
829 @param aPosition |
|
830 The center of the spotlight circle. |
|
831 @param aRadius |
|
832 The radius of the spotlight circle in pixels. Range (0) - (65535 - 1024). |
|
833 @param aTransitionSize |
|
834 The size of the transition region given in fraction of the radius. Range (0) - (1.0). |
|
835 @leave KErrNotReady |
|
836 The effect is not active. |
|
837 @leave KErrArgument |
|
838 The level is not in the acceptable range. |
|
839 */ |
|
840 EXPORT_C void TEffectSpotLight::SetSpotLightOrientationL(const TPoint& aPosition, TUint32 aRadius, TReal32 aTransitionSize) |
|
841 { |
|
842 __ASSERT_ALWAYS(iIsActive, User::Leave(KErrNotReady)); |
|
843 (reinterpret_cast<Plugin::MEffectSpotLight&>(iPluginEffect)).SetSpotLightOrientationL(aPosition, aRadius, aTransitionSize); |
|
844 } |
|
845 |
|
846 TEffectCustomTransformation::TEffectCustomTransformation(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl) : |
|
847 TEffect(KEffectCustomTransformationUid, aEffect, aImageProcessorImpl) |
|
848 { |
|
849 } |
|
850 |
|
851 /** |
|
852 Specifies the input file for the current CustomTransformation effect. |
|
853 |
|
854 @param aFilename |
|
855 Filename specifying the custom transformation file to use when applying the effect. |
|
856 @leave KErrNotReady |
|
857 The effect is not active. |
|
858 @leave KErrArgument |
|
859 The file name is not correct. |
|
860 */ |
|
861 EXPORT_C void TEffectCustomTransformation::SetInputL(const TDesC& aFilename) |
|
862 { |
|
863 __ASSERT_ALWAYS(iIsActive, User::Leave(KErrNotReady)); |
|
864 if (aFilename.Length() > KMaxFileName) |
|
865 { |
|
866 User::Leave(KErrArgument); |
|
867 } |
|
868 |
|
869 (reinterpret_cast<Plugin::MEffectCustomTransformation&>(iPluginEffect)).SetInputL(aFilename); |
|
870 } |
|
871 |
|
872 /** |
|
873 Specifies the input buffer for the current CustomTransformation effect. |
|
874 |
|
875 @param aBuffer |
|
876 Buffer containing the custom transformation to apply. |
|
877 @leave KErrNotReady |
|
878 The effect is not active. |
|
879 */ |
|
880 EXPORT_C void TEffectCustomTransformation::SetInputL(const TDesC8& aBuffer) |
|
881 { |
|
882 __ASSERT_ALWAYS(iIsActive, User::Leave(KErrNotReady)); |
|
883 (reinterpret_cast<Plugin::MEffectCustomTransformation&>(iPluginEffect)).SetInputL(aBuffer); |
|
884 } |
|
885 |
|
886 TGeometricalOperation::TGeometricalOperation(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl): |
|
887 TEffect(KGeometricalOperationUid, aEffect, aImageProcessorImpl) |
|
888 { |
|
889 } |
|
890 |
|
891 /** |
|
892 Gets the operation of the current GeometricalOperation effect. |
|
893 |
|
894 @return The operation |
|
895 */ |
|
896 EXPORT_C CImgProcessor::TOperation TGeometricalOperation::Operation() const |
|
897 { |
|
898 return (reinterpret_cast<Plugin::MGeometricalOperation&>(iPluginEffect)).Operation(); |
|
899 } |
|
900 |
|
901 /** |
|
902 Specifies the operation for the current GeometricalOperation effect. |
|
903 |
|
904 @param aOperation |
|
905 The operation. |
|
906 @leave KErrNotReady |
|
907 The effect is not active. |
|
908 @leave KErrArgument |
|
909 The operation is not in the CImgProcessor::TOperation enumeration. |
|
910 */ |
|
911 EXPORT_C void TGeometricalOperation::SetOperationL(CImgProcessor::TOperation aOperation) |
|
912 { |
|
913 __ASSERT_ALWAYS(iIsActive, User::Leave(KErrNotReady)); |
|
914 (reinterpret_cast<Plugin::MGeometricalOperation&>(iPluginEffect)).SetOperationL(aOperation); |
|
915 } |
|
916 |
|
917 TEffectBorder::TEffectBorder(Plugin::MEffect& aEffect, CImageProcessorImpl& aImageProcessorImpl) : |
|
918 TEffect(KEffectBorderUid, aEffect, aImageProcessorImpl) |
|
919 { |
|
920 } |
|
921 |
|
922 /** |
|
923 Specifies the input file for the current Border effect. |
|
924 |
|
925 @param aFilename |
|
926 The file name of the border image. |
|
927 |
|
928 @leave KErrNotReady |
|
929 The effect is not active. |
|
930 @leave KErrArgument |
|
931 The file name is not correct. |
|
932 */ |
|
933 EXPORT_C void TEffectBorder::SetInputL(const TDesC& aFilename) |
|
934 { |
|
935 __ASSERT_ALWAYS(iIsActive, User::Leave(KErrNotReady)); |
|
936 if (aFilename.Length() > KMaxFileName) |
|
937 { |
|
938 User::Leave(KErrArgument); |
|
939 } |
|
940 |
|
941 (reinterpret_cast<Plugin::MEffectBorder&>(iPluginEffect)).SetInputL(aFilename); |
|
942 } |
|
943 |
|
944 /** |
|
945 Specifies the input buffer for the current Border effect. |
|
946 |
|
947 @param aBuffer |
|
948 The pointer to the buffer of the border image. |
|
949 |
|
950 @leave KErrNotReady |
|
951 The effect is not active. |
|
952 @leave KErrArgument |
|
953 The buffer is empty. |
|
954 */ |
|
955 EXPORT_C void TEffectBorder::SetInputL(const TDesC8& aBuffer) |
|
956 { |
|
957 __ASSERT_ALWAYS(iIsActive, User::Leave(KErrNotReady)); |
|
958 if (aBuffer.Size() == 0) |
|
959 { |
|
960 User::Leave(KErrArgument); |
|
961 } |
|
962 |
|
963 (reinterpret_cast<Plugin::MEffectBorder&>(iPluginEffect)).SetInputL(aBuffer); |
|
964 } |
|
965 |
|
966 /** |
|
967 Specifies the input bitmap for the current Border effect. |
|
968 |
|
969 @param aBitmap |
|
970 The pointer to the bitmap of the border image. |
|
971 The bitmap must have a display mode of EColor16MA. |
|
972 |
|
973 @leave KErrNotReady |
|
974 The effect is not active. |
|
975 @leave KErrArgument |
|
976 The bitmap is empty, or the bitmap has an unsupported display mode. |
|
977 |
|
978 */ |
|
979 EXPORT_C void TEffectBorder::SetInputL(const CFbsBitmap& aBitmap) |
|
980 { |
|
981 __ASSERT_ALWAYS(iIsActive, User::Leave(KErrNotReady)); |
|
982 if (aBitmap.SizeInPixels() == TSize(0,0)) |
|
983 { |
|
984 User::Leave(KErrArgument); |
|
985 } |
|
986 |
|
987 if(aBitmap.Handle()!=0 && aBitmap.ExtendedBitmapType()!=KNullUid) |
|
988 { |
|
989 User::Leave(KErrNotSupported); |
|
990 } |
|
991 |
|
992 (reinterpret_cast<Plugin::MEffectBorder&>(iPluginEffect)).SetInputL(aBitmap); |
|
993 } |
|
994 |
|
995 }//namespace ImageProcessor |
|
996 |
|
997 //EOF |