|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (developer.feedback@nokia.com) |
|
6 ** |
|
7 ** This file is part of the HbCore module of the UI Extensions for Mobile. |
|
8 ** |
|
9 ** GNU Lesser General Public License Usage |
|
10 ** This file may be used under the terms of the GNU Lesser General Public |
|
11 ** License version 2.1 as published by the Free Software Foundation and |
|
12 ** appearing in the file LICENSE.LGPL included in the packaging of this file. |
|
13 ** Please review the following information to ensure the GNU Lesser General |
|
14 ** Public License version 2.1 requirements will be met: |
|
15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
16 ** |
|
17 ** In addition, as a special exception, Nokia gives you certain additional |
|
18 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
20 ** |
|
21 ** If you have questions regarding the use of this file, please contact |
|
22 ** Nokia at developer.feedback@nokia.com. |
|
23 ** |
|
24 ****************************************************************************/ |
|
25 |
|
26 #include "hbvgshadoweffect_p.h" |
|
27 #include "hbvgoutlineeffect_p_p.h" |
|
28 #include <QPainter> |
|
29 |
|
30 /*! |
|
31 * \class HbVgShadowEffect |
|
32 * |
|
33 * \brief OpenVG-based dropshadow filter effect. |
|
34 * |
|
35 * \internal |
|
36 */ |
|
37 |
|
38 HbVgShadowEffect::HbVgShadowEffect(QObject *parent) |
|
39 : HbVgOutlineEffect(parent) |
|
40 { |
|
41 } |
|
42 |
|
43 HbVgShadowEffect::HbVgShadowEffect(HbVgOutlineEffectPrivate &dd, QObject *parent) |
|
44 : HbVgOutlineEffect(dd, parent) |
|
45 { |
|
46 } |
|
47 |
|
48 HbVgShadowEffect::~HbVgShadowEffect() |
|
49 { |
|
50 } |
|
51 |
|
52 void HbVgShadowEffect::performEffect(QPainter *painter, |
|
53 const QPointF &offset, |
|
54 const QVariant &vgImage, |
|
55 const QSize &vgImageSize) |
|
56 { |
|
57 #ifdef HB_EFFECTS_OPENVG |
|
58 Q_D(HbVgOutlineEffect); |
|
59 QPixmap outlinePm = makeOutline(vgImage, vgImageSize); |
|
60 // Draw the shadow. Note that this paints also outside of our bounding |
|
61 // rectangle but all those pixels (that fall outside of our rect) are |
|
62 // transparent. This should be more effective than trying to get the shadow |
|
63 // translated already in outlinePm. |
|
64 painter->drawPixmap(offset + d->mapOffset(d->offset), outlinePm); |
|
65 // Draw the source. |
|
66 painter->drawPixmap(offset, d->srcPixmap); |
|
67 #else |
|
68 Q_UNUSED(painter); |
|
69 Q_UNUSED(offset); |
|
70 Q_UNUSED(vgImage); |
|
71 Q_UNUSED(vgImageSize); |
|
72 #endif |
|
73 } |