* proof of concept dynamic shadow, #if 0'd out
* some implementation notes svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=692252
This commit is contained in:
parent
5f1c84a5dd
commit
6c297f6cbb
21
applet.cpp
21
applet.cpp
@ -43,6 +43,8 @@
|
|||||||
#include "plasma/widgets/lineedit.h"
|
#include "plasma/widgets/lineedit.h"
|
||||||
#include "plasma/widgets/vboxlayout.h"
|
#include "plasma/widgets/vboxlayout.h"
|
||||||
|
|
||||||
|
//#include "stackblur_shadows.cpp"
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -128,10 +130,16 @@ public:
|
|||||||
|
|
||||||
void paintBackground(QPainter* p, Applet* q)
|
void paintBackground(QPainter* p, Applet* q)
|
||||||
{
|
{
|
||||||
|
//TODO: we should cache this background rather that repaint it over and over
|
||||||
QRect rect = q->boundingRect().toRect();
|
QRect rect = q->boundingRect().toRect();
|
||||||
const int w = rect.width();
|
const int w = rect.width();
|
||||||
const int h = rect.height();
|
const int h = rect.height();
|
||||||
|
#if 0
|
||||||
|
// this could be used to draw a dynamic shadow
|
||||||
|
QImage image(w, h, QImage::Format_ARGB32_Premultiplied);
|
||||||
|
QPainter* p = new QPainter(&image);
|
||||||
|
p->setCompositionMode(QPainter::CompositionMode_Source);
|
||||||
|
#endif
|
||||||
p->setRenderHint(QPainter::SmoothPixmapTransform);
|
p->setRenderHint(QPainter::SmoothPixmapTransform);
|
||||||
background->resize();
|
background->resize();
|
||||||
|
|
||||||
@ -183,6 +191,17 @@ public:
|
|||||||
p->drawTiledPixmap(QRect(leftWidth, h - bottomHeight, w - lrWidths, bottomHeight), bottom);
|
p->drawTiledPixmap(QRect(leftWidth, h - bottomHeight, w - lrWidths, bottomHeight), bottom);
|
||||||
|
|
||||||
background->paint(p, QRect(leftWidth, topHeight, w - lrWidths + 1, h - tbHeights + 1), "center");
|
background->paint(p, QRect(leftWidth, topHeight, w - lrWidths + 1, h - tbHeights + 1), "center");
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// this could be used to draw a dynamic shadow
|
||||||
|
delete p;
|
||||||
|
|
||||||
|
QImage image2(image);
|
||||||
|
image.setAlphaChannel(image2.createHeuristicMask());
|
||||||
|
shadowBlur(image, 1);
|
||||||
|
p2->drawImage(0, 0, image);
|
||||||
|
p2->drawImage(0, 0, image2);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint nextId()
|
static uint nextId()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user