diff --git a/src/driver/Makefile.am b/src/driver/Makefile.am
index 1a412eaf6..b07bc9bda 100644
--- a/src/driver/Makefile.am
+++ b/src/driver/Makefile.am
@@ -32,6 +32,7 @@ libneutrino_driver_a_SOURCES = \
streamts.cpp \
radiotools.cpp \
radiotext.cpp \
+ fader.cpp \
screenshot.cpp \
ringbuffer.c \
volume.cpp
diff --git a/src/driver/fade.h b/src/driver/fade.h
new file mode 100644
index 000000000..8bef1cb90
--- /dev/null
+++ b/src/driver/fade.h
@@ -0,0 +1,2 @@
+/* for compatibility */
+#include "fader.h"
diff --git a/src/driver/fader.cpp b/src/driver/fader.cpp
new file mode 100644
index 000000000..cdb6a4985
--- /dev/null
+++ b/src/driver/fader.cpp
@@ -0,0 +1,98 @@
+/*
+ Neutrino-HD GUI, COSDFader implementation
+ Copyright (C) 2011 Stefan Seyfried
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+
+#include
+#include
+#include
+
+COSDFader::COSDFader(int trans)
+{
+ fb = CFrameBuffer::getInstance();
+ target_trans = trans;
+ timer = 0;
+ step = 0;
+}
+
+COSDFader::~COSDFader()
+{
+ Stop();
+}
+
+void COSDFader::StartFadeIn()
+{
+ transparency = 100;
+ step = -FADE_STEP;
+ Fade();
+}
+
+/* returns true if fade out was not started before and fade is enabled */
+bool COSDFader::StartFadeOut()
+{
+ if (!g_settings.widget_fade) /* disabled */
+ return false;
+ if (step == FADE_STEP) /* already fading out... */
+ return false;
+
+ /* start fading */
+ step = FADE_STEP;
+ Fade();
+ return true;
+}
+
+void COSDFader::Stop()
+{
+ if (!step)
+ return;
+
+ g_RCInput->killTimer(timer);
+ fb->setBlendMode(1); /* per pixel alpha */
+}
+
+/* returns true if fade out is finished */
+bool COSDFader::Fade()
+{
+ if (!g_settings.widget_fade)
+ return false;
+
+ if (timer == 0)
+ timer = g_RCInput->addTimer(FADE_TIME, false);
+
+ if (transparency == 100 || transparency == target_trans)
+ {
+ fb->setBlendMode(2); /* 2 == "global alpha x pixel alpha" */
+ fb->setBlendLevel(transparency);
+ transparency += step;
+ return false;
+ }
+ transparency += step;
+ if (step > 0 && transparency >= 100) /* finished fading out */
+ {
+ transparency = target_trans;
+ g_RCInput->killTimer(timer);
+ return true;
+ }
+ if (step < 0 && transparency <= target_trans) /* finished fading in */
+ {
+ transparency = target_trans;
+ g_RCInput->killTimer(timer);
+ fb->setBlendMode(1); /* 1 == "per pixel alpha" */
+ return false;
+ }
+ fb->setBlendLevel(transparency);
+ return false;
+}
diff --git a/src/driver/fader.h b/src/driver/fader.h
new file mode 100644
index 000000000..fa386010b
--- /dev/null
+++ b/src/driver/fader.h
@@ -0,0 +1,42 @@
+/*
+ Neutrino-HD GUI, COSDFader implementation
+ Copyright (C) 2011 Stefan Seyfried
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+
+#ifndef __FADER_H__
+#define __FADER_H__
+
+#include
+
+class COSDFader
+{
+ private:
+ CFrameBuffer *fb;
+ int step;
+ int target_trans;
+ int transparency;
+ uint32_t timer;
+ public:
+ COSDFader(int trans);
+ ~COSDFader();
+
+ void StartFadeIn();
+ bool StartFadeOut();
+ void Stop();
+ bool Fade();
+ uint32_t GetTimer(){ return timer; };
+};
+#endif