Home » U++ Library support » U++ Widgets - General questions or Mixed problems » How to blur a Ctrl
Re: How to blur a Ctrl [message #48815 is a reply to message #48774] |
Mon, 25 September 2017 20:00   |
Didier
Messages: 736 Registered: November 2008 Location: France
|
Contributor |
|
|
Hi,
Maybe somthing like this could do the trick:
template <class T>
class BlurringDecorator : public T {
private:
bool doBlur;
void blurImage(Image& m) {
m = Sharpen(m, -200);
m = Sharpen(m, -200);
m = Sharpen(m, -200);
m = Sharpen(m, -200);
m = Sharpen(m, -200);
m = Sharpen(m, -200);
}
public:
BlurringDecorator() : doBlur(true) {}
virtual ~BlurringDecorator() {}
void setBlur(bool blur = true) { doBlur = blur; }
virtual void Paint(Draw& w) {
if (doBlur) {
ImageDraw dw(T::GetSize());
T::Paint(dw);
Image im = dw;
blurImage(im);
w.DrawImage(0, 0, im);
}
else {
T::Paint(w);
}
}
};
In layout
BlurringDecorator<CtrlToBlur> myCtrl;
EDIT: just tried, works fine (but only blurrs the current Ctrl ... not what is under it !!!)
[Updated on: Mon, 25 September 2017 20:26] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Sat Jul 05 07:02:44 CEST 2025
Total time taken to generate the page: 0.04401 seconds
|