src/hbcore/effects/hbeffectblur.cpp
changeset 5 627c4a0fd0e7
parent 1 f7ac710697a9
equal deleted inserted replaced
3:11d3954df52a 5:627c4a0fd0e7
    23 **
    23 **
    24 ****************************************************************************/
    24 ****************************************************************************/
    25 #include <hbglobal.h>
    25 #include <hbglobal.h>
    26 #ifdef HB_FILTER_EFFECTS
    26 #ifdef HB_FILTER_EFFECTS
    27 
    27 
    28 #include "hbeffectblur_p.h"
    28 #include "hbeffectblur_p.h" //krazy:exclude=includes
    29 #include "hbeffectgroup_p.h"
    29 #include "hbeffectgroup_p.h"
    30 #include "hbeffectdef_p.h"
    30 #include "hbeffectdef_p.h"
    31 #include "hbvgchainedeffect_p.h"
    31 #include "hbvgchainedeffect_p.h"
    32 #include "hbvgblureffect_p.h"
    32 #include "hbvgblureffect_p.h"
    33 #include "hbvggloweffect_p.h"
    33 #include "hbvggloweffect_p.h"
    41 
    41 
    42 HbEffectBlur::HbEffectBlur(
    42 HbEffectBlur::HbEffectBlur(
    43     const HbEffectFxmlFilterData &data,
    43     const HbEffectFxmlFilterData &data,
    44     QGraphicsItem *item,
    44     QGraphicsItem *item,
    45     HbEffectGroup *group) :
    45     HbEffectGroup *group) :
    46         HbEffectFilter(0, item, group),
    46     HbEffectFilter(0, item, group),
    47         mAnimationO(0),
    47     mAnimationO(0),
    48         mAnimationX(0),
    48     mAnimationX(0),
    49         mAnimationY(0),
    49     mAnimationY(0),
    50         mVgBlur(0),
    50     mVgBlur(0),
    51         mType(Blur)
    51     mType(Blur)
    52 {
    52 {
    53     // If it is a glow filter, change effect type
    53     // If it is a glow filter, change effect type
    54     if (data.type() == HB_EFFECT_NAME_GLOW) {
    54     if (data.type() == HB_EFFECT_NAME_GLOW) {
    55         mType = Glow;
    55         mType = Glow;
    56     }
    56     }
    64     qreal blur_y_end = 1;
    64     qreal blur_y_end = 1;
    65 
    65 
    66     QList<HbEffectFxmlParamData> params = data.paramData();
    66     QList<HbEffectFxmlParamData> params = data.paramData();
    67 
    67 
    68     // Handle FXML parameters
    68     // Handle FXML parameters
    69     Q_FOREACH(const HbEffectFxmlParamData &param, params) {
    69     Q_FOREACH(const HbEffectFxmlParamData & param, params) {
    70         if (param.name() == FXML_KEYWORD_BLUR_OPACITY) {
    70         if (param.name() == FXML_KEYWORD_BLUR_OPACITY) {
    71             mAnimationO = createAnimation(param, opacity_start, opacity_end, group);
    71             mAnimationO = createAnimation(param, opacity_start, opacity_end, group);
    72         }
    72         } else if (param.name() == FXML_KEYWORD_BLUR_ORIGIN_X) {
    73         else if (param.name() == FXML_KEYWORD_BLUR_ORIGIN_X) {
       
    74             mAnimationX = createAnimation(param, blur_x_start, blur_x_end, group);
    73             mAnimationX = createAnimation(param, blur_x_start, blur_x_end, group);
    75         }
    74         } else if (param.name() == FXML_KEYWORD_BLUR_ORIGIN_Y) {
    76         else if (param.name() == FXML_KEYWORD_BLUR_ORIGIN_Y) {
       
    77             mAnimationY = createAnimation(param, blur_y_start, blur_y_end, group);
    75             mAnimationY = createAnimation(param, blur_y_start, blur_y_end, group);
    78         }
    76         }
    79     }
    77     }
    80 
    78 
    81     // Additive blending mode changes blur effect to glow effect.
    79     // Additive blending mode changes blur effect to glow effect.
    85 
    83 
    86     // Create VG effect if there were effect parameters defined
    84     // Create VG effect if there were effect parameters defined
    87     if (mEffectDefined) {
    85     if (mEffectDefined) {
    88         // Add blur effect to the filter effect chain in the effect group
    86         // Add blur effect to the filter effect chain in the effect group
    89         HbVgChainedEffect *chain = HbEffectAbstract::group()->vgEffect();
    87         HbVgChainedEffect *chain = HbEffectAbstract::group()->vgEffect();
    90         
    88 
    91         if (mType == Blur) {
    89         if (mType == Blur) {
    92             mVgBlur = new HbVgBlurEffect();
    90             mVgBlur = new HbVgBlurEffect();
    93         }
    91         } else {
    94         else {
       
    95             mVgBlur = new HbVgGlowEffect();
    92             mVgBlur = new HbVgGlowEffect();
    96         }
    93         }
    97         mVgBlur->setCaching(true);
    94         mVgBlur->setCaching(true);
    98         chain->add(mVgBlur);
    95         chain->add(mVgBlur);
    99 
    96